11package quickfix_test
22
33import (
4- "github.com/quickfixgo/quickfix"
54 "testing"
65 "time"
6+
7+ "github.com/quickfixgo/quickfix"
78)
89
910func TestUnmarshal_Literals (t * testing.T ) {
@@ -140,9 +141,22 @@ func TestUnmarshal_RepeatingGroups(t *testing.T) {
140141 StringField2 * string `fix:"9"`
141142 }
142143
144+ type AnonymousGroup struct {
145+ IntField3 int `fix:"3"`
146+ }
147+
148+ type GroupComponent1 struct {
149+ }
150+
151+ type GroupComponent2 struct {
152+ }
153+
143154 type Group2 struct {
144155 IntField1 int `fix:"1"`
145156 IntField2 int `fix:"2"`
157+ AnonymousGroup
158+ GroupComponent1
159+ OptionalComponent * GroupComponent2
146160 }
147161
148162 type Message struct {
@@ -160,12 +174,22 @@ func TestUnmarshal_RepeatingGroups(t *testing.T) {
160174 quickfix .GroupElement (quickfix .Tag (9 )),
161175 }
162176
177+ group2Template := quickfix.GroupTemplate {
178+ quickfix .GroupElement (quickfix .Tag (1 )),
179+ quickfix .GroupElement (quickfix .Tag (2 )),
180+ quickfix .GroupElement (quickfix .Tag (3 )),
181+ }
182+
163183 group1 := quickfix.RepeatingGroup {Tag : quickfix .Tag (100 ), GroupTemplate : group1Template }
164184 group1 .Add ().SetField (quickfix .Tag (8 ), quickfix .FIXString ("hello" )).SetField (quickfix .Tag (9 ), quickfix .FIXString ("world" ))
165185 group1 .Add ().SetField (quickfix .Tag (8 ), quickfix .FIXString ("goodbye" ))
166186 group1 .Add ().SetField (quickfix .Tag (8 ), quickfix .FIXString ("OHHAI" )).SetField (quickfix .Tag (9 ), quickfix .FIXString ("world" ))
167187 fixMsg .Body .SetGroup (group1 )
168188
189+ group2 := quickfix.RepeatingGroup {Tag : quickfix .Tag (101 ), GroupTemplate : group2Template }
190+ group2 .Add ().SetField (quickfix .Tag (1 ), quickfix .FIXInt (1 )).SetField (quickfix .Tag (2 ), quickfix .FIXInt (2 ))
191+ fixMsg .Body .SetGroup (group2 )
192+
169193 var msgOut Message
170194 quickfix .Unmarshal (fixMsg , & msgOut )
171195
0 commit comments