mirror of https://github.com/01-edu/public.git
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.
37 lines
680 B
37 lines
680 B
5 years ago
|
package main
|
||
5 years ago
|
|
||
|
import (
|
||
5 years ago
|
"github.com/01-edu/z01"
|
||
5 years ago
|
|
||
5 years ago
|
correct "./correct"
|
||
5 years ago
|
student "./student"
|
||
|
)
|
||
|
|
||
5 years ago
|
// the structs from the other packages
|
||
|
// struct just for the first exercise
|
||
5 years ago
|
type NodeF = student.Node
|
||
5 years ago
|
type NodeFS = correct.Node
|
||
5 years ago
|
|
||
5 years ago
|
// simple struct, just insert a element in the struct
|
||
|
func main() {
|
||
|
n1 := &NodeFS{}
|
||
|
n2 := &NodeF{}
|
||
5 years ago
|
|
||
5 years ago
|
table := [][]int{{{132423}}}
|
||
5 years ago
|
|
||
|
for i := 0; i < 5; i++ {
|
||
5 years ago
|
table = append(table, z01.MultRandIntBetween(-1000000, 10000000))
|
||
5 years ago
|
}
|
||
|
|
||
5 years ago
|
for _, items := range table {
|
||
|
for _, item := range items {
|
||
5 years ago
|
correct.CreateElem(n1, item)
|
||
5 years ago
|
student.CreateElem(n2, item)
|
||
5 years ago
|
}
|
||
|
|
||
5 years ago
|
if n1.Data != n2.Data {
|
||
|
z01.Fatalf("CreateElem == %d instead of %d\n", n1, n2)
|
||
5 years ago
|
}
|
||
|
}
|
||
|
}
|