MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestAbs

Function TestAbs

math/abs_test.go:9–18  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestAbs(t *testing.T) {
10 tests := getTests()
11 for _, test := range tests {
12 t.Run(test.name, func(t *testing.T) {
13 if got := Abs(test.n); got != test.want {
14 t.Errorf("Abs() = %v, want %v", got, test.want)
15 }
16 })
17 }
18}
19
20func getTests() []struct {
21 name string

Callers

nothing calls this directly

Calls 2

getTestsFunction · 0.70
AbsFunction · 0.70

Tested by

no test coverage detected