MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / TestMaxOfThree

Function TestMaxOfThree

math/max/max_test.go:37–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestMaxOfThree(t *testing.T) {
38 testCases := []struct {
39 name string
40 left int
41 middle int
42 right int
43 max int
44 }{
45 {
46 name: "right is max",
47 left: 1,
48 middle: 5,
49 right: 10,
50 max: 10,
51 },
52 {
53 name: "left is max",
54 left: 10,
55 middle: 5,
56 right: 9,
57 max: 10,
58 },
59 {
60 name: "left is max",
61 left: 10,
62 middle: 8,
63 right: 6,
64 max: 10,
65 },
66 }
67
68 for _, test := range testCases {
69 t.Run(test.name, func(t *testing.T) {
70 actualMax := Int(test.left, test.middle, test.right)
71 if actualMax != test.max {
72 t.Errorf("Failed test %s\n\tleft: %v, middle: %v, right: %v, max: %v but received: %v",
73 test.name, test.left, test.middle, test.right, test.max, actualMax)
74 }
75 })
76 }
77}

Callers

nothing calls this directly

Calls 1

IntFunction · 0.70

Tested by

no test coverage detected