MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / Test_trap

Function Test_trap

trapping_rain_water_42/solution_test.go:8–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func Test_trap(t *testing.T) {
9 type args struct {
10 height []int
11 }
12 tests := []struct {
13 name string
14 args args
15 want int
16 }{
17 {
18 name: "trapping rain water",
19 args: args{
20 height: []int{
21 0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1,
22 },
23 },
24 want: 6,
25 },
26 }
27 for _, tt := range tests {
28 t.Run(tt.name, func(t *testing.T) {
29 assert.Equal(t, tt.want, trap(tt.args.height))
30 assert.Equal(t, tt.want, trap2(tt.args.height))
31 })
32 }
33}

Callers

nothing calls this directly

Calls 2

trapFunction · 0.85
trap2Function · 0.85

Tested by

no test coverage detected