diff --git a/test-go/solutions/btree.go b/test-go/solutions/btree.go index ae989508..1ed44c86 100644 --- a/test-go/solutions/btree.go +++ b/test-go/solutions/btree.go @@ -1,4 +1,4 @@ -package correct +package solutions type TreeNode struct { Left, Right, Parent *TreeNode diff --git a/test-go/solutions/challenge.go b/test-go/solutions/challenge.go index 0a3d678a..0857cd29 100644 --- a/test-go/solutions/challenge.go +++ b/test-go/solutions/challenge.go @@ -1,4 +1,4 @@ -package correct +package solutions import ( "reflect" diff --git a/test-go/solutions/listat.go b/test-go/solutions/listat.go index a82da283..0070a413 100644 --- a/test-go/solutions/listat.go +++ b/test-go/solutions/listat.go @@ -1,4 +1,4 @@ -package correct +package solutions // returs the node in a given position func ListAt(l *NodeL, nbr int) *NodeL { diff --git a/test-go/solutions/listclear.go b/test-go/solutions/listclear.go index b797e00d..fc799799 100644 --- a/test-go/solutions/listclear.go +++ b/test-go/solutions/listclear.go @@ -1,4 +1,4 @@ -package correct +package solutions func ListClear(l *List) { temp := l.Head diff --git a/test-go/solutions/listfind.go b/test-go/solutions/listfind.go index 51a2df90..6c392d20 100644 --- a/test-go/solutions/listfind.go +++ b/test-go/solutions/listfind.go @@ -1,4 +1,4 @@ -package correct +package solutions // finds the element and returns the first data from the node that is a string func ListFind(l *List, ref interface{}, comp func(a, b interface{}) bool) *interface{} { diff --git a/test-go/solutions/listforeach.go b/test-go/solutions/listforeach.go index 55cd67ad..dd69bc78 100644 --- a/test-go/solutions/listforeach.go +++ b/test-go/solutions/listforeach.go @@ -1,4 +1,4 @@ -package correct +package solutions // applies a function in argument to each element of the linked list func ListForEach(l *List, f func(*NodeL)) { diff --git a/test-go/solutions/listforeachif.go b/test-go/solutions/listforeachif.go index 81e4bbbe..6aaea655 100644 --- a/test-go/solutions/listforeachif.go +++ b/test-go/solutions/listforeachif.go @@ -1,4 +1,4 @@ -package correct +package solutions // compare each element of the linked list to see if it is a String func IsPositive_node(node *NodeL) bool { diff --git a/test-go/solutions/listlast.go b/test-go/solutions/listlast.go index 688afd77..ea12ae04 100644 --- a/test-go/solutions/listlast.go +++ b/test-go/solutions/listlast.go @@ -1,4 +1,4 @@ -package correct +package solutions // gives the last element of the list func ListLast(l *List) interface{} { diff --git a/test-go/solutions/listmerge.go b/test-go/solutions/listmerge.go index b6d5fb48..f85862d1 100644 --- a/test-go/solutions/listmerge.go +++ b/test-go/solutions/listmerge.go @@ -1,4 +1,4 @@ -package correct +package solutions // merges the 2 lists in one (in the end of the first list) func ListMerge(l1 *List, l2 *List) { diff --git a/test-go/solutions/listpushback.go b/test-go/solutions/listpushback.go index 3d8858f2..e45ecf40 100644 --- a/test-go/solutions/listpushback.go +++ b/test-go/solutions/listpushback.go @@ -1,4 +1,4 @@ -package correct +package solutions type NodeL struct { Data interface{} diff --git a/test-go/solutions/listpushfront.go b/test-go/solutions/listpushfront.go index 2ba3db19..6ae0c5c6 100644 --- a/test-go/solutions/listpushfront.go +++ b/test-go/solutions/listpushfront.go @@ -1,4 +1,4 @@ -package correct +package solutions // inserts node on the first position of the list func ListPushFront(l *List, data interface{}) { diff --git a/test-go/solutions/listremoveif.go b/test-go/solutions/listremoveif.go index a7be6789..cd464d64 100644 --- a/test-go/solutions/listremoveif.go +++ b/test-go/solutions/listremoveif.go @@ -1,4 +1,4 @@ -package correct +package solutions // removes all elements that are equal to the data_ref func ListRemoveIf(l *List, data_ref interface{}) { diff --git a/test-go/solutions/listreverse.go b/test-go/solutions/listreverse.go index 27f70ae3..aee535c7 100644 --- a/test-go/solutions/listreverse.go +++ b/test-go/solutions/listreverse.go @@ -1,4 +1,4 @@ -package correct +package solutions func ListReverse(l *List) { current := l.Head diff --git a/test-go/solutions/listsize.go b/test-go/solutions/listsize.go index 6d122f92..7b1f497f 100644 --- a/test-go/solutions/listsize.go +++ b/test-go/solutions/listsize.go @@ -1,4 +1,4 @@ -package correct +package solutions func ListSize(l *List) int { count := 0 diff --git a/test-go/solutions/listsort.go b/test-go/solutions/listsort.go index 34a96417..abd893b2 100644 --- a/test-go/solutions/listsort.go +++ b/test-go/solutions/listsort.go @@ -1,4 +1,4 @@ -package correct +package solutions func ListSort(l *NodeI) *NodeI { head := l diff --git a/test-go/solutions/sortedlistmerge.go b/test-go/solutions/sortedlistmerge.go index d8c42488..c9f65823 100644 --- a/test-go/solutions/sortedlistmerge.go +++ b/test-go/solutions/sortedlistmerge.go @@ -1,4 +1,4 @@ -package correct +package solutions func SortedListMerge(l1 *NodeI, l2 *NodeI) *NodeI { if l1 == nil { diff --git a/test-go/solutions/sortlistinsert.go b/test-go/solutions/sortlistinsert.go index fb65031b..1342a7ed 100644 --- a/test-go/solutions/sortlistinsert.go +++ b/test-go/solutions/sortlistinsert.go @@ -1,4 +1,4 @@ -package correct +package solutions // structures for the linked lists type NodeI struct { diff --git a/test-go/tests/btreeapplybylevel_test/main.go b/test-go/tests/btreeapplybylevel_test/main.go index 5a8018d5..810fadd3 100644 --- a/test-go/tests/btreeapplybylevel_test/main.go +++ b/test-go/tests/btreeapplybylevel_test/main.go @@ -5,19 +5,19 @@ import ( student "student" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - correct.ChallengeTree("BTreeApplyByLevel", correct.BTreeApplyByLevel, student.BTreeApplyByLevel, root, rootS, fmt.Print) + solutions.ChallengeTree("BTreeApplyByLevel", solutions.BTreeApplyByLevel, student.BTreeApplyByLevel, root, rootS, fmt.Print) } diff --git a/test-go/tests/btreeapplyinorder_test/main.go b/test-go/tests/btreeapplyinorder_test/main.go index 30f98f7e..82b09e20 100644 --- a/test-go/tests/btreeapplyinorder_test/main.go +++ b/test-go/tests/btreeapplyinorder_test/main.go @@ -5,11 +5,11 @@ import ( student "student" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func main() { - root := &correct.TreeNode{Data: "08"} + root := &solutions.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} pos := []string{ "x", @@ -26,9 +26,9 @@ func main() { } for _, arg := range pos { - root = correct.BTreeInsertData(root, arg) + root = solutions.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) } - correct.ChallengeTree("BTreeApplyInorder", correct.BTreeApplyInorder, student.BTreeApplyInorder, root, rootS, fmt.Println) + solutions.ChallengeTree("BTreeApplyInorder", solutions.BTreeApplyInorder, student.BTreeApplyInorder, root, rootS, fmt.Println) } diff --git a/test-go/tests/btreeapplypostorder_test/main.go b/test-go/tests/btreeapplypostorder_test/main.go index 08683ead..30e8ba4c 100644 --- a/test-go/tests/btreeapplypostorder_test/main.go +++ b/test-go/tests/btreeapplypostorder_test/main.go @@ -5,11 +5,11 @@ import ( student "student" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func main() { - root := &correct.TreeNode{Data: "08"} + root := &solutions.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} pos := []string{ "x", @@ -26,9 +26,9 @@ func main() { } for _, arg := range pos { - root = correct.BTreeInsertData(root, arg) + root = solutions.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) } - correct.ChallengeTree("BTreeApplyPostorder", correct.BTreeApplyPostorder, student.BTreeApplyPostorder, root, rootS, fmt.Println) + solutions.ChallengeTree("BTreeApplyPostorder", solutions.BTreeApplyPostorder, student.BTreeApplyPostorder, root, rootS, fmt.Println) } diff --git a/test-go/tests/btreeapplypreorder_test/main.go b/test-go/tests/btreeapplypreorder_test/main.go index b5d13650..ec116a3d 100644 --- a/test-go/tests/btreeapplypreorder_test/main.go +++ b/test-go/tests/btreeapplypreorder_test/main.go @@ -5,11 +5,11 @@ import ( student "student" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func main() { - root := &correct.TreeNode{Data: "08"} + root := &solutions.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} pos := []string{ "x", @@ -26,9 +26,9 @@ func main() { } for _, arg := range pos { - root = correct.BTreeInsertData(root, arg) + root = solutions.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) } - correct.ChallengeTree("BTreeApplyPreorder", correct.BTreeApplyPreorder, student.BTreeApplyPreorder, root, rootS, fmt.Println) + solutions.ChallengeTree("BTreeApplyPreorder", solutions.BTreeApplyPreorder, student.BTreeApplyPreorder, root, rootS, fmt.Println) } diff --git a/test-go/tests/btreedeletenode_test/main.go b/test-go/tests/btreedeletenode_test/main.go index acbd0fcf..d9ffca8e 100644 --- a/test-go/tests/btreedeletenode_test/main.go +++ b/test-go/tests/btreedeletenode_test/main.go @@ -4,7 +4,7 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func parentListDelete(root *student.TreeNode) string { @@ -79,17 +79,17 @@ func formatSubTree_delete(root *student.TreeNode, prefix string) string { return res } -func errorMessage_delete(fn interface{}, deleted string, rootOr, root *correct.TreeNode, rootS *student.TreeNode) { +func errorMessage_delete(fn interface{}, deleted string, rootOr, root *solutions.TreeNode, rootS *student.TreeNode) { lib.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", "BTreeDeleteNode", - correct.FormatTree(rootOr), + solutions.FormatTree(rootOr), deleted, FormatTree_delete(rootS), - correct.FormatTree(root), + solutions.FormatTree(root), ) } -func CompareTrees_delete(fn interface{}, deleted string, rootOr, root *correct.TreeNode, rootS *student.TreeNode) { +func CompareTrees_delete(fn interface{}, deleted string, rootOr, root *solutions.TreeNode, rootS *student.TreeNode) { sel := student.BTreeSearchItem(rootS, deleted) if !student.BTreeIsBinary(rootS) || sel != nil { @@ -98,23 +98,23 @@ func CompareTrees_delete(fn interface{}, deleted string, rootOr, root *correct.T } func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} - rootOr := &correct.TreeNode{Data: "04"} + rootOr := &solutions.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) - rootOr = correct.BTreeInsertData(rootOr, v) + rootOr = solutions.BTreeInsertData(rootOr, v) } - selected := correct.BTreeSearchItem(root, "04") + selected := solutions.BTreeSearchItem(root, "04") selectedS := student.BTreeSearchItem(rootS, "04") - root = correct.BTreeDeleteNode(root, selected) + root = solutions.BTreeDeleteNode(root, selected) rootS = student.BTreeDeleteNode(rootS, selectedS) - fn := interface{}(correct.BTreeDeleteNode) + fn := interface{}(solutions.BTreeDeleteNode) CompareTrees_delete(fn, selected.Data, rootOr, root, rootS) } diff --git a/test-go/tests/btreeinsertdata_test/main.go b/test-go/tests/btreeinsertdata_test/main.go index 4f837a90..5f48aefd 100644 --- a/test-go/tests/btreeinsertdata_test/main.go +++ b/test-go/tests/btreeinsertdata_test/main.go @@ -4,7 +4,7 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func parentListInsert(root *student.TreeNode) string { @@ -79,18 +79,18 @@ func formatSubTree_insert(root *student.TreeNode, prefix string) string { return res } -func errorMessage_insert(fn interface{}, inserted string, root *correct.TreeNode, rootS *student.TreeNode) { +func errorMessage_insert(fn interface{}, inserted string, root *solutions.TreeNode, rootS *student.TreeNode) { lib.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", "BTreeInsertData", - correct.FormatTree(root), + solutions.FormatTree(root), inserted, FormatTree_insert(rootS), - correct.FormatTree(root), + solutions.FormatTree(root), ) } -func CompareTrees_insert(fn interface{}, inserted string, root *correct.TreeNode, rootS *student.TreeNode) { - solTree := correct.FormatTree(root) +func CompareTrees_insert(fn interface{}, inserted string, root *solutions.TreeNode, rootS *student.TreeNode) { + solTree := solutions.FormatTree(root) stuTree := FormatTree_insert(rootS) if solTree != stuTree { @@ -99,7 +99,7 @@ func CompareTrees_insert(fn interface{}, inserted string, root *correct.TreeNode } func main() { - root := &correct.TreeNode{Data: "08"} + root := &solutions.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} var pos []string @@ -117,9 +117,9 @@ func main() { "a", "d", ) - fn := interface{}(correct.BTreeInsertData) + fn := interface{}(solutions.BTreeInsertData) for _, arg := range pos { - root = correct.BTreeInsertData(root, arg) + root = solutions.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) CompareTrees_insert(fn, arg, root, rootS) } diff --git a/test-go/tests/btreeisbinary_test/main.go b/test-go/tests/btreeisbinary_test/main.go index 46bf7725..c960ac09 100644 --- a/test-go/tests/btreeisbinary_test/main.go +++ b/test-go/tests/btreeisbinary_test/main.go @@ -6,7 +6,7 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func BTreeMinStu(root *student.TreeNode) *student.TreeNode { @@ -16,16 +16,16 @@ func BTreeMinStu(root *student.TreeNode) *student.TreeNode { return BTreeMinStu(root.Left) } -func errorMessage_isbin(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { +func errorMessage_isbin(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { lib.Fatalf("%s(\n%s\n) == %s instead of %s\n", "BTreeIsBinary", - correct.FormatTree(root), + solutions.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_isbin(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { +func CompareNode_isbin(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { lib.Fatalf("Expected %v instead of %v\n", a, b) } @@ -55,7 +55,7 @@ func CompareNode_isbin(fn interface{}, arg1, a *correct.TreeNode, b *student.Tre } } -func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interface{}) { +func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 interface{}) { arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} @@ -64,13 +64,13 @@ func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte for i, v := range out1.Results { switch str := v.(type) { - case *correct.TreeNode: + case *solutions.TreeNode: CompareNode_isbin(fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeIsBinary", - correct.FormatTree(arg1), + solutions.FormatTree(arg1), lib.Format(out2.Results...), lib.Format(out1.Results...), ) @@ -80,31 +80,31 @@ func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte } func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - CompareReturn_isbin(correct.BTreeIsBinary, student.BTreeIsBinary, root, rootS) + CompareReturn_isbin(solutions.BTreeIsBinary, student.BTreeIsBinary, root, rootS) - rootNB := &correct.TreeNode{Data: "04"} + rootNB := &solutions.TreeNode{Data: "04"} rootNB_stu := &student.TreeNode{Data: "04"} // Test a non-binarysearch tree for _, v := range ins { - rootNB = correct.BTreeInsertData(rootNB, v) + rootNB = solutions.BTreeInsertData(rootNB, v) rootNB_stu = student.BTreeInsertData(rootNB_stu, v) } - min := correct.BTreeMin(rootNB) + min := solutions.BTreeMin(rootNB) minStu := BTreeMinStu(rootNB_stu) - min.Left = &correct.TreeNode{Data: "123"} + min.Left = &solutions.TreeNode{Data: "123"} minStu.Left = &student.TreeNode{Data: "123"} - CompareReturn_isbin(correct.BTreeIsBinary, student.BTreeIsBinary, rootNB, rootNB_stu) + CompareReturn_isbin(solutions.BTreeIsBinary, student.BTreeIsBinary, rootNB, rootNB_stu) } diff --git a/test-go/tests/btreelevelcount_test/main.go b/test-go/tests/btreelevelcount_test/main.go index 9439edcb..3c1e4831 100644 --- a/test-go/tests/btreelevelcount_test/main.go +++ b/test-go/tests/btreelevelcount_test/main.go @@ -6,19 +6,19 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) -func errorMessage_level(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { +func errorMessage_level(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { lib.Fatalf("%s(\n%s\n) == %s instead of %s\n", "BTreeLevelCount", - correct.FormatTree(root), + solutions.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_level(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { +func CompareNode_level(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { lib.Fatalf("Expected %v instead of %v\n", a, b) return @@ -56,7 +56,7 @@ func CompareNode_level(fn interface{}, arg1, a *correct.TreeNode, b *student.Tre } } -func CompareReturn_level(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interface{}) { +func CompareReturn_level(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 interface{}) { arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} @@ -65,13 +65,13 @@ func CompareReturn_level(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte for i, v := range out1.Results { switch str := v.(type) { - case *correct.TreeNode: + case *solutions.TreeNode: CompareNode_level(fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeLevelCount", - correct.FormatTree(arg1), + solutions.FormatTree(arg1), lib.Format(out2.Results...), lib.Format(out1.Results...), ) @@ -81,14 +81,14 @@ func CompareReturn_level(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte } func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) - CompareReturn_level(correct.BTreeLevelCount, student.BTreeLevelCount, root, rootS) + CompareReturn_level(solutions.BTreeLevelCount, student.BTreeLevelCount, root, rootS) } } diff --git a/test-go/tests/btreemax_test/main.go b/test-go/tests/btreemax_test/main.go index 6b6cfcc7..c23c83a4 100644 --- a/test-go/tests/btreemax_test/main.go +++ b/test-go/tests/btreemax_test/main.go @@ -6,19 +6,19 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) -func errorMessage_max(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { +func errorMessage_max(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeMax", - correct.FormatTree(root), + solutions.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_max(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { +func CompareNode_max(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { lib.Fatalf("Expected %v instead of %v\n", a, b) return @@ -56,7 +56,7 @@ func CompareNode_max(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeN } } -func CompareReturn_max(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interface{}) { +func CompareReturn_max(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 interface{}) { arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} @@ -65,13 +65,13 @@ func CompareReturn_max(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interf for i, v := range out1.Results { switch str := v.(type) { - case *correct.TreeNode: + case *solutions.TreeNode: CompareNode_max(fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { lib.Fatalf("%s(\n%s) == %s instead of\n %s\n", "BTreeMax", - correct.FormatTree(arg1), + solutions.FormatTree(arg1), lib.Format(out2.Results...), lib.Format(out1.Results...), ) @@ -81,15 +81,15 @@ func CompareReturn_max(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interf } func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - CompareReturn_max(correct.BTreeMax, student.BTreeMax, root, rootS) + CompareReturn_max(solutions.BTreeMax, student.BTreeMax, root, rootS) } diff --git a/test-go/tests/btreemin_test/main.go b/test-go/tests/btreemin_test/main.go index 48668587..73cc768b 100644 --- a/test-go/tests/btreemin_test/main.go +++ b/test-go/tests/btreemin_test/main.go @@ -6,19 +6,19 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) -func errorMessage_min(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { +func errorMessage_min(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeMin", - correct.FormatTree(root), + solutions.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_min(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { +func CompareNode_min(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { lib.Fatalf("Expected %v instead of %v\n", a, b) return @@ -65,8 +65,8 @@ func CompareReturn_min(fn1, fn2, arg1, arg2 interface{}) { for i, v := range out1.Results { switch str := v.(type) { - case *correct.TreeNode: - CompareNode_min(fn1, arg1.(*correct.TreeNode), str, out2.Results[i].(*student.TreeNode)) + case *solutions.TreeNode: + CompareNode_min(fn1, arg1.(*solutions.TreeNode), str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { lib.Fatalf("%s(%s) == %s instead of %s\n", @@ -81,15 +81,15 @@ func CompareReturn_min(fn1, fn2, arg1, arg2 interface{}) { } func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"03", "02", "01", "07", "05", "12", "10"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - CompareReturn_min(correct.BTreeMin, student.BTreeMin, root, rootS) + CompareReturn_min(solutions.BTreeMin, student.BTreeMin, root, rootS) } diff --git a/test-go/tests/btreesearchitem_test/main.go b/test-go/tests/btreesearchitem_test/main.go index f30cf3bb..bfed91d8 100644 --- a/test-go/tests/btreesearchitem_test/main.go +++ b/test-go/tests/btreesearchitem_test/main.go @@ -6,21 +6,21 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) -func errorMessage_search(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode, +func errorMessage_search(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode, seaVal string) { lib.Fatalf("%s(\n%s\n, %s) == %s instead of %s\n", "BTreeSearchItem", - correct.FormatTree(root), + solutions.FormatTree(root), seaVal, b.Data, a.Data, ) } -func CompareNode_search(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode, +func CompareNode_search(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode, seaVal string) { if a == nil && b == nil { return @@ -67,20 +67,20 @@ func CompareNode_search(fn interface{}, arg1, a *correct.TreeNode, b *student.Tr } func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - fn := interface{}(correct.BTreeSearchItem) + fn := interface{}(solutions.BTreeSearchItem) ins = append(ins, "322") for _, v := range ins { - selectedSol := correct.BTreeSearchItem(root, v) + selectedSol := solutions.BTreeSearchItem(root, v) selectedStu := student.BTreeSearchItem(rootS, v) CompareNode_search(fn, root, selectedSol, selectedStu, v) } diff --git a/test-go/tests/btreetransplant_test/main.go b/test-go/tests/btreetransplant_test/main.go index 69daded9..3b203047 100644 --- a/test-go/tests/btreetransplant_test/main.go +++ b/test-go/tests/btreetransplant_test/main.go @@ -6,7 +6,7 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) func parentListTransp(root *student.TreeNode) string { @@ -81,25 +81,25 @@ func formatSubTree_transp(root *student.TreeNode, prefix string) string { return res } -func errorMessage_transp(fn interface{}, root, sel, repl *correct.TreeNode, rootA *correct.TreeNode, rootAS *student.TreeNode) { +func errorMessage_transp(fn interface{}, root, sel, repl *solutions.TreeNode, rootA *solutions.TreeNode, rootAS *student.TreeNode) { lib.Fatalf("%s(\nRoot:\n %s, Selected:\n%s, Replacement:\n%s\n) ==\n%s instead of\n%s\n", "BTreeTransplant", - correct.FormatTree(root), - correct.FormatTree(sel), - correct.FormatTree(repl), + solutions.FormatTree(root), + solutions.FormatTree(sel), + solutions.FormatTree(repl), FormatTree_transp(rootAS), - correct.FormatTree(rootA), + solutions.FormatTree(rootA), ) } -func CompareTrees_transp(fn interface{}, root, sel, repl *correct.TreeNode, rootA *correct.TreeNode, rootAS *student.TreeNode) { - solTree := correct.FormatTree(rootA) +func CompareTrees_transp(fn interface{}, root, sel, repl *solutions.TreeNode, rootA *solutions.TreeNode, rootAS *student.TreeNode) { + solTree := solutions.FormatTree(rootA) stuTree := FormatTree_transp(rootAS) if solTree != stuTree { errorMessage_transp(fn, root, sel, repl, rootA, rootAS) } - parentSol := correct.ParentList(rootA) + parentSol := solutions.ParentList(rootA) parentStu := parentListTransp(rootAS) if parentSol != parentStu { @@ -109,11 +109,11 @@ func CompareTrees_transp(fn interface{}, root, sel, repl *correct.TreeNode, root } func main() { - root := &correct.TreeNode{Data: "04"} + root := &solutions.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} - rootOr := &correct.TreeNode{Data: "04"} + rootOr := &solutions.TreeNode{Data: "04"} - replacement := &correct.TreeNode{Data: "55"} + replacement := &solutions.TreeNode{Data: "55"} replacementS := &student.TreeNode{Data: "55"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} @@ -121,21 +121,21 @@ func main() { rep := []string{"33", "12", "15", "60"} for _, v := range ins { - root = correct.BTreeInsertData(root, v) + root = solutions.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) - rootOr = correct.BTreeInsertData(rootOr, v) + rootOr = solutions.BTreeInsertData(rootOr, v) } for _, v := range rep { - replacement = correct.BTreeInsertData(replacement, v) + replacement = solutions.BTreeInsertData(replacement, v) replacementS = student.BTreeInsertData(replacementS, v) } - selected := correct.BTreeSearchItem(root, "07") + selected := solutions.BTreeSearchItem(root, "07") selectedS := student.BTreeSearchItem(rootS, "07") - root = correct.BTreeTransplant(root, selected, replacement) + root = solutions.BTreeTransplant(root, selected, replacement) rootS = student.BTreeTransplant(rootS, selectedS, replacementS) - fn := interface{}(correct.BTreeTransplant) + fn := interface{}(solutions.BTreeTransplant) CompareTrees_transp(fn, rootOr, selected, replacement, root, rootS) } diff --git a/test-go/tests/listat_test/main.go b/test-go/tests/listat_test/main.go index 33a3c695..deffbc00 100644 --- a/test-go/tests/listat_test/main.go +++ b/test-go/tests/listat_test/main.go @@ -4,12 +4,12 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node5 = student.NodeL - NodeS5 = correct.NodeL + NodeS5 = solutions.NodeL ) func nodePushBackList5(l1 *Node5, l2 *NodeS5, data interface{}) (*Node5, *NodeS5) { @@ -44,15 +44,15 @@ func comparFuncNode5(solutionList *NodeS5, l1 *Node5, l2 *NodeS5, arg int) { } if l1 != nil && l2 == nil { lib.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", - correct.ListToString(solutionList), arg, l1, l2) + solutions.ListToString(solutionList), arg, l1, l2) } if l1.Data != l2.Data { lib.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", - correct.ListToString(solutionList), arg, l1.Data, l2.Data) + solutions.ListToString(solutionList), arg, l1.Data, l2.Data) } } -// finds an element of a correct.ListS using a given position +// finds an element of a solutions.ListS using a given position func main() { var link1 *Node5 var link2 *NodeS5 @@ -66,14 +66,14 @@ func main() { for i := 0; i < 4; i++ { table = append(table, nodeTest{ - data: correct.ConvertIntToInterface(lib.MultRandInt()), + data: solutions.ConvertIntToInterface(lib.MultRandInt()), pos: lib.RandIntBetween(1, 12), }) } for i := 0; i < 4; i++ { table = append(table, nodeTest{ - data: correct.ConvertIntToStringface(lib.MultRandWords()), + data: solutions.ConvertIntToStringface(lib.MultRandWords()), pos: lib.RandIntBetween(1, 12), }) } @@ -89,7 +89,7 @@ func main() { } result1 := student.ListAt(link1, arg.pos) - result2 := correct.ListAt(link2, arg.pos) + result2 := solutions.ListAt(link2, arg.pos) comparFuncNode5(link2, result1, result2, arg.pos) link1 = nil diff --git a/test-go/tests/listclear_test/main.go b/test-go/tests/listclear_test/main.go index b6e52810..e8211466 100644 --- a/test-go/tests/listclear_test/main.go +++ b/test-go/tests/listclear_test/main.go @@ -6,13 +6,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node4 = student.NodeL - List4 = correct.List - NodeS4 = correct.NodeL + List4 = solutions.List + NodeS4 = solutions.NodeL ListS4 = student.List ) @@ -55,17 +55,17 @@ func listPushBackTest4(l1 *ListS4, l2 *List4, data interface{}) { } } -// simply cleans the linked correct.ListS +// simply cleans the linked solutions.ListS func main() { link1 := &List4{} link2 := &ListS4{} - table := []correct.NodeTest{} + table := []solutions.NodeTest{} - table = correct.ElementsToTest(table) + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"I", 1, "something", 2}, }, ) @@ -74,12 +74,12 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest4(link2, link1, arg.Data[i]) } - correct.ListClear(link1) + solutions.ListClear(link1) student.ListClear(link2) if link2.Head != nil { lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListClear() == %v instead of %v\n\n", - listToStringStu5(link2), correct.ListToString(link1.Head), link2.Head, link1.Head) + listToStringStu5(link2), solutions.ListToString(link1.Head), link2.Head, link1.Head) } } } diff --git a/test-go/tests/listfind_test/main.go b/test-go/tests/listfind_test/main.go index 273f783c..dd0eb1c8 100644 --- a/test-go/tests/listfind_test/main.go +++ b/test-go/tests/listfind_test/main.go @@ -4,13 +4,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node9 = student.NodeL - List9 = correct.List - NodeS9 = correct.NodeL + List9 = solutions.List + NodeS9 = solutions.NodeL ListS9 = student.List ) @@ -41,10 +41,10 @@ func main() { link1 := &List9{} link2 := &ListS9{} - table := []correct.NodeTest{} - table = correct.ElementsToTest(table) + table := []solutions.NodeTest{} + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"hello", "hello1", "hello2", "hello3"}, }, ) @@ -55,7 +55,7 @@ func main() { } if len(arg.Data) != 0 { aux1 := student.ListFind(link2, arg.Data[(len(arg.Data)-1)/2], student.CompStr) - aux2 := correct.ListFind(link1, arg.Data[(len(arg.Data)-1)/2], correct.CompStr) + aux2 := solutions.ListFind(link1, arg.Data[(len(arg.Data)-1)/2], solutions.CompStr) if aux1 != nil || aux2 != nil { if *aux1 != *aux2 { @@ -72,7 +72,7 @@ func main() { } aux1 := student.ListFind(link2, "lksdf", student.CompStr) - aux2 := correct.ListFind(link1, "lksdf", correct.CompStr) + aux2 := solutions.ListFind(link1, "lksdf", solutions.CompStr) if aux1 != nil && aux2 != nil { if *aux1 != *aux2 { lib.Fatalf("ListFind(ref: lksdf) == %s instead of %s\n", *aux1, *aux2) diff --git a/test-go/tests/listforeach_test/main.go b/test-go/tests/listforeach_test/main.go index d91a24ab..7f81348d 100644 --- a/test-go/tests/listforeach_test/main.go +++ b/test-go/tests/listforeach_test/main.go @@ -6,13 +6,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node7 = student.NodeL - List7 = correct.List - NodeS7 = correct.NodeL + List7 = solutions.List + NodeS7 = solutions.NodeL ListS7 = student.List ) @@ -56,29 +56,29 @@ func listPushBackTest7(l1 *ListS7, l2 *List7, data interface{}) { } func comparFuncList7(l1 *List7, l2 *ListS7, f func(*Node7)) { - funcName := correct.GetName(f) + funcName := solutions.GetName(f) for l1.Head != nil || l2.Head != nil { if (l1.Head == nil && l2.Head != nil) || (l1.Head != nil && l2.Head == nil) { lib.Fatalf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", - listToStringStu8(l2), correct.ListToString(l1.Head), funcName, l2.Head, l1.Head) + listToStringStu8(l2), solutions.ListToString(l1.Head), funcName, l2.Head, l1.Head) } if l1.Head.Data != l2.Head.Data { lib.Fatalf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", - listToStringStu8(l2), correct.ListToString(l1.Head), funcName, l2.Head.Data, l1.Head.Data) + listToStringStu8(l2), solutions.ListToString(l1.Head), funcName, l2.Head.Data, l1.Head.Data) } l1.Head = l1.Head.Next l2.Head = l2.Head.Next } } -// applies a function to the correct.ListS +// applies a function to the solutions.ListS func main() { link1 := &List7{} link2 := &ListS7{} - table := []correct.NodeTest{} - table = correct.ElementsToTest(table) + table := []solutions.NodeTest{} + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"I", 1, "something", 2}, }, ) @@ -87,12 +87,12 @@ func main() { listPushBackTest7(link2, link1, arg.Data[i]) } student.ListForEach(link2, student.Add2_node) - correct.ListForEach(link1, correct.Add2_node) + solutions.ListForEach(link1, solutions.Add2_node) comparFuncList7(link1, link2, student.Add2_node) student.ListForEach(link2, student.Subtract3_node) - correct.ListForEach(link1, correct.Subtract3_node) + solutions.ListForEach(link1, solutions.Subtract3_node) comparFuncList7(link1, link2, student.Subtract3_node) diff --git a/test-go/tests/listforeachif_test/main.go b/test-go/tests/listforeachif_test/main.go index c7fcf5c9..2a7fd8ec 100644 --- a/test-go/tests/listforeachif_test/main.go +++ b/test-go/tests/listforeachif_test/main.go @@ -6,13 +6,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node8 = student.NodeL - List8 = correct.List - NodeS8 = correct.NodeL + List8 = solutions.List + NodeS8 = solutions.NodeL ListS8 = student.List ) @@ -84,50 +84,50 @@ func listPushBackTest8(l1 *ListS8, l2 *List8, data interface{}) { } func comparFuncList8(l1 *List8, l2 *ListS8, f func(*Node8) bool, comp func(*Node8)) { - funcFName := correct.GetName(f) - funcComp := correct.GetName(comp) + funcFName := solutions.GetName(f) + funcComp := solutions.GetName(comp) for l1.Head != nil || l2.Head != nil { if (l1.Head == nil && l2.Head != nil) || (l1.Head != nil && l2.Head == nil) { lib.Fatalf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", - listToStringStu7(l2), correct.ListToString(l1.Head), funcComp, funcFName, l2.Head, l1.Head) + listToStringStu7(l2), solutions.ListToString(l1.Head), funcComp, funcFName, l2.Head, l1.Head) } if l1.Head.Data != l2.Head.Data { lib.Fatalf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", - listToStringStu7(l2), correct.ListToString(l1.Head), funcComp, funcFName, l2.Head.Data, l1.Head.Data) + listToStringStu7(l2), solutions.ListToString(l1.Head), funcComp, funcFName, l2.Head.Data, l1.Head.Data) } l1.Head = l1.Head.Next l2.Head = l2.Head.Next } } -// applies a function to an element of the linked correct.ListS +// applies a function to an element of the linked solutions.ListS func main() { link1 := &ListS8{} link2 := &List8{} - table := []correct.NodeTest{} + table := []solutions.NodeTest{} table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{}, }, ) // just numbers/ints for i := 0; i < 3; i++ { - val := correct.NodeTest{ - Data: correct.ConvertIntToInterface(lib.MultRandInt()), + val := solutions.NodeTest{ + Data: solutions.ConvertIntToInterface(lib.MultRandInt()), } table = append(table, val) } // just strings for i := 0; i < 3; i++ { - val := correct.NodeTest{ - Data: correct.ConvertIntToStringface(lib.MultRandWords()), + val := solutions.NodeTest{ + Data: solutions.ConvertIntToStringface(lib.MultRandWords()), } table = append(table, val) } table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"I", 1, "something", 2}, }, ) @@ -135,11 +135,11 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest8(link1, link2, arg.Data[i]) } - correct.ListForEachIf(link2, addOneS, correct.IsPositive_node) + solutions.ListForEachIf(link2, addOneS, solutions.IsPositive_node) student.ListForEachIf(link1, addOne, student.IsPositive_node) comparFuncList8(link2, link1, student.IsPositive_node, addOne) - correct.ListForEachIf(link2, subtract1_sol, correct.IsPositive_node) + solutions.ListForEachIf(link2, subtract1_sol, solutions.IsPositive_node) student.ListForEachIf(link1, subtractOne, student.IsPositive_node) comparFuncList8(link2, link1, student.IsPositive_node, subtractOne) diff --git a/test-go/tests/listlast_test/main.go b/test-go/tests/listlast_test/main.go index 0fafb268..268d2ab5 100644 --- a/test-go/tests/listlast_test/main.go +++ b/test-go/tests/listlast_test/main.go @@ -6,13 +6,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node3 = student.NodeL - List3 = correct.List - NodeS3 = correct.NodeL + List3 = solutions.List + NodeS3 = solutions.NodeL ListS3 = student.List ) @@ -52,15 +52,15 @@ func listPushBackTest3(l *ListS3, l1 *List3, data interface{}) { } } -// last element of the correct.ListS +// last element of the solutions.ListS func main() { link1 := &List3{} link2 := &ListS3{} - table := []correct.NodeTest{} + table := []solutions.NodeTest{} - table = correct.ElementsToTest(table) + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{3, 2, 1}, }, ) @@ -68,7 +68,7 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest3(link2, link1, arg.Data[i]) } - aux1 := correct.ListLast(link1) + aux1 := solutions.ListLast(link1) aux2 := student.ListLast(link2) if aux1 != aux2 { diff --git a/test-go/tests/listmerge_test/main.go b/test-go/tests/listmerge_test/main.go index de24e3f6..f6360ac6 100644 --- a/test-go/tests/listmerge_test/main.go +++ b/test-go/tests/listmerge_test/main.go @@ -6,13 +6,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node11 = student.NodeL - List11 = correct.List - NodeS11 = correct.NodeL + List11 = solutions.List + NodeS11 = solutions.NodeL ListS11 = student.List ) @@ -63,11 +63,11 @@ func comparFuncList11(l1 *List11, l2 *ListS11) { for l1.Head != nil || l2.Head != nil { if (l1.Head == nil && l2.Head != nil) || (l1.Head != nil && l2.Head == nil) { lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", - listToStringStu(l2), correct.ListToString(l1.Head), l2.Head, l1.Head) + listToStringStu(l2), solutions.ListToString(l1.Head), l2.Head, l1.Head) } if l1.Head.Data != l2.Head.Data { lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", - listToStringStu(l2), correct.ListToString(l1.Head), l2.Head.Data, l1.Head.Data) + listToStringStu(l2), solutions.ListToString(l1.Head), l2.Head.Data, l1.Head.Data) } l1.Head = l1.Head.Next l2.Head = l2.Head.Next @@ -93,22 +93,22 @@ func main() { }) table = append(table, nodeTest{ - data1: correct.ConvertIntToInterface(lib.MultRandInt()), + data1: solutions.ConvertIntToInterface(lib.MultRandInt()), data2: []interface{}{}, }) // jut ints for i := 0; i < 3; i++ { val := nodeTest{ - data1: correct.ConvertIntToInterface(lib.MultRandInt()), - data2: correct.ConvertIntToInterface(lib.MultRandInt()), + data1: solutions.ConvertIntToInterface(lib.MultRandInt()), + data2: solutions.ConvertIntToInterface(lib.MultRandInt()), } table = append(table, val) } // just strings for i := 0; i < 2; i++ { val := nodeTest{ - data1: correct.ConvertIntToStringface(lib.MultRandWords()), - data2: correct.ConvertIntToStringface(lib.MultRandWords()), + data1: solutions.ConvertIntToStringface(lib.MultRandWords()), + data2: solutions.ConvertIntToStringface(lib.MultRandWords()), } table = append(table, val) } @@ -126,7 +126,7 @@ func main() { listPushBackTest11(link2Test, linkTest, arg.data2[i]) } - correct.ListMerge(link1, linkTest) + solutions.ListMerge(link1, linkTest) student.ListMerge(link2, link2Test) comparFuncList11(link1, link2) diff --git a/test-go/tests/listpushback_test/main.go b/test-go/tests/listpushback_test/main.go index 53d9bac0..511c6f67 100644 --- a/test-go/tests/listpushback_test/main.go +++ b/test-go/tests/listpushback_test/main.go @@ -6,11 +6,11 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( - ListS = correct.List + ListS = solutions.List List = student.List ) @@ -35,11 +35,11 @@ func comparFuncList(l *ListS, l1 *List, data []interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { lib.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", - data, listToStringStu10(l1), correct.ListToString(l.Head), l1.Head, l.Head) + data, listToStringStu10(l1), solutions.ListToString(l.Head), l1.Head, l.Head) } if l.Head.Data != l1.Head.Data { lib.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", - data, listToStringStu10(l1), correct.ListToString(l.Head), l1.Head.Data, l.Head.Data) + data, listToStringStu10(l1), solutions.ListToString(l.Head), l1.Head.Data, l.Head.Data) } l.Head = l.Head.Next l1.Head = l1.Head.Next @@ -50,17 +50,17 @@ func main() { link1 := &ListS{} link2 := &List{} - table := []correct.NodeTest{} - table = correct.ElementsToTest(table) + table := []solutions.NodeTest{} + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"Hello", "man", "how are you"}, }, ) for _, arg := range table { for _, item := range arg.Data { student.ListPushBack(link2, item) - correct.ListPushBack(link1, item) + solutions.ListPushBack(link1, item) } comparFuncList(link1, link2, arg.Data) } diff --git a/test-go/tests/listpushfront_test/main.go b/test-go/tests/listpushfront_test/main.go index 3ea7d500..c313ae51 100644 --- a/test-go/tests/listpushfront_test/main.go +++ b/test-go/tests/listpushfront_test/main.go @@ -6,11 +6,11 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( - ListSa = correct.List + ListSa = solutions.List Lista = student.List ) @@ -35,11 +35,11 @@ func comparFuncList1(l *Lista, l1 *ListSa, data []interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { lib.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", - data, listToStringStu11(l), correct.ListToString(l1.Head), l.Head, l1.Head) + data, listToStringStu11(l), solutions.ListToString(l1.Head), l.Head, l1.Head) } if l.Head.Data != l1.Head.Data { lib.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", - data, listToStringStu11(l), correct.ListToString(l1.Head), l.Head, l1.Head) + data, listToStringStu11(l), solutions.ListToString(l1.Head), l.Head, l1.Head) } l1.Head = l1.Head.Next l.Head = l.Head.Next @@ -50,17 +50,17 @@ func comparFuncList1(l *Lista, l1 *ListSa, data []interface{}) { func main() { link1 := &Lista{} link2 := &ListSa{} - table := []correct.NodeTest{} - table = correct.ElementsToTest(table) + table := []solutions.NodeTest{} + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"Hello", "man", "how are you"}, }, ) for _, arg := range table { for _, item := range arg.Data { student.ListPushFront(link1, item) - correct.ListPushFront(link2, item) + solutions.ListPushFront(link2, item) } comparFuncList1(link1, link2, arg.Data) link1 = &Lista{} diff --git a/test-go/tests/listremoveif_test/main.go b/test-go/tests/listremoveif_test/main.go index 84a96ead..3ead1dd5 100644 --- a/test-go/tests/listremoveif_test/main.go +++ b/test-go/tests/listremoveif_test/main.go @@ -6,13 +6,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node10 = student.NodeL - List10 = correct.List - NodeS10 = correct.NodeL + List10 = solutions.List + NodeS10 = solutions.NodeL ListS10 = student.List ) @@ -59,11 +59,11 @@ func comparFuncList10(l *List10, l1 *ListS10, data interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { lib.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", - data, listToStringStu12(l1), correct.ListToString(l.Head), l1.Head, l.Head) + data, listToStringStu12(l1), solutions.ListToString(l.Head), l1.Head, l.Head) } if l.Head.Data != l1.Head.Data { lib.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", - data, listToStringStu12(l1), correct.ListToString(l.Head), l1.Head.Data, l.Head.Data) + data, listToStringStu12(l1), solutions.ListToString(l.Head), l1.Head.Data, l.Head.Data) } l.Head = l.Head.Next l1.Head = l1.Head.Next @@ -75,12 +75,12 @@ func main() { link1 := &List10{} link2 := &ListS10{} var index int - table := []correct.NodeTest{} + table := []solutions.NodeTest{} - table = correct.ElementsToTest(table) + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"hello", "hello1", "hello2", "hello3"}, }, ) @@ -95,11 +95,11 @@ func main() { if link1.Head != nil && link2.Head != nil { cho := arg.Data[index] student.ListRemoveIf(link2, cho) - correct.ListRemoveIf(link1, cho) + solutions.ListRemoveIf(link1, cho) comparFuncList10(link1, link2, cho) } else { student.ListRemoveIf(link2, 1) - correct.ListRemoveIf(link1, 1) + solutions.ListRemoveIf(link1, 1) comparFuncList10(link1, link2, 1) } diff --git a/test-go/tests/listreverse_test/main.go b/test-go/tests/listreverse_test/main.go index 6cb4c4cf..72e7a6da 100644 --- a/test-go/tests/listreverse_test/main.go +++ b/test-go/tests/listreverse_test/main.go @@ -6,13 +6,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node6 = student.NodeL - List6 = correct.List - NodeS6 = correct.NodeL + List6 = solutions.List + NodeS6 = solutions.NodeL ListS6 = student.List ) @@ -36,11 +36,11 @@ func comparFuncList6(l *List6, l1 *ListS6) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", - listToStringStu13(l1), correct.ListToString(l.Head), l1.Head, l.Head) + listToStringStu13(l1), solutions.ListToString(l.Head), l1.Head, l.Head) } if l.Head.Data != l1.Head.Data { lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", - listToStringStu13(l1), correct.ListToString(l.Head), l1.Head.Data, l.Head.Data) + listToStringStu13(l1), solutions.ListToString(l.Head), l1.Head.Data, l.Head.Data) } l.Head = l.Head.Next l1.Head = l1.Head.Next @@ -73,16 +73,16 @@ func listPushBackTest6(l *ListS6, l1 *List6, data interface{}) { func main() { link1 := &List6{} link2 := &ListS6{} - table := []correct.NodeTest{{ + table := []solutions.NodeTest{{ Data: []interface{}{"I", 1, "something", 2}, }} - table = correct.ElementsToTest(table) + table = solutions.ElementsToTest(table) for _, arg := range table { for _, item := range arg.Data { listPushBackTest6(link2, link1, item) } student.ListReverse(link2) - correct.ListReverse(link1) + solutions.ListReverse(link1) comparFuncList6(link1, link2) link1 = &List6{} link2 = &ListS6{} diff --git a/test-go/tests/listsize_test/main.go b/test-go/tests/listsize_test/main.go index 48f36af1..0bf85514 100644 --- a/test-go/tests/listsize_test/main.go +++ b/test-go/tests/listsize_test/main.go @@ -4,13 +4,13 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( Node2 = student.NodeL - List2 = correct.List - NodeS2 = correct.NodeL + List2 = solutions.List + NodeS2 = solutions.NodeL ListS2 = student.List ) @@ -41,10 +41,10 @@ func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { func main() { link := &List2{} link2 := &ListS2{} - table := []correct.NodeTest{} - table = correct.ElementsToTest(table) + table := []solutions.NodeTest{} + table = solutions.ElementsToTest(table) table = append(table, - correct.NodeTest{ + solutions.NodeTest{ Data: []interface{}{"Hello", "man", "how are you"}, }, ) @@ -52,10 +52,10 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest2(link2, link, arg.Data[i]) } - aux := correct.ListSize(link) + aux := solutions.ListSize(link) aux2 := student.ListSize(link2) if aux != aux2 { - lib.Fatalf("ListSize(%v) == %d instead of %d\n", correct.ListToString(link.Head), aux2, aux) + lib.Fatalf("ListSize(%v) == %d instead of %d\n", solutions.ListToString(link.Head), aux2, aux) } link = &List2{} link2 = &ListS2{} diff --git a/test-go/tests/listsort_test/main.go b/test-go/tests/listsort_test/main.go index 636562b3..0e477245 100644 --- a/test-go/tests/listsort_test/main.go +++ b/test-go/tests/listsort_test/main.go @@ -6,12 +6,12 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( NodeI12 = student.NodeI - NodeIS12 = correct.NodeI + NodeIS12 = solutions.NodeI ) func printListStudent(n *NodeI12) string { @@ -54,11 +54,11 @@ func comparFuncNodeInt12(l1 *NodeI12, l2 *NodeIS12) { for l1 != nil || l2 != nil { if (l1 == nil && l2 != nil) || (l1 != nil && l2 == nil) { lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", - printListStudent(l1), correct.PrintList(l2), l1, l2) + printListStudent(l1), solutions.PrintList(l2), l1, l2) } if l1.Data != l2.Data { lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", - printListStudent(l1), correct.PrintList(l2), l1.Data, l2.Data) + printListStudent(l1), solutions.PrintList(l2), l1.Data, l2.Data) } l1 = l1.Next l2 = l2.Next @@ -85,7 +85,7 @@ func main() { for i := 0; i < len(arg.data); i++ { nodePushBackListInt12(link1, link2, arg.data[i]) } - aux1 := correct.ListSort(link2) + aux1 := solutions.ListSort(link2) aux2 := student.ListSort(link1) comparFuncNodeInt12(aux2, aux1) diff --git a/test-go/tests/sortedlistmerge_test/main.go b/test-go/tests/sortedlistmerge_test/main.go index 1d8e975b..a8603711 100644 --- a/test-go/tests/sortedlistmerge_test/main.go +++ b/test-go/tests/sortedlistmerge_test/main.go @@ -6,12 +6,12 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( NodeI13 = student.NodeI - NodeIS13 = correct.NodeI + NodeIS13 = solutions.NodeI ) func printListStudent1(n *NodeI13) string { @@ -88,19 +88,19 @@ func main() { link1 = student.ListSort(link1) link2 = student.ListSort(link2) - linkTest1 = correct.ListSort(linkTest1) - linkTest2 = correct.ListSort(linkTest2) + linkTest1 = solutions.ListSort(linkTest1) + linkTest2 = solutions.ListSort(linkTest2) aux1 := student.SortedListMerge(link1, link2) - aux2 := correct.SortedListMerge(linkTest1, linkTest2) + aux2 := solutions.SortedListMerge(linkTest1, linkTest2) if aux1 == nil && aux2 == nil { } else if aux1 != nil && aux2 == nil { lib.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", - printListStudent1(aux1), correct.PrintList(aux2), aux1, aux2) + printListStudent1(aux1), solutions.PrintList(aux2), aux1, aux2) } else if aux1.Data != aux2.Data { lib.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", - printListStudent1(aux1), correct.PrintList(aux2), aux1, aux2) + printListStudent1(aux1), solutions.PrintList(aux2), aux1, aux2) } link1 = &NodeI13{} diff --git a/test-go/tests/sortlistinsert_test/main.go b/test-go/tests/sortlistinsert_test/main.go index 7b08a07e..a6eb4182 100644 --- a/test-go/tests/sortlistinsert_test/main.go +++ b/test-go/tests/sortlistinsert_test/main.go @@ -6,12 +6,12 @@ import ( student "student" "github.com/01-edu/public/test-go/lib" - "github.com/01-edu/public/test-go/tests/correct" + "github.com/01-edu/public/test-go/solutions" ) type ( NodeI14 = student.NodeI - NodeIS14 = correct.NodeI + NodeIS14 = solutions.NodeI ) func listToStringStu3(n *NodeI14) string { @@ -57,11 +57,11 @@ func comparFuncNodeInt14(l1 *NodeI14, l2 *NodeIS14, data []int) { for l1 != nil || l2 != nil { if (l1 == nil && l2 != nil) || (l1 != nil && l2 == nil) { lib.Fatalf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", - data, listToStringStu3(l1), correct.PrintList(l2), l1, l2) + data, listToStringStu3(l1), solutions.PrintList(l2), l1, l2) } if l1.Data != l2.Data { lib.Fatalf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", - data, listToStringStu3(l1), correct.PrintList(l2), l1.Data, l2.Data) + data, listToStringStu3(l1), solutions.PrintList(l2), l1.Data, l2.Data) } l1 = l1.Next l2 = l2.Next @@ -126,11 +126,11 @@ func main() { link1 = nodepushback1(link1, item) } - link2 = correct.ListSort(link2) + link2 = solutions.ListSort(link2) link1 = sortStudentsList(link1) for _, item := range arg.data_ref { - link2 = correct.SortListInsert(link2, item) + link2 = solutions.SortListInsert(link2, item) link1 = student.SortListInsert(link1, item) }