MCPcopy Create free account
hub / github.com/0xAX/go-algorithms / Test_minmax

Function Test_minmax

binaryTree/binaryTree_test.go:28–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func Test_minmax(t *testing.T) {
29 tree := New(compare)
30
31 testValues := []int{4, 5, 3, 2, 9}
32 for _, i := range testValues {
33 tree.Insert(i)
34 }
35
36 max := tree.Max()
37 if max != 9 {
38 t.Errorf("[Error] max: expected 9, got %d", max)
39 }
40
41 min := tree.Min()
42 if min != 2 {
43 t.Errorf("[Error] max: expected 2, got %d", min)
44 }
45}

Callers

nothing calls this directly

Calls 4

InsertMethod · 0.80
MaxMethod · 0.80
MinMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected