MCPcopy Create free account
hub / github.com/bitfield/ftl-code / TestAddMany

Function TestAddMany

8.3/calculator_test.go:8–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestAddMany(t *testing.T) {
9 t.Parallel()
10 type testCase struct {
11 inputs []float64
12 want float64
13 }
14 testCases := []testCase{
15 {inputs: []float64{}, want: 0},
16 {inputs: []float64{2}, want: 2},
17 {inputs: []float64{2, 2}, want: 4},
18 {inputs: []float64{1, 2, 3}, want: 6},
19 }
20 for _, tc := range testCases {
21 got := calculator.AddMany(tc.inputs...)
22 if tc.want != got {
23 t.Errorf("AddMany(%v): want %f, got %f",
24 tc.inputs, tc.want, got)
25 }
26 }
27}
28
29func TestSubtractMany(t *testing.T) {
30 t.Parallel()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected