Browse files

tests

  • Loading branch information...
1 parent 98d821c commit c5ce62661f6607b6975e63b4b75a51e974e43bd8 @Bonias committed Mar 21, 2013
View
154 test/fix_engine/fix/test_fix_message.rb
92 additions, 62 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
30 test/fix_engine/fix/test_fix_response.rb
@@ -3,19 +3,19 @@
require 'test/unit'
class FixResponseTest < Test::Unit::TestCase
- def test_initialize()
- assert_raise( ArgumentError ) { FIX::Response.new }
- session = FIX::Session.new("FIX.4.2", "etc/FIX42.xml")
- assert_raise( ArgumentError ) { FIX::Response.new( session ) }
- assert_nothing_raised( ArgumentError ) { FIX::Response.new( session, "" ) }
- assert_nothing_raised( ArgumentError ) { FIX::Response.new( session, "" ).response }
- assert_equal( FIX::Response.new( session, "" ).response.size, 0 )
- assert_equal( FIX::Response.new( session, "8=76" ).response.size, 1 )
- assert_equal( FIX::Response.new( session, "8=76" ).response[ 'BeginString' ], "76" )
- assert_equal( FIX::Response.new( session, "8=76#{1.chr}56=hello" ).response[ 'TargetCompID' ], "hello" )
- assert_equal( FIX::Response.new( session, "8=76#{1.chr}156=hello" ).response[ 'SettlCurrFxRateCalc' ], "hello" )
- assert_equal( FIX::Response.new( session, "8=76#{1.chr}33=3#{1.chr}58=hello#{1.chr}58=world#{1.chr}58=eoln" ).response[ 'Text' ], ["hello", "world", "eoln"] )
- assert_equal( FIX::Response.new( session, "8=76#{1.chr}556646=3" ).response[ '556646' ], "3" )
- assert_equal( FIX::Response.new( session, "8=76#{1.chr}556646=3#{1.chr}556646=hello" ).response[ '556646' ], ["3", "hello"] )
- end
+ def test_initialize()
+ assert_raise(ArgumentError) { FIX::Response.new }
+ session = FIX::Session.new("FIX.4.2", "etc/FIX42.xml")
+ assert_raise(ArgumentError) { FIX::Response.new(session) }
+ assert_nothing_raised(ArgumentError) { FIX::Response.new(session, "") }
+ assert_nothing_raised(ArgumentError) { FIX::Response.new(session, "").response }
+ assert_equal(0, FIX::Response.new(session, "").response.size)
+ assert_equal(1, FIX::Response.new(session, "8=76").response.size)
+ assert_equal("76", FIX::Response.new(session, "8=76").response['BeginString'])
+ assert_equal("hello", FIX::Response.new(session, "8=76\x0156=hello").response['TargetCompID'])
+ assert_equal("hello", FIX::Response.new(session, "8=76\x01156=hello").response['SettlCurrFxRateCalc'])
+ assert_equal(["hello", "world", "eoln"], FIX::Response.new(session, "8=76\x0133=3\x0158=hello\x0158=world\x0158=eoln").response['Text'])
+ assert_equal("3", FIX::Response.new(session, "8=76\x01556646=3").response['556646'])
+ assert_equal(["3", "hello"], FIX::Response.new(session, "8=76\x01556646=3\x01556646=hello").response['556646'])
+ end
end
View
18 test/fix_engine/fix/test_fix_session.rb
@@ -3,13 +3,13 @@
require 'test/unit'
class FixSessionTest < Test::Unit::TestCase
- def test_initialize()
- assert_raise( ArgumentError ) { FIX::Session.new }
- assert_nothing_raised( ArgumentError ) { FIX::Session.new("FIX.4.2", "etc/FIX42.xml") }
- session = FIX::Session.new("FIX.4.2", "etc/FIX42.xml")
- assert_equal( session.properties.size, 1 )
- assert_equal( session.properties['MsgSeqNum'], 1 )
- assert_equal( session.begin_string, "FIX.4.2" )
- assert_equal( session.schema_fields.class, LibXML::XML::XPath::Object )
- end
+ def test_initialize()
+ assert_raise(ArgumentError) { FIX::Session.new }
+ assert_nothing_raised(ArgumentError) { FIX::Session.new("FIX.4.2", "etc/FIX42.xml") }
+ session = FIX::Session.new("FIX.4.2", "etc/FIX42.xml")
+ assert_equal(1, session.properties.size)
+ assert_equal(1, session.properties['MsgSeqNum'])
+ assert_equal("FIX.4.2", session.begin_string)
+ assert_equal(FIX::Schema, session.schema.class)
+ end
end

0 comments on commit c5ce626

Please sign in to comment.