]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/server_blackbox_test.go
Adopt more fixed size array types for struct fields
[rbdr/mobius] / hotline / server_blackbox_test.go
index 059fe5a49ba267306010fc257c3a831932d0134b..28aecf08875c195772f6d88ba5c9f89577c0f63e 100644 (file)
@@ -30,32 +30,38 @@ func assertTransferBytesEqual(t *testing.T, wantHexDump string, got []byte) bool
        return assert.Equal(t, wantHexDump, hex.Dump(clean))
 }
 
-// tranAssertEqual compares equality of transactions slices after stripping out the random ID
+// tranAssertEqual compares equality of transactions slices after stripping out the random transaction ID
 func tranAssertEqual(t *testing.T, tran1, tran2 []Transaction) bool {
        var newT1 []Transaction
        var newT2 []Transaction
 
        for _, trans := range tran1 {
-               trans.ID = []byte{0, 0, 0, 0}
+               trans.ID = [4]byte{0, 0, 0, 0}
                var fs []Field
                for _, field := range trans.Fields {
-                       if field.ID == [2]byte{0x00, 0x6b} {
+                       if field.ID == [2]byte{0x00, 0x6b} { // FieldRefNum
                                continue
                        }
-                       fs = append(fs, field)
+                       if field.ID == [2]byte{0x00, 0x72} { // FieldChatID
+                               continue
+                       }
+                       trans.Fields = append(trans.Fields, field)
                }
                trans.Fields = fs
                newT1 = append(newT1, trans)
        }
 
        for _, trans := range tran2 {
-               trans.ID = []byte{0, 0, 0, 0}
+               trans.ID = [4]byte{0, 0, 0, 0}
                var fs []Field
                for _, field := range trans.Fields {
-                       if field.ID == [2]byte{0x00, 0x6b} {
+                       if field.ID == [2]byte{0x00, 0x6b} { // FieldRefNum
+                               continue
+                       }
+                       if field.ID == [2]byte{0x00, 0x72} { // FieldChatID
                                continue
                        }
-                       fs = append(fs, field)
+                       trans.Fields = append(trans.Fields, field)
                }
                trans.Fields = fs
                newT2 = append(newT2, trans)