MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestBitArrayProtoBuf

Function TestBitArrayProtoBuf

libs/bits/bit_array_test.go:269–290  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

267}
268
269func TestBitArrayProtoBuf(t *testing.T) {
270 testCases := []struct {
271 msg string
272 bA1 *BitArray
273 expPass bool
274 }{
275 {"success empty", &BitArray{}, true},
276 {"success", NewBitArray(1), true},
277 {"success", NewBitArray(2), true},
278 {"negative", NewBitArray(-1), false},
279 }
280 for _, tc := range testCases {
281 protoBA := tc.bA1.ToProto()
282 ba := new(BitArray)
283 ba.FromProto(protoBA)
284 if tc.expPass {
285 require.Equal(t, tc.bA1, ba, tc.msg)
286 } else {
287 require.NotEqual(t, tc.bA1, ba, tc.msg)
288 }
289 }
290}

Callers

nothing calls this directly

Calls 4

NewBitArrayFunction · 0.85
EqualMethod · 0.65
ToProtoMethod · 0.45
FromProtoMethod · 0.45

Tested by

no test coverage detected