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