MCPcopy
hub / github.com/skip2/go-qrcode / TestAppendByte

Function TestAppendByte

bitset/bitset_test.go:52–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestAppendByte(t *testing.T) {
53 tests := []struct {
54 initial *Bitset
55 value byte
56 numBits int
57 expected *Bitset
58 }{
59 {
60 New(),
61 0x01,
62 1,
63 New(b1),
64 },
65 {
66 New(b1),
67 0x01,
68 1,
69 New(b1, b1),
70 },
71 {
72 New(b0),
73 0x01,
74 1,
75 New(b0, b1),
76 },
77 {
78 New(b1, b0, b1, b0, b1, b0, b1),
79 0xAA, // 0b10101010
80 2,
81 New(b1, b0, b1, b0, b1, b0, b1, b1, b0),
82 },
83 {
84 New(b1, b0, b1, b0, b1, b0, b1),
85 0xAA, // 0b10101010
86 8,
87 New(b1, b0, b1, b0, b1, b0, b1, b1, b0, b1, b0, b1, b0, b1, b0),
88 },
89 }
90
91 for _, test := range tests {
92 test.initial.AppendByte(test.value, test.numBits)
93 if !equal(test.initial.Bits(), test.expected.Bits()) {
94 t.Errorf("Got %v, expected %v", test.initial.Bits(),
95 test.expected.Bits())
96 }
97 }
98}
99
100func TestAppendUint32(t *testing.T) {
101 tests := []struct {

Callers

nothing calls this directly

Calls 4

equalFunction · 0.85
AppendByteMethod · 0.80
BitsMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…