Skip to content

Commit

Permalink
Failing unit test for message with repeating group
Browse files Browse the repository at this point in the history
  • Loading branch information
ackleymi committed May 1, 2024
1 parent b9e203b commit d591447
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ func (s *MessageSuite) TestReBuild() {
s.True(bytes.Equal(s.msg.bodyBytes, expectedBodyBytes), "Incorrect body bytes, got %s", string(s.msg.bodyBytes))
}

func (s *MessageSuite) TestRebuildWithRepeatingGroup() {

dict, dictErr := datadictionary.Parse("spec/FIX44.xml")
s.Nil(dictErr)

// Given message bytes from a valid string
rawMsg := bytes.NewBufferString("8=FIX.4.49=21035=D34=2347=UTF-852=20231231-20:19:4149=0100150=01001a56=TEST44=1211=139761=1010040021=1386=1336=NOPL55=SYMABC54=160=20231231-20:19:4138=140=259=0453=1448=4501447=D452=28354=6355=Public10=104")

// When we parse it into a message
s.Nil(ParseMessageWithDataDictionary(s.msg, rawMsg, dict, dict))

// And then rebuild the message bytes
rebuildBytes := s.msg.build()

// this method does result in test passing.
//s.msg.buildWithBodyBytes(s.msg.bodyBytes)

expectedBytes := []byte("8=FIX.4.49=21035=D34=249=0100150=01001a52=20231231-20:19:4156=TEST347=UTF-844=1211=139761=1010040021=1386=1336=NOPL55=SYMABC54=160=20231231-20:19:4138=140=259=0453=1448=4501447=D452=28354=6355=Public10=104")

// Then the bytes should be the same with repeating group properly ordered
s.True(bytes.Equal(expectedBytes, rebuildBytes), "Unexpected bytes,\n +%s\n -%s", rebuildBytes, expectedBytes)
}

func (s *MessageSuite) TestReBuildWithRepeatingGroupForResend() {
// Given the following message with a repeating group
origHeader := "8=FIXT.1.19=16135=834=349=ISLD52=20240415-03:43:17.92356=TW"
Expand Down

0 comments on commit d591447

Please sign in to comment.