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

Function TestMultiplyMany

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

Source from the content-addressed store, hash-verified

48}
49
50func TestMultiplyMany(t *testing.T) {
51 t.Parallel()
52 type testCase struct {
53 inputs []float64
54 want float64
55 }
56 testCases := []testCase{
57 {inputs: []float64{}, want: 0},
58 {inputs: []float64{2}, want: 2},
59 {inputs: []float64{2, 2}, want: 4},
60 {inputs: []float64{1, 2, 3, 4}, want: 24},
61 }
62 for _, tc := range testCases {
63 got := calculator.MultiplyMany(tc.inputs...)
64 if tc.want != got {
65 t.Errorf("MultiplyMany(%v): want %f, got %f",
66 tc.inputs, tc.want, got)
67 }
68 }
69}
70
71func TestDivideMany(t *testing.T) {
72 t.Parallel()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected