(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestCoinChange(t *testing.T) { |
| 10 | coinCombination := []int32{1, 2, 5, 10} |
| 11 | targets := []struct { |
| 12 | target int32 |
| 13 | expected int32 |
| 14 | }{ |
| 15 | {4, 2}, |
| 16 | {5, 3}, |
| 17 | {10, 8}, |
| 18 | {15, 19}, |
| 19 | {20, 34}, |
| 20 | } |
| 21 | |
| 22 | for _, v := range targets { |
| 23 | t.Run(fmt.Sprintf("target: %d ", v.target), func(t *testing.T) { |
| 24 | result := dynamic.CoinChange(coinCombination, v.target) |
| 25 | if result != v.expected { |
| 26 | t.Errorf("target: %d Expected %d, got %d", v.target, v.expected, result) |
| 27 | } |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | } |
nothing calls this directly
no test coverage detected