test/tc_factory_997.rb in X12-0.1.0 vs test/tc_factory_997.rb in X12-1.1.0

- old
+ new

@@ -31,27 +31,27 @@ ST*997*2878~ AK1*HS*293328532~ AK2*270*~ AK3*NM1**L1000D~ AK4***55*Bad element~ -AK5*~ +AK5*A~ AK3*DMG*0*L1010*22~ AK4*0**0~ AK4*0**1~ AK4*1**0~ AK4*1**1~ -AK5*666****999~ +AK5*E****999~ AK9****~ SE**~ EOT @@result = tmp.gsub!(/\n/,'') - @@times = 1000 def setup unless @@p - @@p = X12::Parser.new('misc/997.d12') + # @@p = X12::Parser.new('misc/997single.xml') + @@p = X12::Parser.new('misc/997.xml') end end # setup def teardown # Nothing @@ -84,10 +84,14 @@ #s.DataElementSyntaxErrorCode = s.CopyOfBadDataElement = 'Bad element' } } + @r.L1000.AK5{|a| + a.TransactionSetAcknowledgmentCode = 'A' + } # a + # Should be two repeats in total @r.L1000.repeat {|l1000| (0..1).each {|loop_repeat| # Two repeats of the loop L1010 l1000.L1010.repeat {|l1010| @@ -108,23 +112,23 @@ } # ak4_repeat } # l1010 } # loop_repeat l1000.AK5{|a| - a.TransactionSetAcknowledgmentCode = 666 + a.TransactionSetAcknowledgmentCode = 'E' a.TransactionSetSyntaxErrorCode4 = 999 } # a } # l1000 assert_equal(@@result, @r.render) end # test_all def test_timing start = Time::now - @@times.times do + X12::TEST_REPEAT.times do test_all end finish = Time::now - puts "Factories per second, 997: #{@@times.to_f/(finish-start)}, elapsed: #{finish-start}" + puts sprintf("Factories per second, 997: %.2f, elapsed: %.1f", X12::TEST_REPEAT.to_f/(finish-start), finish-start) end # test_timing end # TestList