package common import ( "reflect" "testing" ) func TestIntArrayMinus(t *testing.T) { type args struct { xs []int ys []int } tests := []struct { name string args args wantZs []int }{ { name: "test1", args: args{ xs: []int{1, 2, 3, 4, 5, 6, 7, 8, 9}, ys: []int{2, 4, 6, 8}, }, wantZs: []int{1, 3, 5, 7, 9}, }, { name: "test2", args: args{ xs: []int{1, 2, 3, 4, 5, 6, 7, 8, 9}, ys: []int{1, 2, 3, 11}, }, wantZs: []int{4, 5, 6, 7, 8, 9}, }, { name: "test3", args: args{ xs: []int{1, 2, 3, 4, 5, 6, 7, 8, 9}, ys: []int{}, }, wantZs: []int{1, 2, 3, 4, 5, 6, 7, 8, 9}, }, { name: "test4", args: args{ xs: []int{}, ys: []int{1}, }, wantZs: []int{}, }, { name: "test5", args: args{ xs: []int{}, ys: []int{}, }, wantZs: []int{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if gotZs := IntArrayMinus(tt.args.xs, tt.args.ys); !reflect.DeepEqual(gotZs, tt.wantZs) { t.Errorf("IntArrayMinus() got %v, want %v", gotZs, tt.wantZs) } }) } }