From 1d747c504aa63306f1fadcfb8c506b028f0b4240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=81=A3?= <⁣> Date: Sat, 20 Jun 2020 16:09:25 +0200 Subject: [PATCH] Fix list & tree exercises --- go/tests/func/btreeapplybylevel_test/main.go | 2 +- go/tests/func/btreeapplyinorder_test/main.go | 2 +- .../func/btreeapplypostorder_test/main.go | 2 +- go/tests/func/btreeapplypreorder_test/main.go | 2 +- go/tests/func/btreedeletenode_test/main.go | 5 ++-- go/tests/func/btreeinsertdata_test/main.go | 5 ++-- go/tests/func/btreeisbinary_test/main.go | 5 ++-- go/tests/func/btreelevelcount_test/main.go | 5 ++-- go/tests/func/btreemax_test/main.go | 5 ++-- go/tests/func/btreemin_test/main.go | 5 ++-- go/tests/func/btreesearchitem_test/main.go | 5 ++-- go/tests/func/btreetransplant_test/main.go | 5 ++-- go/tests/func/correct/challenge.go | 24 +++++++++---------- go/tests/func/listat_test/main.go | 5 ++-- go/tests/func/listclear_test/main.go | 5 ++-- go/tests/func/listfind_test/main.go | 5 ++-- go/tests/func/listforeach_test/main.go | 5 ++-- go/tests/func/listforeachif_test/main.go | 5 ++-- go/tests/func/listlast_test/main.go | 5 ++-- go/tests/func/listmerge_test/main.go | 5 ++-- go/tests/func/listpushback_test/main.go | 5 ++-- go/tests/func/listpushfront_test/main.go | 5 ++-- go/tests/func/listremoveif_test/main.go | 5 ++-- go/tests/func/listreverse_test/main.go | 5 ++-- go/tests/func/listsize_test/main.go | 5 ++-- go/tests/func/listsort_test/main.go | 5 ++-- go/tests/func/sortedlistmerge_test/main.go | 5 ++-- go/tests/func/sortlistinsert_test/main.go | 5 ++-- 28 files changed, 85 insertions(+), 62 deletions(-) diff --git a/go/tests/func/btreeapplybylevel_test/main.go b/go/tests/func/btreeapplybylevel_test/main.go index e844fa898..98d826b39 100644 --- a/go/tests/func/btreeapplybylevel_test/main.go +++ b/go/tests/func/btreeapplybylevel_test/main.go @@ -5,7 +5,7 @@ import ( student "student" - "./correct" + "func/correct" ) func main() { diff --git a/go/tests/func/btreeapplyinorder_test/main.go b/go/tests/func/btreeapplyinorder_test/main.go index a52f18456..1b9e5430a 100644 --- a/go/tests/func/btreeapplyinorder_test/main.go +++ b/go/tests/func/btreeapplyinorder_test/main.go @@ -5,7 +5,7 @@ import ( student "student" - "./correct" + "func/correct" ) func main() { diff --git a/go/tests/func/btreeapplypostorder_test/main.go b/go/tests/func/btreeapplypostorder_test/main.go index 07c9d1e29..e1438ab66 100644 --- a/go/tests/func/btreeapplypostorder_test/main.go +++ b/go/tests/func/btreeapplypostorder_test/main.go @@ -5,7 +5,7 @@ import ( student "student" - "./correct" + "func/correct" ) func main() { diff --git a/go/tests/func/btreeapplypreorder_test/main.go b/go/tests/func/btreeapplypreorder_test/main.go index 606bcb5e4..a318e53bb 100644 --- a/go/tests/func/btreeapplypreorder_test/main.go +++ b/go/tests/func/btreeapplypreorder_test/main.go @@ -5,7 +5,7 @@ import ( student "student" - "./correct" + "func/correct" ) func main() { diff --git a/go/tests/func/btreedeletenode_test/main.go b/go/tests/func/btreedeletenode_test/main.go index 52f15e476..a1241fb39 100644 --- a/go/tests/func/btreedeletenode_test/main.go +++ b/go/tests/func/btreedeletenode_test/main.go @@ -3,8 +3,9 @@ package main import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func parentListDelete(root *student.TreeNode) string { diff --git a/go/tests/func/btreeinsertdata_test/main.go b/go/tests/func/btreeinsertdata_test/main.go index d9f5f4508..90b57f0a9 100644 --- a/go/tests/func/btreeinsertdata_test/main.go +++ b/go/tests/func/btreeinsertdata_test/main.go @@ -3,8 +3,9 @@ package main import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func parentListInsert(root *student.TreeNode) string { diff --git a/go/tests/func/btreeisbinary_test/main.go b/go/tests/func/btreeisbinary_test/main.go index cf959d01f..4241ce69e 100644 --- a/go/tests/func/btreeisbinary_test/main.go +++ b/go/tests/func/btreeisbinary_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func BTreeMinStu(root *student.TreeNode) *student.TreeNode { diff --git a/go/tests/func/btreelevelcount_test/main.go b/go/tests/func/btreelevelcount_test/main.go index 4a29760ee..3b7c839fc 100644 --- a/go/tests/func/btreelevelcount_test/main.go +++ b/go/tests/func/btreelevelcount_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func errorMessage_level(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { diff --git a/go/tests/func/btreemax_test/main.go b/go/tests/func/btreemax_test/main.go index 7143d4798..e39290eee 100644 --- a/go/tests/func/btreemax_test/main.go +++ b/go/tests/func/btreemax_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func errorMessage_max(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { diff --git a/go/tests/func/btreemin_test/main.go b/go/tests/func/btreemin_test/main.go index 5892747b9..9ff7c0d3a 100644 --- a/go/tests/func/btreemin_test/main.go +++ b/go/tests/func/btreemin_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func errorMessage_min(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { diff --git a/go/tests/func/btreesearchitem_test/main.go b/go/tests/func/btreesearchitem_test/main.go index 3f0b0c530..aad8ae02b 100644 --- a/go/tests/func/btreesearchitem_test/main.go +++ b/go/tests/func/btreesearchitem_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func errorMessage_search(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode, diff --git a/go/tests/func/btreetransplant_test/main.go b/go/tests/func/btreetransplant_test/main.go index e590ab257..474d2e210 100644 --- a/go/tests/func/btreetransplant_test/main.go +++ b/go/tests/func/btreetransplant_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) func parentListTransp(root *student.TreeNode) string { diff --git a/go/tests/func/correct/challenge.go b/go/tests/func/correct/challenge.go index f1d6594d1..a74003c79 100644 --- a/go/tests/func/correct/challenge.go +++ b/go/tests/func/correct/challenge.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/01-edu/z01" + "lib" ) func FormatTree(root *TreeNode) string { @@ -96,15 +96,15 @@ func ChallengeTree( args2 = append(args2, v) } } - st1 := z01.Monitor(fn1, args1) - st2 := z01.Monitor(fn2, args2) + st1 := lib.Monitor(fn1, args1) + st2 := lib.Monitor(fn2, args2) if st1.Stdout != st2.Stdout { - z01.Fatalf("%s(\n%s)\n prints %s instead of %s\n", + lib.Fatalf("%s(\n%s)\n prints %s instead of %s\n", name, FormatTree(arg1), - z01.Format(st2.Stdout), - z01.Format(st1.Stdout), + lib.Format(st2.Stdout), + lib.Format(st1.Stdout), ) } } @@ -137,10 +137,10 @@ func ListToString(n *NodeL) string { } func ConvertIntToInterface(t []int) []interface{} { - RandLen := z01.RandIntBetween(0, len(t)) + RandLen := lib.RandIntBetween(0, len(t)) s := make([]interface{}, RandLen) for j := 0; j < RandLen; j++ { - for i := 0; i < z01.RandIntBetween(1, len(t)); i++ { + for i := 0; i < lib.RandIntBetween(1, len(t)); i++ { s[j] = t[i] } } @@ -148,10 +148,10 @@ func ConvertIntToInterface(t []int) []interface{} { } func ConvertIntToStringface(t []string) []interface{} { - RandLen := z01.RandIntBetween(0, len(t)) + RandLen := lib.RandIntBetween(0, len(t)) s := make([]interface{}, RandLen) for j := 0; j < RandLen; j++ { - for i := 0; i < z01.RandIntBetween(1, len(t)); i++ { + for i := 0; i < lib.RandIntBetween(1, len(t)); i++ { s[j] = t[i] } } @@ -170,13 +170,13 @@ func ElementsToTest(table []NodeTest) []NodeTest { ) for i := 0; i < 3; i++ { val := NodeTest{ - Data: ConvertIntToInterface(z01.MultRandInt()), + Data: ConvertIntToInterface(lib.MultRandInt()), } table = append(table, val) } for i := 0; i < 3; i++ { val := NodeTest{ - Data: ConvertIntToStringface(z01.MultRandWords()), + Data: ConvertIntToStringface(lib.MultRandWords()), } table = append(table, val) } diff --git a/go/tests/func/listat_test/main.go b/go/tests/func/listat_test/main.go index 613cc29cd..5cbb40741 100644 --- a/go/tests/func/listat_test/main.go +++ b/go/tests/func/listat_test/main.go @@ -3,8 +3,9 @@ package main import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node5 = student.NodeL diff --git a/go/tests/func/listclear_test/main.go b/go/tests/func/listclear_test/main.go index 427b88036..bfe3b374d 100644 --- a/go/tests/func/listclear_test/main.go +++ b/go/tests/func/listclear_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node4 = student.NodeL diff --git a/go/tests/func/listfind_test/main.go b/go/tests/func/listfind_test/main.go index 72b6281e3..b51816431 100644 --- a/go/tests/func/listfind_test/main.go +++ b/go/tests/func/listfind_test/main.go @@ -3,8 +3,9 @@ package main import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node9 = student.NodeL diff --git a/go/tests/func/listforeach_test/main.go b/go/tests/func/listforeach_test/main.go index 1cb6f7011..2f8e07315 100644 --- a/go/tests/func/listforeach_test/main.go +++ b/go/tests/func/listforeach_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node7 = student.NodeL diff --git a/go/tests/func/listforeachif_test/main.go b/go/tests/func/listforeachif_test/main.go index 449c7f072..4e38640cf 100644 --- a/go/tests/func/listforeachif_test/main.go +++ b/go/tests/func/listforeachif_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node8 = student.NodeL diff --git a/go/tests/func/listlast_test/main.go b/go/tests/func/listlast_test/main.go index 4b0962055..4551e4454 100644 --- a/go/tests/func/listlast_test/main.go +++ b/go/tests/func/listlast_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node3 = student.NodeL diff --git a/go/tests/func/listmerge_test/main.go b/go/tests/func/listmerge_test/main.go index 72996a641..82c31ab64 100644 --- a/go/tests/func/listmerge_test/main.go +++ b/go/tests/func/listmerge_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node11 = student.NodeL diff --git a/go/tests/func/listpushback_test/main.go b/go/tests/func/listpushback_test/main.go index fd62dcce3..943756641 100644 --- a/go/tests/func/listpushback_test/main.go +++ b/go/tests/func/listpushback_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type ListS = correct.List diff --git a/go/tests/func/listpushfront_test/main.go b/go/tests/func/listpushfront_test/main.go index bc03af45e..75238106c 100644 --- a/go/tests/func/listpushfront_test/main.go +++ b/go/tests/func/listpushfront_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type ListSa = correct.List diff --git a/go/tests/func/listremoveif_test/main.go b/go/tests/func/listremoveif_test/main.go index f100c34db..8f302c0ae 100644 --- a/go/tests/func/listremoveif_test/main.go +++ b/go/tests/func/listremoveif_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node10 = student.NodeL diff --git a/go/tests/func/listreverse_test/main.go b/go/tests/func/listreverse_test/main.go index da9f09a1c..08b1b9e12 100644 --- a/go/tests/func/listreverse_test/main.go +++ b/go/tests/func/listreverse_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node6 = student.NodeL diff --git a/go/tests/func/listsize_test/main.go b/go/tests/func/listsize_test/main.go index 73daf4f5b..aef5fdc9d 100644 --- a/go/tests/func/listsize_test/main.go +++ b/go/tests/func/listsize_test/main.go @@ -3,8 +3,9 @@ package main import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type Node2 = student.NodeL diff --git a/go/tests/func/listsort_test/main.go b/go/tests/func/listsort_test/main.go index 48a37badc..5a99b267f 100644 --- a/go/tests/func/listsort_test/main.go +++ b/go/tests/func/listsort_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type NodeI12 = student.NodeI diff --git a/go/tests/func/sortedlistmerge_test/main.go b/go/tests/func/sortedlistmerge_test/main.go index 620cc7fea..13adfa1d5 100644 --- a/go/tests/func/sortedlistmerge_test/main.go +++ b/go/tests/func/sortedlistmerge_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type NodeI13 = student.NodeI diff --git a/go/tests/func/sortlistinsert_test/main.go b/go/tests/func/sortlistinsert_test/main.go index 9f10e92a6..72302767d 100644 --- a/go/tests/func/sortlistinsert_test/main.go +++ b/go/tests/func/sortlistinsert_test/main.go @@ -5,8 +5,9 @@ import ( student "student" - "./correct" - "github.com/01-edu/public/go/lib" + "func/correct" + + "lib" ) type NodeI14 = student.NodeI