MCPcopy
hub / github.com/anthonynsimon/bild / TestMax

Function TestMax

math/integer/helpers_test.go:44–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestMax(t *testing.T) {
45 cases := []struct {
46 a, b, expected int
47 }{
48 {
49 a: 0,
50 b: 0,
51 expected: 0,
52 },
53 {
54 a: 1,
55 b: 1,
56 expected: 1,
57 },
58 {
59 a: -1,
60 b: 1,
61 expected: 1,
62 },
63 {
64 a: 1,
65 b: -1,
66 expected: 1,
67 },
68 {
69 a: 10,
70 b: 2,
71 expected: 10,
72 },
73 }
74
75 for _, c := range cases {
76 actual := Max(c.a, c.b)
77 if actual != c.expected {
78 t.Errorf("Max: expected: %v actual: %v", c.expected, actual)
79 }
80 }
81}

Callers

nothing calls this directly

Calls 1

MaxFunction · 0.85

Tested by

no test coverage detected