Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bug with ruby 1.8.7: str[i] returns a int instead of char, what…
… caused wrong sign calculations on amounts. Added spec
- Loading branch information
Showing
7 changed files
with
144 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Norma43 | ||
VERSION = "0.2" | ||
VERSION = "0.3" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
118888555511111111111103011103202000000010593169783THE EXPENDABLES REVAMP SL | ||
22 0901110301110301040161000000000927000000000000000000000000 | ||
2301TRANSFERENC. A Silvester Stallone | ||
22 0901110301110301040161000000001274090000000000000000000000 | ||
2301TRANSFERENC. A Mickey Rourke | ||
22 0901110302110302040162000000000424800000000000001111111111 | ||
2301TRANSFERENC. Bruce Willis | ||
22 0901110303110303040161000000000236000000000000000000000000 | ||
2301TRANSFERENC. A Charisma Carpenter | ||
22 0901110304110304990801000000005000000000000000000000000000 | ||
2301APER IMPOSIC 123456789-00 | ||
22 09011103041103041203110000000011778100000000000987654321221234123412341234 | ||
2301TARJ.CREDITO Hank Amos | ||
22 09011103041103041203110000000001882000000000000987654321116789678967896789 | ||
2301TRANSFERENC. Jet Li | ||
22 0901110309110309040162000000001539900000000000123451234566 | ||
2301TRANSFERENC. Terry Crews | ||
22 090111030911030904016200000000071154000000000000BA12345678 | ||
2301TRANSFERENC. David Zayas | ||
22 0901110321110319170892000000000003030000000000000000000000 | ||
2301LIQ.INT.IMP. 123456789-00 | ||
3388885555111111111100006000000008803100000400000000267927200000000446933978 | ||
88999999999999999999000022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
:info: | ||
:currency: "978" | ||
:final_balance: 4469.33 | ||
:begin_date: 2011-03-01 | ||
:account: | ||
:bank: "8888" | ||
:office: "5555" | ||
:number: "1111111111" | ||
:control: ?? | ||
:end_date: 2011-03-20 | ||
:account_owner: THE EXPENDABLES REVAMP SL | ||
:initial_balance: 10593.16 | ||
:movements: | ||
- :concept: TRANSFERENC. A Silvester Stallone | ||
:operation_date: 2011-03-01 | ||
:amount: -927.0 | ||
:value_date: 2011-03-01 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: "000000000000" | ||
:reference_2: "" | ||
- :concept: TRANSFERENC. A Mickey Rourke | ||
:operation_date: 2011-03-01 | ||
:amount: -1274.09 | ||
:value_date: 2011-03-01 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: "000000000000" | ||
:reference_2: "" | ||
- :concept: TRANSFERENC. Bruce Willis | ||
:operation_date: 2011-03-02 | ||
:amount: 424.8 | ||
:value_date: 2011-03-02 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: "001111111111" | ||
:reference_2: "" | ||
- :concept: TRANSFERENC. A Charisma Carpenter | ||
:operation_date: 2011-03-03 | ||
:amount: -236.0 | ||
:value_date: 2011-03-03 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: "000000000000" | ||
:reference_2: "" | ||
- :concept: APER IMPOSIC 123456789-00 | ||
:operation_date: 2011-03-04 | ||
:amount: -5000.0 | ||
:value_date: 2011-03-04 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: "000000000000" | ||
:reference_2: "" | ||
- :concept: TARJ.CREDITO Hank Amos | ||
:operation_date: 2011-03-04 | ||
:amount: -1177.81 | ||
:value_date: 2011-03-04 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: 098765432122 | ||
:reference_2: "1234123412341234" | ||
- :concept: TRANSFERENC. Jet Li | ||
:operation_date: 2011-03-04 | ||
:amount: -188.2 | ||
:value_date: 2011-03-04 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: 098765432111 | ||
:reference_2: "6789678967896789" | ||
- :concept: TRANSFERENC. Terry Crews | ||
:operation_date: 2011-03-09 | ||
:amount: 1539.9 | ||
:value_date: 2011-03-09 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: "123451234566" | ||
:reference_2: "" | ||
- :concept: TRANSFERENC. David Zayas | ||
:operation_date: 2011-03-09 | ||
:amount: 711.54 | ||
:value_date: 2011-03-09 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: 00BA12345678 | ||
:reference_2: "" | ||
- :concept: LIQ.INT.IMP. 123456789-00 | ||
:operation_date: 2011-03-21 | ||
:amount: 3.03 | ||
:value_date: 2011-03-19 | ||
:office: 0901 | ||
:operation: "0000000000" | ||
:reference_1: "000000000000" | ||
:reference_2: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper' | ||
require 'lib/norma43' | ||
|
||
describe Norma43 do | ||
|
||
describe "parse" do | ||
|
||
before :each do | ||
@data = Norma43.read(File.join(File.dirname(__FILE__), "..", "data", "test.n43")) | ||
end | ||
|
||
specify { @data[:movements].size.should == 10 } | ||
specify { @data[:info][:initial_balance].should == 10593.16 } | ||
specify { @data[:info][:final_balance].should == 4469.33 } | ||
|
||
#initial_balance + movements should be final balance. Float comparison with be_within | ||
specify { (@data[:info][:initial_balance] + @data[:movements].inject( 0 ) { |sum,x| sum+x[:amount] }).should be_within(0.1).of(@data[:info][:final_balance]) } | ||
|
||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters