| 6 | ) |
| 7 | |
| 8 | func Test_maxArea(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: "container with most water", |
| 19 | args: args{ |
| 20 | height: []int{ |
| 21 | 1, 8, 6, 2, 5, 4, 8, 3, 7, |
| 22 | }, |
| 23 | }, |
| 24 | want: 49, |
| 25 | }, |
| 26 | { |
| 27 | name: "container with most water", |
| 28 | args: args{ |
| 29 | height: []int{ |
| 30 | 1, 1, |
| 31 | }, |
| 32 | }, |
| 33 | want: 1, |
| 34 | }, |
| 35 | { |
| 36 | name: "container with most water", |
| 37 | args: args{ |
| 38 | height: []int{ |
| 39 | 1, 2, 4, 3, |
| 40 | }, |
| 41 | }, |
| 42 | want: 4, |
| 43 | }, |
| 44 | } |
| 45 | for _, tt := range tests { |
| 46 | t.Run(tt.name, func(t *testing.T) { |
| 47 | assert.Equal(t, tt.want, maxArea(tt.args.height)) |
| 48 | }) |
| 49 | } |
| 50 | } |