-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
45 lines (38 loc) · 944 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"reflect"
"testing"
)
func TestCase1(t *testing.T) {
D := addPackage("D")
E := addPackage("E")
C := addPackage("C", D, E)
B := addPackage("B", C, E)
A := addPackage("A", D, B)
expected := []string{"D", "B", "C", "E"}
output := getDeps(A)
if !reflect.DeepEqual(expected, output) {
t.Errorf("Expected: %v, Output: %v\n", expected, output)
}
}
func TestCase2(t *testing.T) {
D := addPackage("D")
E := addPackage("E")
C := addPackage("C", D, E)
B := addPackage("B", C, E)
expected := []string{"C", "D", "E"}
output := getDeps(B)
if !reflect.DeepEqual(expected, output) {
t.Errorf("Expected: %v, Output: %v\n", expected, output)
}
}
func TestCase3(t *testing.T) {
D := addPackage("D")
E := addPackage("E")
C := addPackage("C", D, E)
expected := []string{"D", "E"}
output := getDeps(C)
if !reflect.DeepEqual(expected, output) {
t.Errorf("Expected: %v, Output: %v\n", expected, output)
}
}