TestStringSetMsgpAppendBinary tests AppendBinary for StringSet
(t *testing.T)
| 135 | |
| 136 | // TestStringSetMsgpAppendBinary tests AppendBinary for StringSet |
| 137 | func TestStringSetMsgpAppendBinary(t *testing.T) { |
| 138 | set1 := CreateStringSet("foo", "bar") |
| 139 | set2 := CreateStringSet("baz", "qux") |
| 140 | |
| 141 | // Append set1 |
| 142 | data, err := set1.AppendBinary(nil) |
| 143 | if err != nil { |
| 144 | t.Fatalf("AppendBinary(set1) error = %v", err) |
| 145 | } |
| 146 | |
| 147 | // Append set2 to existing data |
| 148 | data, err = set2.AppendBinary(data) |
| 149 | if err != nil { |
| 150 | t.Fatalf("AppendBinary(set2) error = %v", err) |
| 151 | } |
| 152 | |
| 153 | // Decode both sets |
| 154 | var decoded1 StringSet |
| 155 | remaining, err := decoded1.UnmarshalMsg(data) |
| 156 | if err != nil { |
| 157 | t.Fatalf("UnmarshalMsg(set1) error = %v", err) |
| 158 | } |
| 159 | |
| 160 | var decoded2 StringSet |
| 161 | _, err = decoded2.UnmarshalMsg(remaining) |
| 162 | if err != nil { |
| 163 | t.Fatalf("UnmarshalMsg(set2) error = %v", err) |
| 164 | } |
| 165 | |
| 166 | if !set1.Equals(decoded1) { |
| 167 | t.Errorf("AppendBinary failed for set1: original=%v, decoded=%v", set1.ToSlice(), decoded1.ToSlice()) |
| 168 | } |
| 169 | |
| 170 | if !set2.Equals(decoded2) { |
| 171 | t.Errorf("AppendBinary failed for set2: original=%v, decoded=%v", set2.ToSlice(), decoded2.ToSlice()) |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | // TestStringSetMsgsize tests Msgsize for StringSet |
| 176 | func TestStringSetMsgsize(t *testing.T) { |
nothing calls this directly
no test coverage detected