MCPcopy
hub / github.com/segmentio/ksuid / TestAdd128

Function TestAdd128

uint128_test.go:50–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestAdd128(t *testing.T) {
51 tests := []struct {
52 x uint128
53 y uint128
54 z uint128
55 }{
56 {
57 x: makeUint128(0, 0),
58 y: makeUint128(0, 0),
59 z: makeUint128(0, 0),
60 },
61 {
62 x: makeUint128(0, 1),
63 y: makeUint128(0, 0),
64 z: makeUint128(0, 1),
65 },
66 {
67 x: makeUint128(0, 0),
68 y: makeUint128(0, 1),
69 z: makeUint128(0, 1),
70 },
71 {
72 x: makeUint128(1, 0),
73 y: makeUint128(0, 1),
74 z: makeUint128(1, 1),
75 },
76 {
77 x: makeUint128(0, 1),
78 y: makeUint128(1, 0),
79 z: makeUint128(1, 1),
80 },
81 {
82 x: makeUint128(0, 0xFFFFFFFFFFFFFFFF),
83 y: makeUint128(0, 1),
84 z: makeUint128(1, 0),
85 },
86 }
87
88 for _, test := range tests {
89 t.Run(fmt.Sprintf("add128(%s,%s)", test.x, test.y), func(t *testing.T) {
90 if z := add128(test.x, test.y); z != test.z {
91 t.Error(z, "!=", test.z)
92 }
93 })
94 }
95}
96
97func TestSub128(t *testing.T) {
98 tests := []struct {

Callers

nothing calls this directly

Calls 2

makeUint128Function · 0.85
add128Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…