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

Function TestCmp128

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

Source from the content-addressed store, hash-verified

6)
7
8func TestCmp128(t *testing.T) {
9 tests := []struct {
10 x uint128
11 y uint128
12 k int
13 }{
14 {
15 x: makeUint128(0, 0),
16 y: makeUint128(0, 0),
17 k: 0,
18 },
19 {
20 x: makeUint128(0, 1),
21 y: makeUint128(0, 0),
22 k: +1,
23 },
24 {
25 x: makeUint128(0, 0),
26 y: makeUint128(0, 1),
27 k: -1,
28 },
29 {
30 x: makeUint128(1, 0),
31 y: makeUint128(0, 1),
32 k: +1,
33 },
34 {
35 x: makeUint128(0, 1),
36 y: makeUint128(1, 0),
37 k: -1,
38 },
39 }
40
41 for _, test := range tests {
42 t.Run(fmt.Sprintf("cmp128(%s,%s)", test.x, test.y), func(t *testing.T) {
43 if k := cmp128(test.x, test.y); k != test.k {
44 t.Error(k, "!=", test.k)
45 }
46 })
47 }
48}
49
50func TestAdd128(t *testing.T) {
51 tests := []struct {

Callers

nothing calls this directly

Calls 2

makeUint128Function · 0.85
cmp128Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…