You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
888 B

package student_test
import (
"testing"
solution "./solutions"
student "./student"
"github.com/01-edu/z01"
)
//the structs from the other packages
//struct just for the first exercise
type NodeF = student.Node
type NodeFS = solution.Node
//exercise 1
//simple struct, just insert a element in the struct
func TestCreateElem(t *testing.T) {
n := &NodeFS{}
n1 := &NodeF{}
type nodeTest struct {
data []int
}
table := []nodeTest{}
for i := 0; i < 5; i++ {
val := nodeTest{
data: z01.MultRandIntBetween(-1000000, 10000000),
}
table = append(table, val)
}
table = append(table,
nodeTest{
data: []int{132423},
},
)
for _, arg := range table {
for i := 0; i < len(arg.data); i++ {
solution.CreateElem(n, arg.data[i])
student.CreateElem(n1, arg.data[i])
}
if n.Data != n1.Data {
t.Errorf("CreateElem == %d instead of %d\n", n, n1)
}
}
}