forked from root/public
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.
62 lines
1.2 KiB
62 lines
1.2 KiB
package main |
|
|
|
import ( |
|
student "student" |
|
|
|
"func/correct" |
|
|
|
"lib" |
|
) |
|
|
|
type Node2 = student.NodeL |
|
type List2 = correct.List |
|
type NodeS2 = correct.NodeL |
|
type ListS2 = student.List |
|
|
|
func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { |
|
n := &Node2{Data: data} |
|
n1 := &NodeS2{Data: data} |
|
if l.Head == nil { |
|
l.Head = n |
|
} else { |
|
iterator := l.Head |
|
for iterator.Next != nil { |
|
iterator = iterator.Next |
|
} |
|
iterator.Next = n |
|
} |
|
|
|
if l1.Head == nil { |
|
l1.Head = n1 |
|
} else { |
|
iterator1 := l1.Head |
|
for iterator1.Next != nil { |
|
iterator1 = iterator1.Next |
|
} |
|
iterator1.Next = n1 |
|
} |
|
} |
|
|
|
func main() { |
|
link := &List2{} |
|
link2 := &ListS2{} |
|
table := []correct.NodeTest{} |
|
table = correct.ElementsToTest(table) |
|
table = append(table, |
|
correct.NodeTest{ |
|
Data: []interface{}{"Hello", "man", "how are you"}, |
|
}, |
|
) |
|
for _, arg := range table { |
|
for i := 0; i < len(arg.Data); i++ { |
|
listPushBackTest2(link2, link, arg.Data[i]) |
|
} |
|
aux := correct.ListSize(link) |
|
aux2 := student.ListSize(link2) |
|
if aux != aux2 { |
|
lib.Fatalf("ListSize(%v) == %d instead of %d\n", correct.ListToString(link.Head), aux2, aux) |
|
} |
|
link = &List2{} |
|
link2 = &ListS2{} |
|
} |
|
}
|
|
|