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.
38 lines
689 B
38 lines
689 B
5 years ago
|
package main
|
||
5 years ago
|
|
||
5 years ago
|
type Node struct {
|
||
|
Data int
|
||
|
}
|
||
|
|
||
|
func CreateElem(n *Node, value int) {
|
||
|
n.Data = value
|
||
|
}
|
||
5 years ago
|
|
||
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, lib.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 {
|
||
5 years ago
|
lib.Fatalf("CreateElem == %d instead of %d\n", n1, n2)
|
||
5 years ago
|
}
|
||
|
}
|
||
|
}
|