MCPcopy
hub / github.com/montanaflynn/stats / TestInterfaceMethods

Function TestInterfaceMethods

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

Source from the content-addressed store, hash-verified

48}
49
50func TestInterfaceMethods(t *testing.T) {
51 // Test Get
52 a := data1.Get(1)
53 if a != -10.001 {
54 t.Errorf("Get(2) => %.1f != %.1f", a, -10.001)
55 }
56
57 // Test Len
58 l := data1.Len()
59 if l != 8 {
60 t.Errorf("Len() => %v != %v", l, 8)
61 }
62
63 // Test Less
64 b := data1.Less(0, 5)
65 if !b {
66 t.Errorf("Less() => %v != %v", b, true)
67 }
68
69 // Test Swap
70 data1.Swap(0, 2)
71 if data1.Get(0) != 5 {
72 t.Errorf("Len() => %v != %v", l, 8)
73 }
74}
75
76func TestHelperMethods(t *testing.T) {
77

Callers

nothing calls this directly

Calls 4

GetMethod · 0.80
LenMethod · 0.80
LessMethod · 0.80
SwapMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…