forked from quickfixgo/fix44
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from longbridgeapp/feat/extend_entries
add Side field to NoMDEntries of MarketDataSnapshotFullRefresh
- Loading branch information
Showing
2 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
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
57 changes: 57 additions & 0 deletions
57
marketdatasnapshotfullrefresh/MarketDataSnapshotFullRefresh.generated_test.go
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,57 @@ | ||
package marketdatasnapshotfullrefresh | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/quickfixgo/enum" | ||
"github.com/quickfixgo/quickfix" | ||
. "github.com/smartystreets/goconvey/convey" | ||
) | ||
|
||
func Test_MarketDataSnapshotFullRefresh(t *testing.T) { | ||
Convey("NoMDEntriesRepeatingGroup", t, func() { | ||
Convey("Group data with side field", func() { | ||
rowData := bytes.NewBufferString("8=FIX.4.49=20835=W34=53949=SenderCompID52=20230628-08:29:47.30056=TargetCompID55=ETHUSD262=staging-1687940826268=2269=2270=1857.1271=2.019273=08:29:47336=CONTINUOUS54=1269=B271=31767.82357346336=CONTINUOUS10=165") | ||
|
||
msg := quickfix.NewMessage() | ||
err := quickfix.ParseMessage(msg, rowData) | ||
So(err, ShouldBeNil) | ||
|
||
group := NewNoMDEntriesRepeatingGroup() | ||
err = msg.ToMessage().Body.GetGroup(group) | ||
So(err, ShouldBeNil) | ||
So(group.Len(), ShouldEqual, 2) | ||
|
||
entry := group.Get(0) | ||
ok := entry.HasSide() | ||
side, err := entry.GetSide() | ||
So(ok, ShouldBeTrue) | ||
So(err, ShouldBeNil) | ||
So(side, ShouldEqual, enum.Side_BUY) | ||
}) | ||
|
||
Convey("Group data without side field", func() { | ||
rowData := bytes.NewBufferString("8=FIX.4.49=20335=W34=53949=SenderCompID52=20230628-08:29:47.30056=TargetCompID55=ETHUSD262=staging-1687940826268=2269=2270=1857.1271=2.019273=08:29:47336=CONTINUOUS269=B271=31767.82357346336=CONTINUOUS10=165") | ||
|
||
msg := quickfix.NewMessage() | ||
err := quickfix.ParseMessage(msg, rowData) | ||
So(err, ShouldBeNil) | ||
|
||
group := NewNoMDEntriesRepeatingGroup() | ||
err = msg.ToMessage().Body.GetGroup(group) | ||
So(err, ShouldBeNil) | ||
So(group.Len(), ShouldEqual, 2) | ||
|
||
newEntry := group.Add() | ||
ok := newEntry.HasSide() | ||
So(ok, ShouldBeFalse) | ||
|
||
newEntry.SetSide(enum.Side_SELL) | ||
ok = newEntry.HasSide() | ||
side, err := newEntry.GetSide() | ||
So(ok, ShouldBeTrue) | ||
So(side, ShouldEqual, enum.Side_SELL) | ||
}) | ||
}) | ||
} |