Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 65f99ca

Browse files
Create find-all-possible-recipes-from-given-supplies_test.go
1 parent fb1dc45 commit 65f99ca

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package leetcode_solutions_golang
2+
3+
import (
4+
"reflect"
5+
"testing"
6+
)
7+
8+
func Test_findAllRecipes(t *testing.T) {
9+
type args struct {
10+
recipes []string
11+
ingredients [][]string
12+
supplies []string
13+
}
14+
tests := []struct {
15+
name string
16+
args args
17+
want []string
18+
}{
19+
{
20+
name: "test case 1",
21+
args: args{
22+
recipes: []string{
23+
"bread", "sandwich", "burger",
24+
},
25+
ingredients: [][]string{
26+
{"yeast", "flour"}, {"bread", "meat"}, {"sandwich", "meat", "bread"},
27+
},
28+
supplies: []string{"yeast", "flour", "meat"},
29+
},
30+
want: []string{"bread", "sandwich", "burger"},
31+
},
32+
}
33+
for _, tt := range tests {
34+
t.Run(tt.name, func(t *testing.T) {
35+
if got := findAllRecipes(tt.args.recipes, tt.args.ingredients, tt.args.supplies); !reflect.DeepEqual(got, tt.want) {
36+
t.Errorf("findAllRecipes() = %v, want %v", got, tt.want)
37+
}
38+
})
39+
}
40+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /