diff --git a/tests/go/func/test_abort.go b/tests/go/func/test_abort.go index 3a11c48c..0cac3199 100644 --- a/tests/go/func/test_abort.go +++ b/tests/go/func/test_abort.go @@ -1,18 +1,17 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - arg := z01.MultRandInt() - arg = append(arg, z01.RandInt()) + arg := lib.MultRandInt() + arg = append(arg, lib.RandInt()) for i := 0; i < 15; i++ { - z01.Challenge("Abort", student.Abort, correct.Abort, arg[0], arg[1], arg[2], arg[3], arg[4]) - arg = z01.MultRandInt() - arg = append(arg, z01.RandInt()) + lib.Challenge("Abort", student.Abort, correct.Abort, arg[0], arg[1], arg[2], arg[3], arg[4]) + arg = lib.MultRandInt() + arg = append(arg, lib.RandInt()) } } diff --git a/tests/go/func/test_activebits.go b/tests/go/func/test_activebits.go index 6bd08268..c057f3b8 100644 --- a/tests/go/func/test_activebits.go +++ b/tests/go/func/test_activebits.go @@ -1,18 +1,17 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - args := []int{z01.RandIntBetween(2, 20)} - args = append(args, z01.MultRandIntBetween(2, 20)...) - args = append(args, z01.MultRandIntBetween(2, 20)...) + args := []int{lib.RandIntBetween(2, 20)} + args = append(args, lib.MultRandIntBetween(2, 20)...) + args = append(args, lib.MultRandIntBetween(2, 20)...) for _, v := range args { - z01.Challenge("ActiveBits", student.ActiveBits, correct.ActiveBits, v) + lib.Challenge("ActiveBits", student.ActiveBits, correct.ActiveBits, v) } } diff --git a/tests/go/func/test_addlinkednumbers.go b/tests/go/func/test_addlinkednumbers.go index e5387e18..607ebb8a 100644 --- a/tests/go/func/test_addlinkednumbers.go +++ b/tests/go/func/test_addlinkednumbers.go @@ -3,9 +3,8 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) type stuNode = NodeAddL @@ -87,18 +86,18 @@ func compareNodes(stuResult *stuNode, solResult *solNode, num1, num2 int) { } if stuResult != nil && solResult == nil { stuNum := stuNodeString(stuResult) - z01.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", + lib.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", num1, num2, stuNum, "") } if stuResult == nil && solResult != nil { solNum := solNodeString(solResult) - z01.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", + lib.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", num1, num2, "", solNum) } stuNum := stuNodeString(stuResult) solNum := solNodeString(solResult) if stuNum != solNum { - z01.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", + lib.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", num1, num2, stuNum, solNum) } } @@ -107,7 +106,7 @@ func main() { args := [][2]int{{315, 592}} for i := 0; i < 15; i++ { - args = append(args, [2]int{z01.RandPosZ(), z01.RandPosZ()}) + args = append(args, [2]int{lib.RandPosZ(), lib.RandPosZ()}) } for _, arg := range args { diff --git a/tests/go/func/test_advancedsortwordarr.go b/tests/go/func/test_advancedsortwordarr.go index 328df637..c7c62cad 100644 --- a/tests/go/func/test_advancedsortwordarr.go +++ b/tests/go/func/test_advancedsortwordarr.go @@ -4,16 +4,15 @@ import ( "reflect" "strings" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := [][]string{{"a", "A", "1", "b", "B", "2", "c", "C", "3"}} - table = append(table, z01.MultMultRandWords()...) + table = append(table, lib.MultMultRandWords()...) for _, org := range table { // copy for using the solution function @@ -28,7 +27,7 @@ func main() { student.AdvancedSortWordArr(cp_stu, strings.Compare) if !reflect.DeepEqual(cp_stu, cp_sol) { - z01.Fatalf("%s(%v) == %v instead of %v\n", + lib.Fatalf("%s(%v) == %v instead of %v\n", "AdvancedSortWordArr", org, cp_stu, diff --git a/tests/go/func/test_alphacount.go b/tests/go/func/test_alphacount.go index 3628c2be..018a1c4d 100644 --- a/tests/go/func/test_alphacount.go +++ b/tests/go/func/test_alphacount.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -13,12 +12,12 @@ func main() { "Hello 78 World! 4455 /", } for l := 0; l < 7; l++ { - a := z01.RandIntBetween(5, 20) - b := z01.RandASCII() - table = append(table, z01.RandStr(a, b)) + a := lib.RandIntBetween(5, 20) + b := lib.RandASCII() + table = append(table, lib.RandStr(a, b)) } for _, arg := range table { - z01.Challenge("AlphaCount", student.AlphaCount, correct.AlphaCount, arg) + lib.Challenge("AlphaCount", student.AlphaCount, correct.AlphaCount, arg) } } diff --git a/tests/go/func/test_any.go b/tests/go/func/test_any.go index 64203cac..953406fe 100644 --- a/tests/go/func/test_any.go +++ b/tests/go/func/test_any.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -18,29 +17,29 @@ func main() { table := []node{} for i := 0; i < 5; i++ { - function := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[lib.RandIntBetween(0, len(functions)-1)] table = append(table, node{ f: function, - a: z01.MultRandWords(), + a: lib.MultRandWords(), }) } for i := 0; i < 5; i++ { table = append(table, node{ f: correct.IsNumeric, - a: z01.MultRandDigit(), + a: lib.MultRandDigit(), }) } for i := 0; i < 5; i++ { table = append(table, node{ f: correct.IsLower, - a: z01.MultRandLower(), + a: lib.MultRandLower(), }) } for i := 0; i < 5; i++ { table = append(table, node{ f: correct.IsUpper, - a: z01.MultRandUpper(), + a: lib.MultRandUpper(), }) } @@ -56,6 +55,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("Any", student.Any, correct.Any, arg.f, arg.a) + lib.Challenge("Any", student.Any, correct.Any, arg.f, arg.a) } } diff --git a/tests/go/func/test_appendrange.go b/tests/go/func/test_appendrange.go index 35e19e7f..d180ffe7 100644 --- a/tests/go/func/test_appendrange.go +++ b/tests/go/func/test_appendrange.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -16,8 +15,8 @@ func main() { // 15 random pairs of ints for a Valid Range for i := 0; i < 15; i++ { - minVal := z01.RandIntBetween(-10000000, 1000000) - gap := z01.RandIntBetween(1, 20) + minVal := lib.RandIntBetween(-10000000, 1000000) + gap := lib.RandIntBetween(1, 20) val := node{ min: minVal, max: minVal + gap, @@ -27,8 +26,8 @@ func main() { // 15 random pairs of ints with ||invalid range|| for i := 0; i < 15; i++ { - minVal := z01.RandIntBetween(-10000000, 1000000) - gap := z01.RandIntBetween(1, 20) + minVal := lib.RandIntBetween(-10000000, 1000000) + gap := lib.RandIntBetween(1, 20) val := node{ min: minVal, max: minVal - gap, @@ -44,6 +43,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("AppendRange", student.AppendRange, correct.AppendRange, arg.min, arg.max) + lib.Challenge("AppendRange", student.AppendRange, correct.AppendRange, arg.min, arg.max) } } diff --git a/tests/go/func/test_atoi.go b/tests/go/func/test_atoi.go index 3aa8088d..bea07a12 100644 --- a/tests/go/func/test_atoi.go +++ b/tests/go/func/test_atoi.go @@ -3,20 +3,19 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := make([]string, 30) for i := range table { - table[i] = strconv.Itoa(z01.RandInt()) + table[i] = strconv.Itoa(lib.RandInt()) } table = append(table, - strconv.Itoa(z01.MinInt), - strconv.Itoa(z01.MaxInt), + strconv.Itoa(lib.MinInt), + strconv.Itoa(lib.MaxInt), "", "-", "+", @@ -33,6 +32,6 @@ func main() { "123a45", ) for _, arg := range table { - z01.Challenge("Atoi", student.Atoi, correct.Atoi, arg) + lib.Challenge("Atoi", student.Atoi, correct.Atoi, arg) } } diff --git a/tests/go/func/test_atoibase.go b/tests/go/func/test_atoibase.go index 8d8403c5..b96cc4a1 100644 --- a/tests/go/func/test_atoibase.go +++ b/tests/go/func/test_atoibase.go @@ -1,12 +1,10 @@ package main import ( - "github.com/01-edu/z01" - + "../lib" "./base" - - correct "./correct" - student "./student" + "./correct" + "./student" ) // this is the function that creates the TESTS @@ -44,7 +42,7 @@ func main() { node{s: "bbbbbab", base: "-ab"}, ) for _, arg := range table { - z01.Challenge("AtoiBase", student.AtoiBase, correct.AtoiBase, arg.s, arg.base) + lib.Challenge("AtoiBase", student.AtoiBase, correct.AtoiBase, arg.s, arg.base) } } diff --git a/tests/go/func/test_basicatoi.go b/tests/go/func/test_basicatoi.go index 5e097996..1d92c44c 100644 --- a/tests/go/func/test_basicatoi.go +++ b/tests/go/func/test_basicatoi.go @@ -3,19 +3,18 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := make([]string, 30) for i := range table { - table[i] = strconv.Itoa(z01.RandPosZ()) + table[i] = strconv.Itoa(lib.RandPosZ()) } table = append(table, - strconv.Itoa(z01.MaxInt), + strconv.Itoa(lib.MaxInt), "", "0", "12345", @@ -23,6 +22,6 @@ func main() { "000000", ) for _, arg := range table { - z01.Challenge("BasicAtoi", student.BasicAtoi, correct.BasicAtoi, arg) + lib.Challenge("BasicAtoi", student.BasicAtoi, correct.BasicAtoi, arg) } } diff --git a/tests/go/func/test_basicatoi2.go b/tests/go/func/test_basicatoi2.go index d71b8e16..763b3346 100644 --- a/tests/go/func/test_basicatoi2.go +++ b/tests/go/func/test_basicatoi2.go @@ -3,19 +3,18 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := make([]string, 30) for i := range table { - table[i] = strconv.Itoa(z01.RandPosZ()) + table[i] = strconv.Itoa(lib.RandPosZ()) } table = append(table, - strconv.Itoa(z01.MaxInt), + strconv.Itoa(lib.MaxInt), "", "0", "Invalid123", @@ -27,6 +26,6 @@ func main() { "123.0", ) for _, arg := range table { - z01.Challenge("BasicAtoi2", student.BasicAtoi2, correct.BasicAtoi2, arg) + lib.Challenge("BasicAtoi2", student.BasicAtoi2, correct.BasicAtoi2, arg) } } diff --git a/tests/go/func/test_basicjoin.go b/tests/go/func/test_basicjoin.go index cce45ea3..a66e1f69 100644 --- a/tests/go/func/test_basicjoin.go +++ b/tests/go/func/test_basicjoin.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -12,12 +11,12 @@ func main() { // 30 valid pair of ramdom slice of strings to concatenate for i := 0; i < 30; i++ { - table = append(table, z01.MultRandASCII()) + table = append(table, lib.MultRandASCII()) } table = append(table, []string{"Hello!", " How are you?", "well and yourself?"}, ) for _, arg := range table { - z01.Challenge("BasicJoin", student.BasicJoin, correct.BasicJoin, arg) + lib.Challenge("BasicJoin", student.BasicJoin, correct.BasicJoin, arg) } } diff --git a/tests/go/func/test_btreeapplybylevel.go b/tests/go/func/test_btreeapplybylevel.go index 665ac0b6..68eae5d5 100644 --- a/tests/go/func/test_btreeapplybylevel.go +++ b/tests/go/func/test_btreeapplybylevel.go @@ -3,8 +3,8 @@ package main import ( "fmt" - correct "./correct" - student "./student" + "./correct" + "./student" ) func main() { diff --git a/tests/go/func/test_btreeapplyinorder.go b/tests/go/func/test_btreeapplyinorder.go index 48fc61d3..279360f8 100644 --- a/tests/go/func/test_btreeapplyinorder.go +++ b/tests/go/func/test_btreeapplyinorder.go @@ -3,8 +3,8 @@ package main import ( "fmt" - correct "./correct" - student "./student" + "./correct" + "./student" ) func main() { diff --git a/tests/go/func/test_btreeapplypostorder.go b/tests/go/func/test_btreeapplypostorder.go index 42b48517..40eaf212 100644 --- a/tests/go/func/test_btreeapplypostorder.go +++ b/tests/go/func/test_btreeapplypostorder.go @@ -3,8 +3,8 @@ package main import ( "fmt" - correct "./correct" - student "./student" + "./correct" + "./student" ) func main() { diff --git a/tests/go/func/test_btreeapplypreorder.go b/tests/go/func/test_btreeapplypreorder.go index 25ffd152..25200f0b 100644 --- a/tests/go/func/test_btreeapplypreorder.go +++ b/tests/go/func/test_btreeapplypreorder.go @@ -3,8 +3,8 @@ package main import ( "fmt" - correct "./correct" - student "./student" + "./correct" + "./student" ) func main() { diff --git a/tests/go/func/test_btreedeletenode.go b/tests/go/func/test_btreedeletenode.go index 141c21b6..17615624 100644 --- a/tests/go/func/test_btreedeletenode.go +++ b/tests/go/func/test_btreedeletenode.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func parentListDelete(root *student.TreeNode) string { @@ -80,7 +79,7 @@ func formatSubTree_delete(root *student.TreeNode, prefix string) string { } func errorMessage_delete(fn interface{}, deleted string, rootOr, root *correct.TreeNode, rootS *student.TreeNode) { - z01.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", + lib.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", "BTreeDeleteNode", correct.FormatTree(rootOr), deleted, diff --git a/tests/go/func/test_btreeinsertdata.go b/tests/go/func/test_btreeinsertdata.go index 998d2ea7..fa6c233e 100644 --- a/tests/go/func/test_btreeinsertdata.go +++ b/tests/go/func/test_btreeinsertdata.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func parentListInsert(root *student.TreeNode) string { @@ -80,7 +79,7 @@ func formatSubTree_insert(root *student.TreeNode, prefix string) string { } func errorMessage_insert(fn interface{}, inserted string, root *correct.TreeNode, rootS *student.TreeNode) { - z01.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", + lib.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", "BTreeInsertData", correct.FormatTree(root), inserted, diff --git a/tests/go/func/test_btreeisbinary.go b/tests/go/func/test_btreeisbinary.go index 1d2177ea..ad335c70 100644 --- a/tests/go/func/test_btreeisbinary.go +++ b/tests/go/func/test_btreeisbinary.go @@ -3,10 +3,9 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func BTreeMinStu(root *student.TreeNode) *student.TreeNode { @@ -17,7 +16,7 @@ func BTreeMinStu(root *student.TreeNode) *student.TreeNode { } func errorMessage_isbin(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { - z01.Fatalf("%s(\n%s\n) == %s instead of %s\n", + lib.Fatalf("%s(\n%s\n) == %s instead of %s\n", "BTreeIsBinary", correct.FormatTree(root), b.Data, @@ -27,31 +26,31 @@ func errorMessage_isbin(fn interface{}, root, a *correct.TreeNode, b *student.Tr func CompareNode_isbin(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - z01.Fatalf("Expected %v instead of %v\n", a, b) + lib.Fatalf("Expected %v instead of %v\n", a, b) } if a.Data != b.Data { errorMessage_isbin(fn, arg1, a, b) } if a.Parent != nil && b.Parent != nil && a.Parent.Data != b.Parent.Data { errorMessage_isbin(fn, arg1, a, b) - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil && a.Right.Data != b.Right.Data { errorMessage_isbin(fn, arg1, a, b) - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil && a.Left.Data != b.Left.Data { errorMessage_isbin(fn, arg1, a, b) - z01.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) + lib.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - z01.Fatalf("Expected left child value %v instead of %v\n", a, b) + lib.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -59,8 +58,8 @@ func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} - out1 := z01.Monitor(fn1, arar1) - out2 := z01.Monitor(fn2, arar2) + out1 := lib.Monitor(fn1, arar1) + out2 := lib.Monitor(fn2, arar2) for i, v := range out1.Results { switch str := v.(type) { @@ -68,11 +67,11 @@ func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte CompareNode_isbin(fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - z01.Fatalf("%s(\n%s) == %s instead of %s\n", + lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeIsBinary", correct.FormatTree(arg1), - z01.Format(out2.Results...), - z01.Format(out1.Results...), + lib.Format(out2.Results...), + lib.Format(out1.Results...), ) } } diff --git a/tests/go/func/test_btreelevelcount.go b/tests/go/func/test_btreelevelcount.go index e70b4a7b..df1a514f 100644 --- a/tests/go/func/test_btreelevelcount.go +++ b/tests/go/func/test_btreelevelcount.go @@ -3,14 +3,13 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func errorMessage_level(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { - z01.Fatalf("%s(\n%s\n) == %s instead of %s\n", + lib.Fatalf("%s(\n%s\n) == %s instead of %s\n", "BTreeLevelCount", correct.FormatTree(root), b.Data, @@ -20,7 +19,7 @@ func errorMessage_level(fn interface{}, root, a *correct.TreeNode, b *student.Tr func CompareNode_level(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - z01.Fatalf("Expected %v instead of %v\n", a, b) + lib.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -31,28 +30,28 @@ func CompareNode_level(fn interface{}, arg1, a *correct.TreeNode, b *student.Tre if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_level(fn, arg1, a, b) - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_level(fn, arg1, a, b) - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_level(fn, arg1, a, b) - z01.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) + lib.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - z01.Fatalf("Expected left child value %v instead of %v\n", a, b) + lib.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -60,8 +59,8 @@ func CompareReturn_level(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} - out1 := z01.Monitor(fn1, arar1) - out2 := z01.Monitor(fn2, arar2) + out1 := lib.Monitor(fn1, arar1) + out2 := lib.Monitor(fn2, arar2) for i, v := range out1.Results { switch str := v.(type) { @@ -69,11 +68,11 @@ func CompareReturn_level(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 inte CompareNode_level(fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - z01.Fatalf("%s(\n%s) == %s instead of %s\n", + lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeLevelCount", correct.FormatTree(arg1), - z01.Format(out2.Results...), - z01.Format(out1.Results...), + lib.Format(out2.Results...), + lib.Format(out1.Results...), ) } } diff --git a/tests/go/func/test_btreemax.go b/tests/go/func/test_btreemax.go index ab03246b..efb35e1d 100644 --- a/tests/go/func/test_btreemax.go +++ b/tests/go/func/test_btreemax.go @@ -3,14 +3,13 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func errorMessage_max(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { - z01.Fatalf("%s(\n%s) == %s instead of %s\n", + lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeMax", correct.FormatTree(root), b.Data, @@ -20,7 +19,7 @@ func errorMessage_max(fn interface{}, root, a *correct.TreeNode, b *student.Tree func CompareNode_max(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - z01.Fatalf("Expected %v instead of %v\n", a, b) + lib.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -31,28 +30,28 @@ func CompareNode_max(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeN if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_max(fn, arg1, a, b) - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_max(fn, arg1, a, b) - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_max(fn, arg1, a, b) - z01.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) + lib.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - z01.Fatalf("Expected left child value %v instead of %v\n", a, b) + lib.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -60,8 +59,8 @@ func CompareReturn_max(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interf arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} - out1 := z01.Monitor(fn1, arar1) - out2 := z01.Monitor(fn2, arar2) + out1 := lib.Monitor(fn1, arar1) + out2 := lib.Monitor(fn2, arar2) for i, v := range out1.Results { switch str := v.(type) { @@ -69,11 +68,11 @@ func CompareReturn_max(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interf CompareNode_max(fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - z01.Fatalf("%s(\n%s) == %s instead of\n %s\n", + lib.Fatalf("%s(\n%s) == %s instead of\n %s\n", "BTreeMax", correct.FormatTree(arg1), - z01.Format(out2.Results...), - z01.Format(out1.Results...), + lib.Format(out2.Results...), + lib.Format(out1.Results...), ) } } diff --git a/tests/go/func/test_btreemin.go b/tests/go/func/test_btreemin.go index 40a6d8fb..46250563 100644 --- a/tests/go/func/test_btreemin.go +++ b/tests/go/func/test_btreemin.go @@ -3,14 +3,13 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func errorMessage_min(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { - z01.Fatalf("%s(\n%s) == %s instead of %s\n", + lib.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeMin", correct.FormatTree(root), b.Data, @@ -20,7 +19,7 @@ func errorMessage_min(fn interface{}, root, a *correct.TreeNode, b *student.Tree func CompareNode_min(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - z01.Fatalf("Expected %v instead of %v\n", a, b) + lib.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -31,28 +30,28 @@ func CompareNode_min(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeN if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_min(fn, arg1, a, b) - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_min(fn, arg1, a, b) - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_min(fn, arg1, a, b) - z01.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) + lib.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - z01.Fatalf("Expected left child value %v instead of %v\n", a, b) + lib.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -60,8 +59,8 @@ func CompareReturn_min(fn1, fn2, arg1, arg2 interface{}) { arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} - out1 := z01.Monitor(fn1, arar1) - out2 := z01.Monitor(fn2, arar2) + out1 := lib.Monitor(fn1, arar1) + out2 := lib.Monitor(fn2, arar2) for i, v := range out1.Results { switch str := v.(type) { @@ -69,11 +68,11 @@ func CompareReturn_min(fn1, fn2, arg1, arg2 interface{}) { CompareNode_min(fn1, arg1.(*correct.TreeNode), str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - z01.Fatalf("%s(%s) == %s instead of %s\n", + lib.Fatalf("%s(%s) == %s instead of %s\n", "BTreeMin", - z01.Format(arg1), - z01.Format(out2.Results...), - z01.Format(out1.Results...), + lib.Format(arg1), + lib.Format(out2.Results...), + lib.Format(out1.Results...), ) } } diff --git a/tests/go/func/test_btreesearchitem.go b/tests/go/func/test_btreesearchitem.go index 76cdbf93..55a251db 100644 --- a/tests/go/func/test_btreesearchitem.go +++ b/tests/go/func/test_btreesearchitem.go @@ -1,17 +1,16 @@ package main import ( - "github.com/01-edu/z01" - "fmt" - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func errorMessage_search(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode, seaVal string) { - z01.Fatalf("%s(\n%s\n, %s) == %s instead of %s\n", + lib.Fatalf("%s(\n%s\n, %s) == %s instead of %s\n", "BTreeSearchItem", correct.FormatTree(root), seaVal, @@ -27,7 +26,7 @@ func CompareNode_search(fn interface{}, arg1, a *correct.TreeNode, b *student.Tr } if (a == nil && b != nil) || (b == nil && a != nil) { - z01.Fatalf("Expected %v instead of %v\n", a, b) + lib.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -38,31 +37,31 @@ func CompareNode_search(fn interface{}, arg1, a *correct.TreeNode, b *student.Tr if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_search(fn, arg1, a, b, seaVal) - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) fmt.Println("Parent.Data", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - z01.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_search(fn, arg1, a, b, seaVal) - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) fmt.Println("Right.Data", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - z01.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) + lib.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_search(fn, arg1, a, b, seaVal) - z01.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) + lib.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) fmt.Println("Left.Data", a.Left.Data, b.Left.Data) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - z01.Fatalf("Expected left child value %v instead of %v\n", a, b) + lib.Fatalf("Expected left child value %v instead of %v\n", a, b) } } diff --git a/tests/go/func/test_btreetransplant.go b/tests/go/func/test_btreetransplant.go index 32d9c0d7..bd4b0a9d 100644 --- a/tests/go/func/test_btreetransplant.go +++ b/tests/go/func/test_btreetransplant.go @@ -1,12 +1,11 @@ package main import ( - "github.com/01-edu/z01" - "fmt" - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func parentListTransp(root *student.TreeNode) string { @@ -82,7 +81,7 @@ func formatSubTree_transp(root *student.TreeNode, prefix string) string { } func errorMessage_transp(fn interface{}, root, sel, repl *correct.TreeNode, rootA *correct.TreeNode, rootAS *student.TreeNode) { - z01.Fatalf("%s(\nRoot:\n %s, Selected:\n%s, Replacement:\n%s\n) ==\n%s instead of\n%s\n", + 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), @@ -104,7 +103,7 @@ func CompareTrees_transp(fn interface{}, root, sel, repl *correct.TreeNode, root if parentSol != parentStu { fmt.Println("Tree:\n", solTree) - z01.Fatalf("Expected\n%s instead of\n%s\n", parentSol, parentStu) + lib.Fatalf("Expected\n%s instead of\n%s\n", parentSol, parentStu) } } diff --git a/tests/go/func/test_capitalize.go b/tests/go/func/test_capitalize.go index dea389fe..c2d5b720 100644 --- a/tests/go/func/test_capitalize.go +++ b/tests/go/func/test_capitalize.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandASCII(), + lib.MultRandASCII(), "Hello! How are you? How+are+things+4you?", "Hello! How are you?", "a", @@ -19,6 +18,6 @@ func main() { "9a LALALA!", ) for _, arg := range table { - z01.Challenge("Capitalize", student.Capitalize, correct.Capitalize, arg) + lib.Challenge("Capitalize", student.Capitalize, correct.Capitalize, arg) } } diff --git a/tests/go/func/test_changeorder.go b/tests/go/func/test_changeorder.go index 52fa454e..49c77bae 100644 --- a/tests/go/func/test_changeorder.go +++ b/tests/go/func/test_changeorder.go @@ -3,9 +3,8 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) type stuNode = NodeAddL @@ -77,25 +76,25 @@ func compareNodes(stuResult *stuNode, solResult *solNode, num1 int) { } if stuResult != nil && solResult == nil { stuNum := stuListToNum(stuResult) - z01.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", + lib.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", solList, stuNum, "") } if stuResult == nil && solResult != nil { solNum := solListToNum(solResult) - z01.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", + lib.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", solList, "", solNum) } stuNum := stuListToNum(stuResult) solNum := solListToNum(solResult) if stuNum != solNum { - z01.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", + lib.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", solList, stuNum, solNum) } } func main() { table := []int{1234567} - table = append(table, z01.MultRandIntBetween(0, 1000000000)...) + table = append(table, lib.MultRandIntBetween(0, 1000000000)...) for _, arg := range table { stuResult := Changeorder(stuNumToList(arg)) diff --git a/tests/go/func/test_chunk.go b/tests/go/func/test_chunk.go index b0088076..18e97a26 100644 --- a/tests/go/func/test_chunk.go +++ b/tests/go/func/test_chunk.go @@ -1,16 +1,15 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func randomSize() []int { randSlice := []int{} - for i := 0; i <= z01.RandIntBetween(0, 20); i++ { - randSlice = append(randSlice, z01.RandInt()) + for i := 0; i <= lib.RandIntBetween(0, 20); i++ { + randSlice = append(randSlice, lib.RandInt()) } return randSlice } @@ -25,7 +24,7 @@ func main() { for i := 0; i <= 7; i++ { value := node{ slice: randomSize(), - ch: z01.RandIntBetween(0, 10), + ch: lib.RandIntBetween(0, 10), } table = append(table, value) } @@ -37,6 +36,6 @@ func main() { ch: 0, }) for _, args := range table { - z01.Challenge("Chunk", student.Chunk, correct.Chunk, args.slice, args.ch) + lib.Challenge("Chunk", student.Chunk, correct.Chunk, args.slice, args.ch) } } diff --git a/tests/go/func/test_collatzcountdown.go b/tests/go/func/test_collatzcountdown.go index ea409e29..be3b9121 100644 --- a/tests/go/func/test_collatzcountdown.go +++ b/tests/go/func/test_collatzcountdown.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - args := []int{z01.RandIntBetween(-6, 20)} + args := []int{lib.RandIntBetween(-6, 20)} args = append(args, -5, 0) for i := 0; i < 20; i++ { - args = append(args, z01.RandIntBetween(2, 20)) + args = append(args, lib.RandIntBetween(2, 20)) } for _, v := range args { - z01.Challenge("CollatzCountdown", student.CollatzCountdown, correct.CollatzCountdown, v) + lib.Challenge("CollatzCountdown", student.CollatzCountdown, correct.CollatzCountdown, v) } } diff --git a/tests/go/func/test_compact.go b/tests/go/func/test_compact.go index f400abd1..f2353980 100644 --- a/tests/go/func/test_compact.go +++ b/tests/go/func/test_compact.go @@ -3,25 +3,24 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { arg := [][]string{{"hello", "", "hi", "", "salut", "", ""}} for i := 0; i < 20; i++ { - n := z01.RandIntBetween(5, 20) // random size of the slice + n := lib.RandIntBetween(5, 20) // random size of the slice orig := make([]string, n) // slice with the original value - num_pos := z01.RandIntBetween(1, n-1) // random number of positions to be written + num_pos := lib.RandIntBetween(1, n-1) // random number of positions to be written for i := 0; i < num_pos; i++ { - word := z01.RandWords() // random string value - rand_pos := z01.RandIntBetween(0, n-1) // random position in the slice + word := lib.RandWords() // random string value + rand_pos := lib.RandIntBetween(0, n-1) // random position in the slice orig[rand_pos] = word } arg = append(arg, orig) @@ -38,14 +37,14 @@ func main() { stu_size := student.Compact(&sli_stu) if !reflect.DeepEqual(sli_stu, sli_sol) { - z01.Fatalf("Produced slice: %v, instead of %v\n", + lib.Fatalf("Produced slice: %v, instead of %v\n", sli_stu, sli_sol, ) } if sol_size != stu_size { - z01.Fatalf("%s(%v) == %v instead of %v\n", + lib.Fatalf("%s(%v) == %v instead of %v\n", "Compact", v, sli_stu, diff --git a/tests/go/func/test_compare.go b/tests/go/func/test_compare.go index d49b6e0b..c9d81535 100644 --- a/tests/go/func/test_compare.go +++ b/tests/go/func/test_compare.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -17,7 +16,7 @@ func main() { // the first 15 values are returning 0 for this test for i := 0; i < 15; i++ { - wordToTest := z01.RandASCII() + wordToTest := lib.RandASCII() val := node{ s: wordToTest, @@ -28,8 +27,8 @@ func main() { // the next 15 values are supposed to return 1 or -1 for this test for i := 0; i < 15; i++ { - wordToTest := z01.RandASCII() - wrongMatch := z01.RandASCII() + wordToTest := lib.RandASCII() + wrongMatch := lib.RandASCII() val := node{ s: wordToTest, @@ -45,6 +44,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("Compare", student.Compare, correct.Compare, arg.s, arg.toCompare) + lib.Challenge("Compare", student.Compare, correct.Compare, arg.s, arg.toCompare) } } diff --git a/tests/go/func/test_concat.go b/tests/go/func/test_concat.go index a9582a47..2d014914 100644 --- a/tests/go/func/test_concat.go +++ b/tests/go/func/test_concat.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -12,13 +11,13 @@ func main() { // 30 valid pair of ramdom strings to concatenate for i := 0; i < 30; i++ { - value := []string{z01.RandASCII(), z01.RandASCII()} + value := []string{lib.RandASCII(), lib.RandASCII()} table = append(table, value) } table = append(table, []string{"Hello!", " How are you?"}, ) for _, arg := range table { - z01.Challenge("Concat", student.Concat, correct.Concat, arg[0], arg[1]) + lib.Challenge("Concat", student.Concat, correct.Concat, arg[0], arg[1]) } } diff --git a/tests/go/func/test_concatparams.go b/tests/go/func/test_concatparams.go index 31c8ec5e..c76e728c 100644 --- a/tests/go/func/test_concatparams.go +++ b/tests/go/func/test_concatparams.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -12,9 +11,9 @@ func main() { // 30 random slice of strings for i := 0; i < 30; i++ { - table = append(table, z01.MultRandASCII()) + table = append(table, lib.MultRandASCII()) } for _, arg := range table { - z01.Challenge("ConcatParams", student.ConcatParams, correct.ConcatParams, arg) + lib.Challenge("ConcatParams", student.ConcatParams, correct.ConcatParams, arg) } } diff --git a/tests/go/func/test_convertbase.go b/tests/go/func/test_convertbase.go index b6ba95dc..1392746d 100644 --- a/tests/go/func/test_convertbase.go +++ b/tests/go/func/test_convertbase.go @@ -1,12 +1,10 @@ package main import ( - "github.com/01-edu/z01" - + "../lib" "./base" - - correct "./correct" - student "./student" + "./correct" + "./student" ) func main() { @@ -20,7 +18,7 @@ func main() { for i := 0; i < 30; i++ { validBaseToInput1 := base.Valid() validBaseToInput2 := base.Valid() - str := base.ConvertNbr(z01.RandIntBetween(0, 1000000), validBaseToInput1) + str := base.ConvertNbr(lib.RandIntBetween(0, 1000000), validBaseToInput1) val := node{ nbr: str, baseFrom: validBaseToInput1, @@ -36,7 +34,7 @@ func main() { ) for _, arg := range table { - z01.Challenge("ConvertBase", student.ConvertBase, correct.ConvertBase, arg.nbr, arg.baseFrom, arg.baseTo) + lib.Challenge("ConvertBase", student.ConvertBase, correct.ConvertBase, arg.nbr, arg.baseFrom, arg.baseTo) } } diff --git a/tests/go/func/test_countif.go b/tests/go/func/test_countif.go index 40e53507..32d2b422 100644 --- a/tests/go/func/test_countif.go +++ b/tests/go/func/test_countif.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -18,17 +17,17 @@ func main() { table := []node{} for i := 0; i < 5; i++ { - function := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[lib.RandIntBetween(0, len(functions)-1)] val := node{ f: function, - arr: z01.MultRandWords(), + arr: lib.MultRandWords(), } table = append(table, val) } for i := 0; i < 5; i++ { val := node{ f: correct.IsNumeric, - arr: z01.MultRandDigit(), + arr: lib.MultRandDigit(), } table = append(table, val) } @@ -36,14 +35,14 @@ func main() { for i := 0; i < 5; i++ { val := node{ f: correct.IsLower, - arr: z01.MultRandLower(), + arr: lib.MultRandLower(), } table = append(table, val) } for i := 0; i < 5; i++ { val := node{ f: correct.IsUpper, - arr: z01.MultRandUpper(), + arr: lib.MultRandUpper(), } table = append(table, val) } @@ -60,6 +59,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("CountIf", student.CountIf, correct.CountIf, arg.f, arg.arr) + lib.Challenge("CountIf", student.CountIf, correct.CountIf, arg.f, arg.arr) } } diff --git a/tests/go/func/test_createelem.go b/tests/go/func/test_createelem.go index 69ef7906..cae82df6 100644 --- a/tests/go/func/test_createelem.go +++ b/tests/go/func/test_createelem.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) // the structs from the other packages @@ -20,7 +19,7 @@ func main() { table := [][]int{{{132423}}} for i := 0; i < 5; i++ { - table = append(table, z01.MultRandIntBetween(-1000000, 10000000)) + table = append(table, lib.MultRandIntBetween(-1000000, 10000000)) } for _, items := range table { @@ -30,7 +29,7 @@ func main() { } if n1.Data != n2.Data { - z01.Fatalf("CreateElem == %d instead of %d\n", n1, n2) + lib.Fatalf("CreateElem == %d instead of %d\n", n1, n2) } } } diff --git a/tests/go/func/test_divmod.go b/tests/go/func/test_divmod.go index a028cef3..86694749 100644 --- a/tests/go/func/test_divmod.go +++ b/tests/go/func/test_divmod.go @@ -1,24 +1,23 @@ package main import ( - "github.com/01-edu/z01" - - student "./student" + "../lib" + "./student" ) func main() { i := 0 - for i < z01.SliceLen { - a := z01.RandInt() - b := z01.RandInt() + for i < lib.SliceLen { + a := lib.RandInt() + b := lib.RandInt() var div int var mod int student.DivMod(a, b, &div, &mod) if div != a/b { - z01.Fatalf("DivMod(%d, %d, &div, &mod), div == %d instead of %d", a, b, div, a/b) + lib.Fatalf("DivMod(%d, %d, &div, &mod), div == %d instead of %d", a, b, div, a/b) } if mod != a%b { - z01.Fatalf("DivMod(%d, %d, &div, &mod), mod == %d instead of %d", a, b, mod, a%b) + lib.Fatalf("DivMod(%d, %d, &div, &mod), mod == %d instead of %d", a, b, mod, a%b) } i++ } diff --git a/tests/go/func/test_doppelganger.go b/tests/go/func/test_doppelganger.go index 1cf669d7..56d62189 100644 --- a/tests/go/func/test_doppelganger.go +++ b/tests/go/func/test_doppelganger.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type node struct { @@ -21,10 +20,10 @@ func main() { ) for i := 0; i < 10; i++ { - l := z01.RandIntBetween(5, 30) - big := z01.RandStr(l, "qwertyuiopasdfghjklzxcvbnm") - start := z01.RandIntBetween(0, l-1) - end := z01.RandIntBetween(start+1, l-1) + l := lib.RandIntBetween(5, 30) + big := lib.RandStr(l, "qwertyuiopasdfghjklzxcvbnm") + start := lib.RandIntBetween(0, l-1) + end := lib.RandIntBetween(start+1, l-1) little := big[start:end] value := node{ @@ -36,8 +35,8 @@ func main() { } for i := 0; i < 10; i++ { - big := z01.RandStr(z01.RandIntBetween(5, 30), "qwertyuiopasdfghjklzxcvbnm") - little := z01.RandStr(z01.RandIntBetween(1, 29), "qwertyuiopasdfghjklzxcvbnm") + big := lib.RandStr(lib.RandIntBetween(5, 30), "qwertyuiopasdfghjklzxcvbnm") + little := lib.RandStr(lib.RandIntBetween(1, 29), "qwertyuiopasdfghjklzxcvbnm") value := node{ big: big, @@ -48,6 +47,6 @@ func main() { } for _, arg := range table { - z01.Challenge("DoppelGanger", student.DoppelGanger, correct.DoppelGanger, arg.big, arg.little) + lib.Challenge("DoppelGanger", student.DoppelGanger, correct.DoppelGanger, arg.big, arg.little) } } diff --git a/tests/go/func/test_eightqueens.go b/tests/go/func/test_eightqueens.go index ed5eaf60..b23ab595 100644 --- a/tests/go/func/test_eightqueens.go +++ b/tests/go/func/test_eightqueens.go @@ -1,12 +1,11 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - z01.Challenge("EightQueens", student.EightQueens, correct.EightQueens) + lib.Challenge("EightQueens", student.EightQueens, correct.EightQueens) } diff --git a/tests/go/func/test_enigma.go b/tests/go/func/test_enigma.go index c4b2f674..f841a463 100644 --- a/tests/go/func/test_enigma.go +++ b/tests/go/func/test_enigma.go @@ -1,14 +1,13 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - args := append([]int, z01.MultRandIntBetween(2, 20)...) + args := append([]int, lib.MultRandIntBetween(2, 20)...) aval := args[0] x := args[0] @@ -41,25 +40,25 @@ func main() { correct.Decript(a, b, c, d) if aval != ***a { - z01.Fatalf("Expected ***a = %d instead of %d\n", + lib.Fatalf("Expected ***a = %d instead of %d\n", aval, ***a, ) } if bval != *b { - z01.Fatalf("Expected *b = %d instead of %d\n", + lib.Fatalf("Expected *b = %d instead of %d\n", bval, *b, ) } if cval != *******c { - z01.Fatalf("Expected *******c = %d instead of %d\n", + lib.Fatalf("Expected *******c = %d instead of %d\n", cval, *******c, ) } if dval != ****d { - z01.Fatalf("Expected ****d = %d instead of %d\n", + lib.Fatalf("Expected ****d = %d instead of %d\n", dval, ****d, ) diff --git a/tests/go/func/test_fib.go b/tests/go/func/test_fib.go index 5a4c038c..ef795d85 100644 --- a/tests/go/func/test_fib.go +++ b/tests/go/func/test_fib.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -14,8 +13,8 @@ func main() { 9, 2, } - table = append(table, z01.MultRandIntBetween(-100, 150)...) + table = append(table, lib.MultRandIntBetween(-100, 150)...) for _, arg := range table { - z01.Challenge("Fib", student.Fib, correct.Fib, arg) + lib.Challenge("Fib", student.Fib, correct.Fib, arg) } } diff --git a/tests/go/func/test_fibonacci.go b/tests/go/func/test_fibonacci.go index d153e34f..de614853 100644 --- a/tests/go/func/test_fibonacci.go +++ b/tests/go/func/test_fibonacci.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandIntBetween(0, 25), + lib.MultRandIntBetween(0, 25), 4, 5, -5, ) for _, arg := range table { - z01.Challenge("Fibonacci", student.Fibonacci, correct.Fibonacci, arg) + lib.Challenge("Fibonacci", student.Fibonacci, correct.Fibonacci, arg) } } diff --git a/tests/go/func/test_findnextprime.go b/tests/go/func/test_findnextprime.go index 19541ef2..a9fa6273 100644 --- a/tests/go/func/test_findnextprime.go +++ b/tests/go/func/test_findnextprime.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandIntBetween(-1000000, 1000000), + lib.MultRandIntBetween(-1000000, 1000000), 0, 1, 2, @@ -29,6 +28,6 @@ func main() { 1000000088, ) for _, arg := range table { - z01.Challenge("FindNextPrime", student.FindNextPrime, correct.FindNextPrime, arg) + lib.Challenge("FindNextPrime", student.FindNextPrime, correct.FindNextPrime, arg) } } diff --git a/tests/go/func/test_findprevprime.go b/tests/go/func/test_findprevprime.go index 2144e757..b5ea44a1 100644 --- a/tests/go/func/test_findprevprime.go +++ b/tests/go/func/test_findprevprime.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - a := append(z01.MultRandIntBetween(0, 99999), 5, 4, 1) + a := append(lib.MultRandIntBetween(0, 99999), 5, 4, 1) for _, elem := range a { - z01.Challenge("FindPrevPrime", student.FindPrevPrime, correct.FindPrevPrime, elem) + lib.Challenge("FindPrevPrime", student.FindPrevPrime, correct.FindPrevPrime, elem) } } diff --git a/tests/go/func/test_firstrune.go b/tests/go/func/test_firstrune.go index 8bdf2afd..92ebe463 100644 --- a/tests/go/func/test_firstrune.go +++ b/tests/go/func/test_firstrune.go @@ -1,21 +1,20 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandASCII(), + lib.MultRandASCII(), "Hello!", "Salut!", "Ola!", "♥01", ) for _, arg := range table { - z01.Challenge("FirstRune", student.FirstRune, correct.FirstRune, arg) + lib.Challenge("FirstRune", student.FirstRune, correct.FirstRune, arg) } } diff --git a/tests/go/func/test_foldint.go b/tests/go/func/test_foldint.go index a04c1c4a..d89f801a 100644 --- a/tests/go/func/test_foldint.go +++ b/tests/go/func/test_foldint.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -29,11 +28,11 @@ func main() { table := []node{} for i := 0; i < 8; i++ { - argInt = append(argInt, z01.MultRandIntBetween(0, 50)...) + argInt = append(argInt, lib.MultRandIntBetween(0, 50)...) table = append(table, node{ a: argInt, functions: f, - n: z01.RandIntBetween(0, 60), + n: lib.RandIntBetween(0, 60), }) } @@ -51,7 +50,7 @@ func main() { for _, v := range table { for _, f := range v.functions { - z01.Challenge("FoldInt", student.FoldInt, correct.FoldInt, f, v.a, v.n) + lib.Challenge("FoldInt", student.FoldInt, correct.FoldInt, f, v.a, v.n) } } } diff --git a/tests/go/func/test_foreach.go b/tests/go/func/test_foreach.go index a5fc7eaf..2170983a 100644 --- a/tests/go/func/test_foreach.go +++ b/tests/go/func/test_foreach.go @@ -3,10 +3,9 @@ package main import ( "fmt" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func add0(i int) { @@ -34,10 +33,10 @@ func main() { // 15 random slice of random ints with a random function from selection for i := 0; i < 15; i++ { - function := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[lib.RandIntBetween(0, len(functions)-1)] table = append(table, node{ f: function, - a: z01.MultRandIntBetween(-1000000, 1000000), + a: lib.MultRandIntBetween(-1000000, 1000000), }) } @@ -47,6 +46,6 @@ func main() { }) for _, arg := range table { - z01.Challenge("ForEach", student.ForEach, correct.ForEach, arg.f, arg.a) + lib.Challenge("ForEach", student.ForEach, correct.ForEach, arg.f, arg.a) } } diff --git a/tests/go/func/test_game23.go b/tests/go/func/test_game23.go index 366565d7..2a0fc413 100644 --- a/tests/go/func/test_game23.go +++ b/tests/go/func/test_game23.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func nd(a, b int) int { @@ -37,8 +36,8 @@ func main() { for i := 0; i < 20; i++ { table = append(table, node{ - init: z01.RandIntBetween(1, 1000), - fin: z01.RandIntBetween(1, 1000), + init: lib.RandIntBetween(1, 1000), + fin: lib.RandIntBetween(1, 1000), }) } @@ -56,6 +55,6 @@ func main() { table = append(table, value) } for _, arg := range table { - z01.Challenge("Game23", student.Game23, correct.Game23, arg.init, arg.fin) + lib.Challenge("Game23", student.Game23, correct.Game23, arg.init, arg.fin) } } diff --git a/tests/go/func/test_halfcontest.go b/tests/go/func/test_halfcontest.go index f901405f..766a4f58 100644 --- a/tests/go/func/test_halfcontest.go +++ b/tests/go/func/test_halfcontest.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -21,14 +20,14 @@ func main() { for i := 0; i < 20; i++ { table = append(table, node{ - h1: z01.RandIntBetween(0, 10), - m1: z01.RandIntBetween(0, 59), - h2: z01.RandIntBetween(11, 23), - m2: z01.RandIntBetween(0, 59), + h1: lib.RandIntBetween(0, 10), + m1: lib.RandIntBetween(0, 59), + h2: lib.RandIntBetween(11, 23), + m2: lib.RandIntBetween(0, 59), }) } for _, arg := range table { - z01.Challenge("HalfContest", student.HalfContest, correct.HalfContest, arg.h1, arg.m1, arg.h2, arg.m2) + lib.Challenge("HalfContest", student.HalfContest, correct.HalfContest, arg.h1, arg.m1, arg.h2, arg.m2) } } diff --git a/tests/go/func/test_index.go b/tests/go/func/test_index.go index 236fc20e..5cbccec0 100644 --- a/tests/go/func/test_index.go +++ b/tests/go/func/test_index.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -17,9 +16,9 @@ func main() { // the first 15 values are valid for this test for i := 0; i < 15; i++ { - wordToTest := z01.RandASCII() - firstLetterIndex := z01.RandIntBetween(0, (len(wordToTest)-1)/2) - lastLetterIndex := z01.RandIntBetween(firstLetterIndex, len(wordToTest)-1) + wordToTest := lib.RandASCII() + firstLetterIndex := lib.RandIntBetween(0, (len(wordToTest)-1)/2) + lastLetterIndex := lib.RandIntBetween(firstLetterIndex, len(wordToTest)-1) val := node{ s: wordToTest, @@ -30,8 +29,8 @@ func main() { // the next 15 values are supposed to be invalid for this test for i := 0; i < 15; i++ { - wordToTest := z01.RandASCII() - wrongMatch := z01.RandASCII() + wordToTest := lib.RandASCII() + wrongMatch := lib.RandASCII() val := node{ s: wordToTest, @@ -47,6 +46,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("Index", student.Index, correct.Index, arg.s, arg.toFind) + lib.Challenge("Index", student.Index, correct.Index, arg.s, arg.toFind) } } diff --git a/tests/go/func/test_interestingnumber.go b/tests/go/func/test_interestingnumber.go index 47285293..8a003956 100644 --- a/tests/go/func/test_interestingnumber.go +++ b/tests/go/func/test_interestingnumber.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -14,9 +13,9 @@ func main() { 9, 2, } - table = append(table, z01.MultRandIntBetween(1, 1500)...) + table = append(table, lib.MultRandIntBetween(1, 1500)...) for _, arg := range table { - z01.Challenge("InterestingNumber", student.InterestingNumber, correct.InterestingNumber, arg) + lib.Challenge("InterestingNumber", student.InterestingNumber, correct.InterestingNumber, arg) } } diff --git a/tests/go/func/test_inverttree.go b/tests/go/func/test_inverttree.go index b391c862..7ee667c1 100644 --- a/tests/go/func/test_inverttree.go +++ b/tests/go/func/test_inverttree.go @@ -6,9 +6,8 @@ import ( "math/rand" "strconv" - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) type stuNode = TNode @@ -156,8 +155,8 @@ func main() { if !IsIdentical(tree, TestTree) { tree1 := returnSolTree(temp) tree2 := returnStuTree(tmp) - z01.Fatalf("\n\"%v\" instead of \"%v\"\n\n", tree1, tree2) - // z01.Fatalf("\nError\n\n") + lib.Fatalf("\n\"%v\" instead of \"%v\"\n\n", tree1, tree2) + // lib.Fatalf("\nError\n\n") } } } diff --git a/tests/go/func/test_isalpha.go b/tests/go/func/test_isalpha.go index c5d78064..93bded2d 100644 --- a/tests/go/func/test_isalpha.go +++ b/tests/go/func/test_isalpha.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandASCII(), + lib.MultRandASCII(), "Hello! €How are you?", "a", "z", @@ -21,6 +20,6 @@ func main() { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!", ) for _, arg := range table { - z01.Challenge("IsAlpha", student.IsAlpha, correct.IsAlpha, arg) + lib.Challenge("IsAlpha", student.IsAlpha, correct.IsAlpha, arg) } } diff --git a/tests/go/func/test_isanagram.go b/tests/go/func/test_isanagram.go index 0449e862..f3c7675f 100644 --- a/tests/go/func/test_isanagram.go +++ b/tests/go/func/test_isanagram.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -28,12 +27,12 @@ func main() { } for i := 0; i < 15; i++ { table = append(table, [2]string{ - z01.RandStr(z01.RandIntBetween(15, 20), "qwertyuiopasdfghjklzxcvbnm "), - z01.RandStr(z01.RandIntBetween(15, 20), "qwertyuiopasdfghjklzxcvbnm "), + lib.RandStr(lib.RandIntBetween(15, 20), "qwertyuiopasdfghjklzxcvbnm "), + lib.RandStr(lib.RandIntBetween(15, 20), "qwertyuiopasdfghjklzxcvbnm "), }) } for _, arg := range table { - z01.Challenge("IsAnagram", student.IsAnagram, correct.IsAnagram, arg[0], arg[1]) + lib.Challenge("IsAnagram", student.IsAnagram, correct.IsAnagram, arg[0], arg[1]) } } diff --git a/tests/go/func/test_islower.go b/tests/go/func/test_islower.go index dca79484..69221982 100644 --- a/tests/go/func/test_islower.go +++ b/tests/go/func/test_islower.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { // 15 unvalid strings in the table - table := z01.MultRandASCII() + table := lib.MultRandASCII() // 15 valid lowercase strings of random size between 1 and 20 letters in the table for i := 0; i < 15; i++ { - size := z01.RandIntBetween(1, 20) - randLow := z01.RandLower() + size := lib.RandIntBetween(1, 20) + randLow := lib.RandLower() if len(randLow) <= size { table = append(table, randLow) } else { @@ -40,6 +39,6 @@ func main() { "hello!", ) for _, arg := range table { - z01.Challenge("IsLower", student.IsLower, correct.IsLower, arg) + lib.Challenge("IsLower", student.IsLower, correct.IsLower, arg) } } diff --git a/tests/go/func/test_isnegative.go b/tests/go/func/test_isnegative.go index 18b419be..39a55afa 100644 --- a/tests/go/func/test_isnegative.go +++ b/tests/go/func/test_isnegative.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandInt(), - z01.MinInt, - z01.MaxInt, + lib.MultRandInt(), + lib.MinInt, + lib.MaxInt, 0, ) for _, arg := range table { - z01.Challenge("IsNegative", student.IsNegative, correct.IsNegative, arg) + lib.Challenge("IsNegative", student.IsNegative, correct.IsNegative, arg) } } diff --git a/tests/go/func/test_isnumeric.go b/tests/go/func/test_isnumeric.go index 908f1ac3..b11e30ce 100644 --- a/tests/go/func/test_isnumeric.go +++ b/tests/go/func/test_isnumeric.go @@ -3,19 +3,18 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { // 15 unvalid strings in the table - table := z01.MultRandASCII() + table := lib.MultRandASCII() // 15 valid strings in the table for i := 0; i < 15; i++ { - table = append(table, strconv.Itoa(z01.RandIntBetween(0, 1000000))) + table = append(table, strconv.Itoa(lib.RandIntBetween(0, 1000000))) } // Special cases added to table @@ -34,6 +33,6 @@ func main() { "01,02,03", ) for _, arg := range table { - z01.Challenge("IsNumeric", student.IsNumeric, correct.IsNumeric, arg) + lib.Challenge("IsNumeric", student.IsNumeric, correct.IsNumeric, arg) } } diff --git a/tests/go/func/test_isprime.go b/tests/go/func/test_isprime.go index 74e7140d..056cadff 100644 --- a/tests/go/func/test_isprime.go +++ b/tests/go/func/test_isprime.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandIntBetween(-1000000, 1000000), + lib.MultRandIntBetween(-1000000, 1000000), 0, 1, 2, @@ -28,6 +27,6 @@ func main() { 1000000087, ) for _, arg := range table { - z01.Challenge("IsPrime", student.IsPrime, correct.IsPrime, arg) + lib.Challenge("IsPrime", student.IsPrime, correct.IsPrime, arg) } } diff --git a/tests/go/func/test_isprintable.go b/tests/go/func/test_isprintable.go index 001d404a..b4bebf84 100644 --- a/tests/go/func/test_isprintable.go +++ b/tests/go/func/test_isprintable.go @@ -3,20 +3,19 @@ package main import ( "math/rand" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { // 15 unvalid strings in the table - table := z01.MultRandASCII() + table := lib.MultRandASCII() // 15 valid lowercase strings of random size between 1 and 20 letters in the table for i := 0; i < 15; i++ { letters := []rune("\a\b\f\r\n\v\t") - size := z01.RandIntBetween(1, 20) + size := lib.RandIntBetween(1, 20) r := make([]rune, size) for i := range r { r[i] = letters[rand.Intn(len(letters))] @@ -44,6 +43,6 @@ func main() { "\n", ) for _, arg := range table { - z01.Challenge("IsPrintable", student.IsPrintable, correct.IsPrintable, arg) + lib.Challenge("IsPrintable", student.IsPrintable, correct.IsPrintable, arg) } } diff --git a/tests/go/func/test_issorted.go b/tests/go/func/test_issorted.go index ba407782..934cb28e 100644 --- a/tests/go/func/test_issorted.go +++ b/tests/go/func/test_issorted.go @@ -3,10 +3,9 @@ package main import ( "sort" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func isSortedBy1(a, b int) int { @@ -45,18 +44,18 @@ func main() { // 5 unordered slices for i := 0; i < 5; i++ { - function := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[lib.RandIntBetween(0, len(functions)-1)] val := node{ f: function, - a: z01.MultRandIntBetween(-1000000, 1000000), + a: lib.MultRandIntBetween(-1000000, 1000000), } table = append(table, val) } // 5 slices ordered in ascending order for i := 0; i < 5; i++ { - function := functions[z01.RandIntBetween(0, len(functions)-1)] - ordered := z01.MultRandIntBetween(-1000000, 1000000) + function := functions[lib.RandIntBetween(0, len(functions)-1)] + ordered := lib.MultRandIntBetween(-1000000, 1000000) sort.Ints(ordered) val := node{ @@ -68,8 +67,8 @@ func main() { // 5 slices ordered in descending order for i := 0; i < 5; i++ { - function := functions[z01.RandIntBetween(0, len(functions)-1)] - reversed := z01.MultRandIntBetween(-1000000, 1000000) + function := functions[lib.RandIntBetween(0, len(functions)-1)] + reversed := lib.MultRandIntBetween(-1000000, 1000000) sort.Sort(sort.Reverse(sort.IntSlice(reversed))) val := node{ f: function, @@ -99,6 +98,6 @@ func main() { }) for _, arg := range table { - z01.Challenge("IsSorted", student.IsSorted, correct.IsSorted, arg.f, arg.a) + lib.Challenge("IsSorted", student.IsSorted, correct.IsSorted, arg.f, arg.a) } } diff --git a/tests/go/func/test_isupper.go b/tests/go/func/test_isupper.go index c8df3ee1..dbd75813 100644 --- a/tests/go/func/test_isupper.go +++ b/tests/go/func/test_isupper.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { // 15 unvalid strings in the table - table := z01.MultRandASCII() + table := lib.MultRandASCII() // 15 valid lowercase strings of random size between 1 and 20 letters in the table for i := 0; i < 15; i++ { - size := z01.RandIntBetween(1, 20) - randLow := z01.RandLower() + size := lib.RandIntBetween(1, 20) + randLow := lib.RandLower() if len(randLow) <= size { table = append(table, randLow) } else { @@ -42,6 +41,6 @@ func main() { "HELLO!", ) for _, arg := range table { - z01.Challenge("IsUpper", student.IsUpper, correct.IsUpper, arg) + lib.Challenge("IsUpper", student.IsUpper, correct.IsUpper, arg) } } diff --git a/tests/go/func/test_iterativefactorial.go b/tests/go/func/test_iterativefactorial.go index 5da0a55b..2f512fae 100644 --- a/tests/go/func/test_iterativefactorial.go +++ b/tests/go/func/test_iterativefactorial.go @@ -3,21 +3,20 @@ package main import ( "math/bits" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandInt(), - z01.IntRange(0, 12)..., + lib.MultRandInt(), + lib.IntRange(0, 12)..., ) if bits.UintSize == 64 { - table = append(table, z01.IntRange(13, 20)...) + table = append(table, lib.IntRange(13, 20)...) } for _, arg := range table { - z01.Challenge("IterativeFactorial", student.IterativeFactorial, correct.IterativeFactorial, arg) + lib.Challenge("IterativeFactorial", student.IterativeFactorial, correct.IterativeFactorial, arg) } } diff --git a/tests/go/func/test_iterativepower.go b/tests/go/func/test_iterativepower.go index 378167f0..e91d0592 100644 --- a/tests/go/func/test_iterativepower.go +++ b/tests/go/func/test_iterativepower.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { i := 0 for i < 30 { - nb := z01.RandIntBetween(-8, 8) - power := z01.RandIntBetween(-10, 10) - z01.Challenge("IterativePower", student.IterativePower, correct.IterativePower, nb, power) + nb := lib.RandIntBetween(-8, 8) + power := lib.RandIntBetween(-10, 10) + lib.Challenge("IterativePower", student.IterativePower, correct.IterativePower, nb, power) i++ } - z01.Challenge("IterativePower", student.IterativePower, correct.IterativePower, 0, 0) - z01.Challenge("IterativePower", student.IterativePower, correct.IterativePower, 0, 1) + lib.Challenge("IterativePower", student.IterativePower, correct.IterativePower, 0, 0) + lib.Challenge("IterativePower", student.IterativePower, correct.IterativePower, 0, 1) } diff --git a/tests/go/func/test_itoa.go b/tests/go/func/test_itoa.go index 02354271..36c08d6a 100644 --- a/tests/go/func/test_itoa.go +++ b/tests/go/func/test_itoa.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { for i := 0; i < 50; i++ { - arg := z01.RandIntBetween(-2000000000, 2000000000) - z01.Challenge("Itoa", student.Itoa, correct.Itoa, arg) + arg := lib.RandIntBetween(-2000000000, 2000000000) + lib.Challenge("Itoa", student.Itoa, correct.Itoa, arg) } } diff --git a/tests/go/func/test_itoabase.go b/tests/go/func/test_itoabase.go index b0885152..a6951dc0 100644 --- a/tests/go/func/test_itoabase.go +++ b/tests/go/func/test_itoabase.go @@ -1,21 +1,20 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { for i := 0; i < 30; i++ { - value := z01.RandIntBetween(-1000000, 1000000) - base := z01.RandIntBetween(2, 16) - z01.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, value, base) + value := lib.RandIntBetween(-1000000, 1000000) + base := lib.RandIntBetween(2, 16) + lib.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, value, base) } for i := 0; i < 5; i++ { - base := z01.RandIntBetween(2, 16) - z01.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, z01.MaxInt, base) - z01.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, z01.MinInt, base) + base := lib.RandIntBetween(2, 16) + lib.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, lib.MaxInt, base) + lib.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, lib.MinInt, base) } } diff --git a/tests/go/func/test_join.go b/tests/go/func/test_join.go index 0873a5b1..9538e745 100644 --- a/tests/go/func/test_join.go +++ b/tests/go/func/test_join.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -18,10 +17,10 @@ func main() { for i := 0; i < 5; i++ { // random position for the slice of arguments - posA := z01.RandIntBetween(0, len(args)-1) + posA := lib.RandIntBetween(0, len(args)-1) // random position for the slice of separators - posS := z01.RandIntBetween(0, len(seps)-1) + posS := lib.RandIntBetween(0, len(seps)-1) - z01.Challenge("Join", student.Join, correct.Join, args[posA], seps[posS]) + lib.Challenge("Join", student.Join, correct.Join, args[posA], seps[posS]) } } diff --git a/tests/go/func/test_lastrune.go b/tests/go/func/test_lastrune.go index deb4ca96..97648ae0 100644 --- a/tests/go/func/test_lastrune.go +++ b/tests/go/func/test_lastrune.go @@ -1,21 +1,20 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - table := z01.MultRandASCII() + table := lib.MultRandASCII() table = append(table, "Hello!", "Salut!", "Ola!", - z01.RandStr(z01.RandIntBetween(1, 15), z01.RandAlnum()), + lib.RandStr(lib.RandIntBetween(1, 15), lib.RandAlnum()), ) for _, arg := range table { - z01.Challenge("LastRune", student.LastRune, correct.LastRune, arg) + lib.Challenge("LastRune", student.LastRune, correct.LastRune, arg) } } diff --git a/tests/go/func/test_lcm.go b/tests/go/func/test_lcm.go index 1fb3e964..c5cdbe40 100644 --- a/tests/go/func/test_lcm.go +++ b/tests/go/func/test_lcm.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -18,12 +17,12 @@ func main() { for i := 0; i < 15; i++ { table = append(table, [2]int{ - z01.RandIntBetween(0, 1000), - z01.RandIntBetween(0, 1000), + lib.RandIntBetween(0, 1000), + lib.RandIntBetween(0, 1000), }) } for _, arg := range table { - z01.Challenge("Lcm", student.Lcm, correct.Lcm, arg[0], arg[1]) + lib.Challenge("Lcm", student.Lcm, correct.Lcm, arg[0], arg[1]) } } diff --git a/tests/go/func/test_listat.go b/tests/go/func/test_listat.go index a21b9cdd..2c2528ef 100644 --- a/tests/go/func/test_listat.go +++ b/tests/go/func/test_listat.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node5 = student.NodeL @@ -41,11 +40,11 @@ func comparFuncNode5(solutionList *NodeS5, l1 *Node5, l2 *NodeS5, arg int) { return } if l1 != nil && l2 == nil { - z01.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", + lib.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", correct.ListToString(solutionList), arg, l1, l2) } if l1.Data != l2.Data { - z01.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", + lib.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", correct.ListToString(solutionList), arg, l1.Data, l2.Data) } } @@ -64,21 +63,21 @@ func main() { for i := 0; i < 4; i++ { table = append(table, nodeTest{ - data: correct.ConvertIntToInterface(z01.MultRandInt()), - pos: z01.RandIntBetween(1, 12), + data: correct.ConvertIntToInterface(lib.MultRandInt()), + pos: lib.RandIntBetween(1, 12), }) } for i := 0; i < 4; i++ { table = append(table, nodeTest{ - data: correct.ConvertIntToStringface(z01.MultRandWords()), - pos: z01.RandIntBetween(1, 12), + data: correct.ConvertIntToStringface(lib.MultRandWords()), + pos: lib.RandIntBetween(1, 12), }) } table = append(table, nodeTest{ data: []interface{}{"I", 1, "something", 2}, - pos: z01.RandIntBetween(1, 4), + pos: lib.RandIntBetween(1, 4), }) for _, arg := range table { diff --git a/tests/go/func/test_listclear.go b/tests/go/func/test_listclear.go index 3bcb4c35..258bfac6 100644 --- a/tests/go/func/test_listclear.go +++ b/tests/go/func/test_listclear.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node4 = student.NodeL @@ -76,7 +75,7 @@ func main() { student.ListClear(link2) if link2.Head != nil { - z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListClear() == %v instead of %v\n\n", + 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) } } diff --git a/tests/go/func/test_listfind.go b/tests/go/func/test_listfind.go index 6e71b510..f7f4f9e0 100644 --- a/tests/go/func/test_listfind.go +++ b/tests/go/func/test_listfind.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node9 = student.NodeL @@ -57,7 +56,7 @@ func main() { if aux1 != nil || aux2 != nil { if *aux1 != *aux2 { - z01.Fatalf("ListFind(ref: %s) == %s instead of %s\n", arg.Data[(len(arg.Data)-1)/2], *aux1, *aux2) + lib.Fatalf("ListFind(ref: %s) == %s instead of %s\n", arg.Data[(len(arg.Data)-1)/2], *aux1, *aux2) } } } @@ -73,7 +72,7 @@ func main() { aux2 := correct.ListFind(link1, "lksdf", correct.CompStr) if aux1 != nil && aux2 != nil { if *aux1 != *aux2 { - z01.Fatalf("ListFind(ref: lksdf) == %s instead of %s\n", *aux1, *aux2) + lib.Fatalf("ListFind(ref: lksdf) == %s instead of %s\n", *aux1, *aux2) } } } diff --git a/tests/go/func/test_listforeach.go b/tests/go/func/test_listforeach.go index 7aa53f39..15f7f5f6 100644 --- a/tests/go/func/test_listforeach.go +++ b/tests/go/func/test_listforeach.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node7 = student.NodeL @@ -57,11 +56,11 @@ func comparFuncList7(l1 *List7, l2 *ListS7, f func(*Node7)) { funcName := correct.GetName(f) for l1.Head != nil || l2.Head != nil { if (l1.Head == nil && l2.Head != nil) || (l1.Head != nil && l2.Head == nil) { - z01.Fatalf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", + 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) } if l1.Head.Data != l2.Head.Data { - z01.Fatalf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", + 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) } l1.Head = l1.Head.Next diff --git a/tests/go/func/test_listforeachif.go b/tests/go/func/test_listforeachif.go index 4ea72a1f..615aa209 100644 --- a/tests/go/func/test_listforeachif.go +++ b/tests/go/func/test_listforeachif.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node8 = student.NodeL @@ -86,11 +85,11 @@ func comparFuncList8(l1 *List8, l2 *ListS8, f func(*Node8) bool, comp func(*Node funcComp := correct.GetName(comp) for l1.Head != nil || l2.Head != nil { if (l1.Head == nil && l2.Head != nil) || (l1.Head != nil && l2.Head == nil) { - z01.Fatalf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", + 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) } if l1.Head.Data != l2.Head.Data { - z01.Fatalf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", + 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) } l1.Head = l1.Head.Next @@ -113,14 +112,14 @@ func main() { // just numbers/ints for i := 0; i < 3; i++ { val := correct.NodeTest{ - Data: correct.ConvertIntToInterface(z01.MultRandInt()), + Data: correct.ConvertIntToInterface(lib.MultRandInt()), } table = append(table, val) } // just strings for i := 0; i < 3; i++ { val := correct.NodeTest{ - Data: correct.ConvertIntToStringface(z01.MultRandWords()), + Data: correct.ConvertIntToStringface(lib.MultRandWords()), } table = append(table, val) } diff --git a/tests/go/func/test_listlast.go b/tests/go/func/test_listlast.go index a4efa275..71200f82 100644 --- a/tests/go/func/test_listlast.go +++ b/tests/go/func/test_listlast.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node3 = student.NodeL @@ -70,7 +69,7 @@ func main() { aux2 := student.ListLast(link2) if aux1 != aux2 { - z01.Fatalf("\nlist:%s\n\nListLast() == %v instead of %v\n\n", + lib.Fatalf("\nlist:%s\n\nListLast() == %v instead of %v\n\n", listToStringStu9(link2), aux2, aux1) } link1 = &List3{} diff --git a/tests/go/func/test_listmerge.go b/tests/go/func/test_listmerge.go index 6a7c20a4..7266c9d3 100644 --- a/tests/go/func/test_listmerge.go +++ b/tests/go/func/test_listmerge.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node11 = student.NodeL @@ -60,11 +59,11 @@ func listPushBackTest11(l1 *ListS11, l2 *List11, data interface{}) { 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) { - z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", + 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) } if l1.Head.Data != l2.Head.Data { - z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", + 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) } l1.Head = l1.Head.Next @@ -91,22 +90,22 @@ func main() { }) table = append(table, nodeTest{ - data1: correct.ConvertIntToInterface(z01.MultRandInt()), + data1: correct.ConvertIntToInterface(lib.MultRandInt()), data2: []interface{}{}, }) // jut ints for i := 0; i < 3; i++ { val := nodeTest{ - data1: correct.ConvertIntToInterface(z01.MultRandInt()), - data2: correct.ConvertIntToInterface(z01.MultRandInt()), + data1: correct.ConvertIntToInterface(lib.MultRandInt()), + data2: correct.ConvertIntToInterface(lib.MultRandInt()), } table = append(table, val) } // just strings for i := 0; i < 2; i++ { val := nodeTest{ - data1: correct.ConvertIntToStringface(z01.MultRandWords()), - data2: correct.ConvertIntToStringface(z01.MultRandWords()), + data1: correct.ConvertIntToStringface(lib.MultRandWords()), + data2: correct.ConvertIntToStringface(lib.MultRandWords()), } table = append(table, val) } diff --git a/tests/go/func/test_listpushback.go b/tests/go/func/test_listpushback.go index 70eb43b0..c7e53a44 100644 --- a/tests/go/func/test_listpushback.go +++ b/tests/go/func/test_listpushback.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type ListS = correct.List @@ -32,11 +31,11 @@ func listToStringStu10(l *List) string { 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) { - z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", + 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) } if l.Head.Data != l1.Head.Data { - z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", + 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) } l.Head = l.Head.Next diff --git a/tests/go/func/test_listpushfront.go b/tests/go/func/test_listpushfront.go index 22e80e06..c6add4c7 100644 --- a/tests/go/func/test_listpushfront.go +++ b/tests/go/func/test_listpushfront.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type ListSa = correct.List @@ -32,11 +31,11 @@ func listToStringStu11(l *Lista) string { 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) { - z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", + 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) } if l.Head.Data != l1.Head.Data { - z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", + 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) } l1.Head = l1.Head.Next diff --git a/tests/go/func/test_listremoveif.go b/tests/go/func/test_listremoveif.go index bb49e71a..a18a0985 100644 --- a/tests/go/func/test_listremoveif.go +++ b/tests/go/func/test_listremoveif.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node10 = student.NodeL @@ -56,11 +55,11 @@ func listPushBackTest10(l *ListS10, l1 *List10, data interface{}) { 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) { - z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", + 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) } if l.Head.Data != l1.Head.Data { - z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", + 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) } l.Head = l.Head.Next @@ -89,7 +88,7 @@ func main() { } aux := len(arg.Data) - 1 - index = z01.RandIntBetween(0, aux) + index = lib.RandIntBetween(0, aux) if link1.Head != nil && link2.Head != nil { cho := arg.Data[index] student.ListRemoveIf(link2, cho) diff --git a/tests/go/func/test_listreverse.go b/tests/go/func/test_listreverse.go index 5b5a1c5a..777d2513 100644 --- a/tests/go/func/test_listreverse.go +++ b/tests/go/func/test_listreverse.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node6 = student.NodeL @@ -33,11 +32,11 @@ func listToStringStu13(l *ListS6) string { 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) { - z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", + 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) } if l.Head.Data != l1.Head.Data { - z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", + 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) } l.Head = l.Head.Next diff --git a/tests/go/func/test_listsize.go b/tests/go/func/test_listsize.go index aaec5e11..61a9b83d 100644 --- a/tests/go/func/test_listsize.go +++ b/tests/go/func/test_listsize.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type Node2 = student.NodeL @@ -53,7 +52,7 @@ func main() { aux := correct.ListSize(link) aux2 := student.ListSize(link2) if aux != aux2 { - z01.Fatalf("ListSize(%v) == %d instead of %d\n", correct.ListToString(link.Head), aux2, aux) + lib.Fatalf("ListSize(%v) == %d instead of %d\n", correct.ListToString(link.Head), aux2, aux) } link = &List2{} link2 = &ListS2{} diff --git a/tests/go/func/test_listsort.go b/tests/go/func/test_listsort.go index f5bbdfe3..20ffdc93 100644 --- a/tests/go/func/test_listsort.go +++ b/tests/go/func/test_listsort.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type NodeI12 = student.NodeI @@ -51,11 +50,11 @@ func nodePushBackListInt12(l1 *NodeI12, l2 *NodeIS12, data int) { func comparFuncNodeInt12(l1 *NodeI12, l2 *NodeIS12) { for l1 != nil || l2 != nil { if (l1 == nil && l2 != nil) || (l1 != nil && l2 == nil) { - z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", + lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", printListStudent(l1), correct.PrintList(l2), l1, l2) } if l1.Data != l2.Data { - z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", + lib.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", printListStudent(l1), correct.PrintList(l2), l1.Data, l2.Data) } l1 = l1.Next @@ -75,7 +74,7 @@ func main() { // just numbers/ints for i := 0; i < 2; i++ { - table = append(table, nodeTest{z01.MultRandInt()}) + table = append(table, nodeTest{lib.MultRandInt()}) } table = append(table, nodeTest{[]int{5, 4, 3, 2, 1}}) diff --git a/tests/go/func/test_makerange.go b/tests/go/func/test_makerange.go index e0cca18a..d5156a24 100644 --- a/tests/go/func/test_makerange.go +++ b/tests/go/func/test_makerange.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -17,8 +16,8 @@ func main() { // 15 random pairs of ints for a Valid Range for i := 0; i < 15; i++ { - minVal := z01.RandIntBetween(-10000000, 1000000) - gap := z01.RandIntBetween(1, 20) + minVal := lib.RandIntBetween(-10000000, 1000000) + gap := lib.RandIntBetween(1, 20) val := node{ min: minVal, max: minVal + gap, @@ -27,8 +26,8 @@ func main() { } // 15 random pairs of ints with ||invalid range|| for i := 0; i < 15; i++ { - minVal := z01.RandIntBetween(-10000000, 1000000) - gap := z01.RandIntBetween(1, 20) + minVal := lib.RandIntBetween(-10000000, 1000000) + gap := lib.RandIntBetween(1, 20) val := node{ min: minVal, max: minVal - gap, @@ -43,6 +42,6 @@ func main() { node{min: 10, max: 5}, ) for _, arg := range table { - z01.Challenge("MakeRange", student.MakeRange, correct.MakeRange, arg.min, arg.max) + lib.Challenge("MakeRange", student.MakeRange, correct.MakeRange, arg.min, arg.max) } } diff --git a/tests/go/func/test_map.go b/tests/go/func/test_map.go index fa0ef402..8beac636 100644 --- a/tests/go/func/test_map.go +++ b/tests/go/func/test_map.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -18,10 +17,10 @@ func main() { table := []node{} for i := 0; i < 15; i++ { - function := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[lib.RandIntBetween(0, len(functions)-1)] val := node{ f: function, - arr: z01.MultRandIntBetween(-1000000, 1000000), + arr: lib.MultRandIntBetween(-1000000, 1000000), } table = append(table, val) } @@ -32,6 +31,6 @@ func main() { }) for _, arg := range table { - z01.Challenge("Map", student.Map, correct.Map, arg.f, arg.arr) + lib.Challenge("Map", student.Map, correct.Map, arg.f, arg.arr) } } diff --git a/tests/go/func/test_max.go b/tests/go/func/test_max.go index 7cd55e0f..828e41d4 100644 --- a/tests/go/func/test_max.go +++ b/tests/go/func/test_max.go @@ -1,18 +1,17 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - args := []int{z01.RandInt()} - limit := z01.RandIntBetween(20, 50) + args := []int{lib.RandInt()} + limit := lib.RandIntBetween(20, 50) for i := 0; i < limit; i++ { - args = append(args, z01.RandInt()) + args = append(args, lib.RandInt()) } - z01.Challenge("Max", student.Max, correct.Max, args) + lib.Challenge("Max", student.Max, correct.Max, args) } diff --git a/tests/go/func/test_merge.go b/tests/go/func/test_merge.go index 9b044bbd..226838a7 100644 --- a/tests/go/func/test_merge.go +++ b/tests/go/func/test_merge.go @@ -4,9 +4,8 @@ import ( "math/rand" "strconv" - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) type stuTreeNode = TreeNodeM @@ -147,7 +146,7 @@ func compareTrees(stuResult *stuTreeNode, solResult, solTree1, solTree2 *solTree tree2 := returnSolTree(solTree2) stuTree := returnStuTree(stuResult) solTree := returnSolTree(solResult) - z01.Fatalf("\nMergeTrees(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuTree, solTree) + lib.Fatalf("\nMergeTrees(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuTree, solTree) } } @@ -159,7 +158,7 @@ func main() { table := []node{} for i := 0; i < 15; i++ { - value := node{z01.RandIntBetween(10, 15), z01.RandIntBetween(1, 10)} + value := node{lib.RandIntBetween(10, 15), lib.RandIntBetween(1, 10)} table = append(table, value) } for _, arg := range table { diff --git a/tests/go/func/test_nauuo.go b/tests/go/func/test_nauuo.go index 4c3e5630..de339b9e 100644 --- a/tests/go/func/test_nauuo.go +++ b/tests/go/func/test_nauuo.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -22,12 +21,12 @@ func main() { for i := 0; i < 15; i++ { table = append(table, node{ - plus: z01.RandIntBetween(0, 10), - minus: z01.RandIntBetween(0, 10), - rand: z01.RandIntBetween(0, 10), + plus: lib.RandIntBetween(0, 10), + minus: lib.RandIntBetween(0, 10), + rand: lib.RandIntBetween(0, 10), }) } for _, arg := range table { - z01.Challenge("Nauuo", student.Nauuo, correct.Nauuo, arg.plus, arg.minus, arg.rand) + lib.Challenge("Nauuo", student.Nauuo, correct.Nauuo, arg.plus, arg.minus, arg.rand) } } diff --git a/tests/go/func/test_nrune.go b/tests/go/func/test_nrune.go index fa8a01df..bba8e86f 100644 --- a/tests/go/func/test_nrune.go +++ b/tests/go/func/test_nrune.go @@ -3,10 +3,9 @@ package main import ( "math/rand" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -18,7 +17,7 @@ func main() { table := []node{} for i := 0; i < 30; i++ { - wordToInput := z01.RandASCII() + wordToInput := lib.RandASCII() val := node{ word: wordToInput, n: rand.Intn(len(wordToInput)) + 1, @@ -39,6 +38,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("NRune", student.NRune, correct.NRune, arg.word, arg.n) + lib.Challenge("NRune", student.NRune, correct.NRune, arg.word, arg.n) } } diff --git a/tests/go/func/test_pointone.go b/tests/go/func/test_pointone.go index 7fc590e2..a6d9c187 100644 --- a/tests/go/func/test_pointone.go +++ b/tests/go/func/test_pointone.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - student "./student" + "../lib" + "./student" ) func main() { n := 0 student.PointOne(&n) if n != 1 { - z01.Fatalf("PointOne(&n), n == %d instead of 1\n", n) + lib.Fatalf("PointOne(&n), n == %d instead of 1\n", n) } } diff --git a/tests/go/func/test_printcomb.go b/tests/go/func/test_printcomb.go index 9213ab7c..9f9a440a 100644 --- a/tests/go/func/test_printcomb.go +++ b/tests/go/func/test_printcomb.go @@ -1,12 +1,11 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - z01.Challenge("PrintComb", student.PrintComb, correct.PrintComb) + lib.Challenge("PrintComb", student.PrintComb, correct.PrintComb) } diff --git a/tests/go/func/test_printcomb2.go b/tests/go/func/test_printcomb2.go index a680946c..0013a15c 100644 --- a/tests/go/func/test_printcomb2.go +++ b/tests/go/func/test_printcomb2.go @@ -1,12 +1,11 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - z01.Challenge("PrintComb2", student.PrintComb2, correct.PrintComb2) + lib.Challenge("PrintComb2", student.PrintComb2, correct.PrintComb2) } diff --git a/tests/go/func/test_printcombn.go b/tests/go/func/test_printcombn.go index 3468d761..1bc8bff9 100644 --- a/tests/go/func/test_printcombn.go +++ b/tests/go/func/test_printcombn.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := []int{1, 2, 3, 4, 5, 6, 7, 8, 9} for _, arg := range table { - z01.Challenge("PrintCombN", student.PrintCombN, correct.PrintCombN, arg) + lib.Challenge("PrintCombN", student.PrintCombN, correct.PrintCombN, arg) } } diff --git a/tests/go/func/test_printmemory.go b/tests/go/func/test_printmemory.go index 2cb04225..cae98caa 100644 --- a/tests/go/func/test_printmemory.go +++ b/tests/go/func/test_printmemory.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -12,12 +11,12 @@ func main() { for j := 0; j < 5; j++ { for i := 0; i < 10; i++ { - table[i] = z01.RandIntBetween(0, 1000) + table[i] = lib.RandIntBetween(0, 1000) } - z01.Challenge("PrintMemory", student.PrintMemory, correct.PrintMemory, table) + lib.Challenge("PrintMemory", student.PrintMemory, correct.PrintMemory, table) } table2 := [10]int{104, 101, 108, 108, 111, 16, 21, 42} - z01.Challenge("PrintMemory", student.PrintMemory, correct.PrintMemory, table2) + lib.Challenge("PrintMemory", student.PrintMemory, correct.PrintMemory, table2) } // TODO: this can be simplified a lot diff --git a/tests/go/func/test_printnbr.go b/tests/go/func/test_printnbr.go index 532e59d6..5a86388b 100644 --- a/tests/go/func/test_printnbr.go +++ b/tests/go/func/test_printnbr.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandInt(), - z01.MinInt, - z01.MaxInt, + lib.MultRandInt(), + lib.MinInt, + lib.MaxInt, 0, ) for _, arg := range table { - z01.Challenge("PrintNbr", student.PrintNbr, correct.PrintNbr, arg) + lib.Challenge("PrintNbr", student.PrintNbr, correct.PrintNbr, arg) } } diff --git a/tests/go/func/test_printnbrbase.go b/tests/go/func/test_printnbrbase.go index 37c5c9a1..d9204576 100644 --- a/tests/go/func/test_printnbrbase.go +++ b/tests/go/func/test_printnbrbase.go @@ -1,12 +1,10 @@ package main import ( - "github.com/01-edu/z01" - + "../lib" "./base" - - correct "./correct" - student "./student" + "./correct" + "./student" ) func main() { @@ -21,7 +19,7 @@ func main() { for i := 0; i < 15; i++ { validBaseToInput := base.Valid() val := node{ - n: z01.RandIntBetween(-1000000, 1000000), + n: lib.RandIntBetween(-1000000, 1000000), base: validBaseToInput, } table = append(table, val) @@ -31,7 +29,7 @@ func main() { for i := 0; i < 15; i++ { invalidBaseToInput := base.Invalid() val := node{ - n: z01.RandIntBetween(-1000000, 1000000), + n: lib.RandIntBetween(-1000000, 1000000), base: invalidBaseToInput, } table = append(table, val) @@ -43,10 +41,10 @@ func main() { node{n: 125, base: "0123456789ABCDEF"}, node{n: -125, base: "choumi"}, node{n: 125, base: "-ab"}, - node{n: z01.MinInt, base: "0123456789"}, + node{n: lib.MinInt, base: "0123456789"}, ) for _, arg := range table { - z01.Challenge("PrintNbrBase", student.PrintNbrBase, correct.PrintNbrBase, arg.n, arg.base) + lib.Challenge("PrintNbrBase", student.PrintNbrBase, correct.PrintNbrBase, arg.n, arg.base) } } diff --git a/tests/go/func/test_printnbrinorder.go b/tests/go/func/test_printnbrinorder.go index 54fa1f0b..4d78c858 100644 --- a/tests/go/func/test_printnbrinorder.go +++ b/tests/go/func/test_printnbrinorder.go @@ -1,21 +1,20 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandIntBetween(0, z01.MaxInt), - z01.MaxInt, + lib.MultRandIntBetween(0, lib.MaxInt), + lib.MaxInt, 321, 321321, 0, ) for _, arg := range table { - z01.Challenge("PrintNbrInOrder", student.PrintNbrInOrder, correct.PrintNbrInOrder, arg) + lib.Challenge("PrintNbrInOrder", student.PrintNbrInOrder, correct.PrintNbrInOrder, arg) } } diff --git a/tests/go/func/test_printstr.go b/tests/go/func/test_printstr.go index 806840d4..70aa45b1 100644 --- a/tests/go/func/test_printstr.go +++ b/tests/go/func/test_printstr.go @@ -1,16 +1,15 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - table := z01.MultRandASCII() + table := lib.MultRandASCII() table = append(table, "Hello World!") for _, arg := range table { - z01.Challenge("PrintStr", student.PrintStr, correct.PrintStr, arg) + lib.Challenge("PrintStr", student.PrintStr, correct.PrintStr, arg) } } diff --git a/tests/go/func/test_printwordstables.go b/tests/go/func/test_printwordstables.go index fab88b79..70b53066 100644 --- a/tests/go/func/test_printwordstables.go +++ b/tests/go/func/test_printwordstables.go @@ -3,10 +3,9 @@ package main import ( "strings" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -14,7 +13,7 @@ func main() { // 30 random slice of slice of strings for i := 0; i < 30; i++ { - val := correct.SplitWhiteSpaces(strings.Join(z01.MultRandASCII(), " ")) + val := correct.SplitWhiteSpaces(strings.Join(lib.MultRandASCII(), " ")) table = append(table, val) } @@ -22,6 +21,6 @@ func main() { []string{"Hello", "how", "are", "you?"}) for _, arg := range table { - z01.Challenge("PrintWordsTables", student.PrintWordsTables, correct.PrintWordsTables, arg) + lib.Challenge("PrintWordsTables", student.PrintWordsTables, correct.PrintWordsTables, arg) } } diff --git a/tests/go/func/test_priorprime.go b/tests/go/func/test_priorprime.go index f9ed788e..df139e2e 100644 --- a/tests/go/func/test_priorprime.go +++ b/tests/go/func/test_priorprime.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -16,8 +15,8 @@ func main() { 1, 2, } - table = append(table, z01.MultRandIntBetween(0, 1000)) + table = append(table, lib.MultRandIntBetween(0, 1000)) for _, arg := range table { - z01.Challenge("PriorPrime", student.PriorPrime, correct.PriorPrime, arg) + lib.Challenge("PriorPrime", student.PriorPrime, correct.PriorPrime, arg) } } diff --git a/tests/go/func/test_raid1a.go b/tests/go/func/test_raid1a.go index 38dc4a5c..25d38817 100644 --- a/tests/go/func/test_raid1a.go +++ b/tests/go/func/test_raid1a.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -21,13 +20,13 @@ func main() { 0, 0, -1, 6, 6, -1, - z01.RandIntBetween(1, 20), z01.RandIntBetween(1, 20), + lib.RandIntBetween(1, 20), lib.RandIntBetween(1, 20), ) // Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i += 2 { if i != len(table)-1 { - z01.Challenge("Raid1a", correct.Raid1a, student.Raid1a, table[i], table[i+1]) + lib.Challenge("Raid1a", correct.Raid1a, student.Raid1a, table[i], table[i+1]) } } } diff --git a/tests/go/func/test_raid1b.go b/tests/go/func/test_raid1b.go index 021591a9..47350347 100644 --- a/tests/go/func/test_raid1b.go +++ b/tests/go/func/test_raid1b.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -21,13 +20,13 @@ func main() { 0, 0, -1, 6, 6, -1, - z01.RandIntBetween(1, 20), z01.RandIntBetween(1, 20), + lib.RandIntBetween(1, 20), lib.RandIntBetween(1, 20), ) // Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i += 2 { if i != len(table)-1 { - z01.Challenge("Raid1b", correct.Raid1b, student.Raid1b, table[i], table[i+1]) + lib.Challenge("Raid1b", correct.Raid1b, student.Raid1b, table[i], table[i+1]) } } } diff --git a/tests/go/func/test_raid1c.go b/tests/go/func/test_raid1c.go index cf493c23..03ff4acd 100644 --- a/tests/go/func/test_raid1c.go +++ b/tests/go/func/test_raid1c.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -21,13 +20,13 @@ func main() { 0, 0, -1, 6, 6, -1, - z01.RandIntBetween(1, 20), z01.RandIntBetween(1, 20), + lib.RandIntBetween(1, 20), lib.RandIntBetween(1, 20), ) // Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i += 2 { if i != len(table)-1 { - z01.Challenge("Raid1c", correct.Raid1c, student.Raid1c, table[i], table[i+1]) + lib.Challenge("Raid1c", correct.Raid1c, student.Raid1c, table[i], table[i+1]) } } } diff --git a/tests/go/func/test_raid1d.go b/tests/go/func/test_raid1d.go index 61ecccb5..78485cfd 100644 --- a/tests/go/func/test_raid1d.go +++ b/tests/go/func/test_raid1d.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -21,13 +20,13 @@ func main() { 0, 0, -1, 6, 6, -1, - z01.RandIntBetween(1, 20), z01.RandIntBetween(1, 20), + lib.RandIntBetween(1, 20), lib.RandIntBetween(1, 20), ) // Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i += 2 { if i != len(table)-1 { - z01.Challenge("Raid1d", correct.Raid1d, student.Raid1d, table[i], table[i+1]) + lib.Challenge("Raid1d", correct.Raid1d, student.Raid1d, table[i], table[i+1]) } } } diff --git a/tests/go/func/test_raid1e.go b/tests/go/func/test_raid1e.go index 90ffcfd6..845538ba 100644 --- a/tests/go/func/test_raid1e.go +++ b/tests/go/func/test_raid1e.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -21,13 +20,13 @@ func main() { 0, 0, -1, 6, 6, -1, - z01.RandIntBetween(1, 20), z01.RandIntBetween(1, 20), + lib.RandIntBetween(1, 20), lib.RandIntBetween(1, 20), ) // Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i += 2 { if i != len(table)-1 { - z01.Challenge("Raid1e", correct.Raid1e, student.Raid1e, table[i], table[i+1]) + lib.Challenge("Raid1e", correct.Raid1e, student.Raid1e, table[i], table[i+1]) } } } diff --git a/tests/go/func/test_reachablenumber.go b/tests/go/func/test_reachablenumber.go index 9b06ea09..f568b96c 100644 --- a/tests/go/func/test_reachablenumber.go +++ b/tests/go/func/test_reachablenumber.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -15,9 +14,9 @@ func main() { 2, } for i := 0; i < 25; i++ { - table = append(table, z01.MultRandIntBetween(1, 877)) + table = append(table, lib.MultRandIntBetween(1, 877)) } for _, arg := range table { - z01.Challenge("ReachableNumber", student.ReachableNumber, correct.ReachableNumber, arg) + lib.Challenge("ReachableNumber", student.ReachableNumber, correct.ReachableNumber, arg) } } diff --git a/tests/go/func/test_recursivefactorial.go b/tests/go/func/test_recursivefactorial.go index dd3e9483..c37d7aae 100644 --- a/tests/go/func/test_recursivefactorial.go +++ b/tests/go/func/test_recursivefactorial.go @@ -3,21 +3,20 @@ package main import ( "math/bits" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandInt(), - z01.IntRange(0, 12)..., + lib.MultRandInt(), + lib.IntRange(0, 12)..., ) if bits.UintSize == 64 { - table = append(table, z01.IntRange(13, 20)...) + table = append(table, lib.IntRange(13, 20)...) } for _, arg := range table { - z01.Challenge("RecursiveFactorial", student.RecursiveFactorial, correct.RecursiveFactorial, arg) + lib.Challenge("RecursiveFactorial", student.RecursiveFactorial, correct.RecursiveFactorial, arg) } } diff --git a/tests/go/func/test_recursivepower.go b/tests/go/func/test_recursivepower.go index 1b62c1dc..c2f895a0 100644 --- a/tests/go/func/test_recursivepower.go +++ b/tests/go/func/test_recursivepower.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { i := 0 for i < 30 { - nb := z01.RandIntBetween(-8, 8) - power := z01.RandIntBetween(-10, 10) - z01.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, nb, power) + nb := lib.RandIntBetween(-8, 8) + power := lib.RandIntBetween(-10, 10) + lib.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, nb, power) i++ } - z01.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 0) - z01.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 1) + lib.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 0) + lib.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 1) } diff --git a/tests/go/func/test_reduceint.go b/tests/go/func/test_reduceint.go index 3d8ad968..fdbb34d1 100644 --- a/tests/go/func/test_reduceint.go +++ b/tests/go/func/test_reduceint.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -28,7 +27,7 @@ func main() { table := []node{} for i := 0; i < 4; i++ { - argInt = z01.MultRandIntBetween(0, 50) + argInt = lib.MultRandIntBetween(0, 50) table = append(table, node{ a: argInt, functions: f, @@ -37,7 +36,7 @@ func main() { for _, v := range table { for _, f := range v.functions { - z01.Challenge("ReduceInt", student.ReduceInt, correct.ReduceInt, f, v.a) + lib.Challenge("ReduceInt", student.ReduceInt, correct.ReduceInt, f, v.a) } } } diff --git a/tests/go/func/test_reverse.go b/tests/go/func/test_reverse.go index 1f709964..8ef9ce68 100644 --- a/tests/go/func/test_reverse.go +++ b/tests/go/func/test_reverse.go @@ -1,9 +1,8 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) type stuNode = NodeAddL @@ -62,16 +61,16 @@ func compareNodes(stuResult *stuNode, solResult *solNode, num1 int) { stuNum := stuListToNum(stuResult) solNum := solListToNum(solResult) if stuNum != solNum { - z01.Fatalf("\nReverse(%d) == %v instead of %v\n\n", + lib.Fatalf("\nReverse(%d) == %v instead of %v\n\n", num1, stuNum, solNum) } } else if stuResult != nil && solResult == nil { stuNum := stuListToNum(stuResult) - z01.Fatalf("\nReverse(%d) == %v instead of %v\n\n", + lib.Fatalf("\nReverse(%d) == %v instead of %v\n\n", num1, stuNum, "") } else if stuResult == nil && solResult != nil { solNum := solListToNum(solResult) - z01.Fatalf("\nReverse(%d) == %v instead of %v\n\n", + lib.Fatalf("\nReverse(%d) == %v instead of %v\n\n", num1, "", solNum) } } @@ -79,7 +78,7 @@ func compareNodes(stuResult *stuNode, solResult *solNode, num1 int) { func main() { table := []int{123456543} - table = append(table, z01.MultRandIntBetween(0, 1000000000)...) + table = append(table, lib.MultRandIntBetween(0, 1000000000)...) for _, arg := range table { stuResult := Reverse(stuNumToList(arg)) solResult := correct.Reverse(solNumToList(arg)) diff --git a/tests/go/func/test_reversebits.go b/tests/go/func/test_reversebits.go index a01fdca4..f2890fe2 100644 --- a/tests/go/func/test_reversebits.go +++ b/tests/go/func/test_reversebits.go @@ -3,16 +3,15 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) func challengeBytes(fn1, fn2 interface{}, args ...interface{}) { - st1 := z01.Monitor(fn1, args) - st2 := z01.Monitor(fn2, args) + st1 := lib.Monitor(fn1, args) + st2 := lib.Monitor(fn2, args) if !reflect.DeepEqual(st1.Results, st2.Results) { - z01.Fatalf("%s(%08b) == %08b instead of %08b\n", + lib.Fatalf("%s(%08b) == %08b instead of %08b\n", "ReverseBits", args[0].(byte), st1.Results[0].(byte), @@ -25,7 +24,7 @@ func main() { args := []byte{0x26, 0x27, 0x28, 0x29, 0xAA, 0xBB} for i := 0; i < 10; i++ { - n := z01.RandIntBetween(0, 255) + n := lib.RandIntBetween(0, 255) args = append(args, byte(n)) } diff --git a/tests/go/func/test_revivethreenums.go b/tests/go/func/test_revivethreenums.go index 098f6711..b634b401 100644 --- a/tests/go/func/test_revivethreenums.go +++ b/tests/go/func/test_revivethreenums.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -15,9 +14,9 @@ func main() { } for i := 0; i < 25; i++ { - first := z01.RandIntBetween(0, 877) - second := z01.RandIntBetween(0, 877) - third := z01.RandIntBetween(0, 877) + first := lib.RandIntBetween(0, 877) + second := lib.RandIntBetween(0, 877) + third := lib.RandIntBetween(0, 877) table = append(table, [4]int{ first + second, second + third, @@ -26,6 +25,6 @@ func main() { }) } for _, arg := range table { - z01.Challenge("Revivethreenums", student.ReviveThreeNums, correct.ReviveThreeNums, arg[0], arg[1], arg[2], arg[3]) + lib.Challenge("Revivethreenums", student.ReviveThreeNums, correct.ReviveThreeNums, arg[0], arg[1], arg[2], arg[3]) } } diff --git a/tests/go/func/test_rot14.go b/tests/go/func/test_rot14.go index 61d29d9f..8dcf4681 100644 --- a/tests/go/func/test_rot14.go +++ b/tests/go/func/test_rot14.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -15,14 +14,14 @@ func main() { table := []nodeTest{} for i := 0; i < 5; i++ { val := nodeTest{ - data: z01.MultRandWords(), + data: lib.MultRandWords(), } table = append(table, val) } for _, arg := range table { for _, s := range arg.data { - z01.Challenge("Rot14", correct.Rot14, student.Rot14, s) + lib.Challenge("Rot14", correct.Rot14, student.Rot14, s) } } } diff --git a/tests/go/func/test_sametree.go b/tests/go/func/test_sametree.go index fdd3518d..1417f5af 100644 --- a/tests/go/func/test_sametree.go +++ b/tests/go/func/test_sametree.go @@ -4,9 +4,8 @@ import ( "math/rand" "strconv" - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) type stuTreeNode = TreeNodeL @@ -86,7 +85,7 @@ func compareResults(stuResult, solResult bool, solTree1, solTree2 *solTreeNode) if stuResult != solResult { tree1 := returnSolTree(solTree1) tree2 := returnSolTree(solTree2) - z01.Fatalf("\nIsSameTree(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuResult, solResult) + lib.Fatalf("\nIsSameTree(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuResult, solResult) } } @@ -98,7 +97,7 @@ func main() { table := []node{} for i := 0; i < 15; i++ { - value := node{z01.RandIntBetween(10, 15), z01.RandIntBetween(1, 10)} + value := node{lib.RandIntBetween(10, 15), lib.RandIntBetween(1, 10)} table = append(table, value) } diff --git a/tests/go/func/test_slice.go b/tests/go/func/test_slice.go index 02d32098..74dd9339 100644 --- a/tests/go/func/test_slice.go +++ b/tests/go/func/test_slice.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -31,16 +30,16 @@ func main() { }, } - s := z01.MultRandWords() + s := lib.MultRandWords() arr = append(arr, []interface{}{s, -len(s) - 10, -len(s) - 5}) for i := 0; i < 3; i++ { - s = z01.MultRandWords() - arr = append(arr, []interface{}{s, z01.RandIntBetween(-len(s)-10, len(s)+10), z01.RandIntBetween(-len(s)-8, len(s)+10)}) + s = lib.MultRandWords() + arr = append(arr, []interface{}{s, lib.RandIntBetween(-len(s)-10, len(s)+10), lib.RandIntBetween(-len(s)-8, len(s)+10)}) } for _, a := range arr { - z01.Challenge("Slice", student.Slice, correct.Slice, a...) + lib.Challenge("Slice", student.Slice, correct.Slice, a...) } } diff --git a/tests/go/func/test_sortedlistmerge.go b/tests/go/func/test_sortedlistmerge.go index ae5db063..23837363 100644 --- a/tests/go/func/test_sortedlistmerge.go +++ b/tests/go/func/test_sortedlistmerge.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type NodeI13 = student.NodeI @@ -65,8 +64,8 @@ func main() { for i := 0; i < 3; i++ { val := nodeTest{ - data1: z01.MultRandInt(), - data2: z01.MultRandInt(), + data1: lib.MultRandInt(), + data2: lib.MultRandInt(), } table = append(table, val) } @@ -94,10 +93,10 @@ func main() { if aux1 == nil && aux2 == nil { } else if aux1 != nil && aux2 == nil { - z01.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", + lib.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", printListStudent1(aux1), correct.PrintList(aux2), aux1, aux2) } else if aux1.Data != aux2.Data { - z01.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", + lib.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", printListStudent1(aux1), correct.PrintList(aux2), aux1, aux2) } diff --git a/tests/go/func/test_sortintegertable.go b/tests/go/func/test_sortintegertable.go index 4682bf00..ecaf7af3 100644 --- a/tests/go/func/test_sortintegertable.go +++ b/tests/go/func/test_sortintegertable.go @@ -3,16 +3,15 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { i := 0 - for i < z01.SliceLen { - table1 := z01.MultRandIntBetween(-100, 100) + for i < lib.SliceLen { + table1 := lib.MultRandIntBetween(-100, 100) tableCopyBefore := make([]int, len(table1)) copy(tableCopyBefore, table1) @@ -23,7 +22,7 @@ func main() { student.SortIntegerTable(table1) correct.SortIntegerTable(table2) if !reflect.DeepEqual(table1, table2) { - z01.Fatalf("SortIntegerTable(%v), table1 == %v instead of %v ", tableCopyBefore, table1, table2) + lib.Fatalf("SortIntegerTable(%v), table1 == %v instead of %v ", tableCopyBefore, table1, table2) } i++ } diff --git a/tests/go/func/test_sortlist.go b/tests/go/func/test_sortlist.go index 24985626..6cfa143c 100644 --- a/tests/go/func/test_sortlist.go +++ b/tests/go/func/test_sortlist.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func listToString4(n *correct.Nodelist) (res string) { @@ -72,7 +71,7 @@ func compare(l2 *correct.Nodelist, l1 *student.Nodelist, f func(a, b int) bool) for l1 != nil && l2 != nil { if l1.Data != l2.Data { - z01.Fatalf("\nstudent list:%s\nlist:%s\nfunction cmp:%s\n\nSortListInsert() == %v instead of %v\n\n", + lib.Fatalf("\nstudent list:%s\nlist:%s\nfunction cmp:%s\n\nSortListInsert() == %v instead of %v\n\n", listToStringStu4(l1), listToString4(l2), cmp, l1.Data, l2.Data) return } @@ -94,7 +93,7 @@ func main() { for i := 0; i < 4; i++ { table = append(table, nodeTest{ - data: z01.MultRandIntBetween(1, 1234), + data: lib.MultRandIntBetween(1, 1234), functions: []func(a, b int) bool{ascending, descending}, }) } diff --git a/tests/go/func/test_sortlistinsert.go b/tests/go/func/test_sortlistinsert.go index dcd45ad3..e1700a04 100644 --- a/tests/go/func/test_sortlistinsert.go +++ b/tests/go/func/test_sortlistinsert.go @@ -3,10 +3,9 @@ package main import ( "strconv" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) type NodeI14 = student.NodeI @@ -54,11 +53,11 @@ func nodepushback2(l *NodeIS14, data int) *NodeIS14 { func comparFuncNodeInt14(l1 *NodeI14, l2 *NodeIS14, data []int) { for l1 != nil || l2 != nil { if (l1 == nil && l2 != nil) || (l1 != nil && l2 == nil) { - z01.Fatalf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", + 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) } if l1.Data != l2.Data { - z01.Fatalf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", + 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) } l1 = l1.Next @@ -108,14 +107,14 @@ func main() { for i := 0; i < 2; i++ { table = append(table, nodeTest{ - data: z01.MultRandInt(), - data_ref: z01.MultRandInt(), + data: lib.MultRandInt(), + data_ref: lib.MultRandInt(), }) } table = append(table, nodeTest{ data: []int{5, 4, 3, 2, 1}, - data_ref: z01.MultRandInt(), + data_ref: lib.MultRandInt(), }, ) for _, arg := range table { diff --git a/tests/go/func/test_sortll.go b/tests/go/func/test_sortll.go index 7c6c45eb..c59cb4fc 100644 --- a/tests/go/func/test_sortll.go +++ b/tests/go/func/test_sortll.go @@ -1,9 +1,8 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" + "../lib" + "./correct" ) type stuNode = NodeAddL @@ -63,25 +62,25 @@ func compareNodes(stuResult *stuNode, solResult *solNode, num1 int) { } if stuResult != nil && solResult == nil { stuNum := stuListToNum(stuResult) - z01.Fatalf("\nSortll(%d) == %v instead of %v\n\n", + lib.Fatalf("\nSortll(%d) == %v instead of %v\n\n", num1, stuNum, "") } if stuResult == nil && solResult != nil { solNum := solListToNum(solResult) - z01.Fatalf("\nSortll(%d) == %v instead of %v\n\n", + lib.Fatalf("\nSortll(%d) == %v instead of %v\n\n", num1, "", solNum) } stuNum := stuListToNum(stuResult) solNum := solListToNum(solResult) if stuNum != solNum { - z01.Fatalf("\nSortll(%d) == %v instead of %v\n\n", + lib.Fatalf("\nSortll(%d) == %v instead of %v\n\n", num1, stuNum, solNum) } } func main() { table := []int{123456} - table = append(table, z01.MultRandIntBetween(0, 1000000000)...) + table = append(table, lib.MultRandIntBetween(0, 1000000000)...) for _, arg := range table { stuResult := Sortll(stuNumToList(arg)) solResult := correct.Sortll(solNumToList(arg)) diff --git a/tests/go/func/test_sortwordarr.go b/tests/go/func/test_sortwordarr.go index 462136e9..220606cc 100644 --- a/tests/go/func/test_sortwordarr.go +++ b/tests/go/func/test_sortwordarr.go @@ -3,17 +3,16 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := [][]string{{"a", "A", "1", "b", "B", "2", "c", "C", "3"}} for i := 0; i < 15; i++ { - table = append(table, z01.MultRandWords()) + table = append(table, lib.MultRandWords()) } for _, org := range table { @@ -29,7 +28,7 @@ func main() { student.SortWordArr(cp_stu) if !reflect.DeepEqual(cp_stu, cp_sol) { - z01.Fatalf("%s(%v) == %v instead of %v\n", + lib.Fatalf("%s(%v) == %v instead of %v\n", "SortWordArr", org, cp_stu, diff --git a/tests/go/func/test_split.go b/tests/go/func/test_split.go index dc8002b2..01530664 100644 --- a/tests/go/func/test_split.go +++ b/tests/go/func/test_split.go @@ -4,10 +4,9 @@ import ( "math/rand" "strings" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -16,7 +15,7 @@ func main() { " ", "|=choumi=|", "|<=>|", - z01.RandStr(3, z01.RuneRange('A', 'Z')), + lib.RandStr(3, lib.RuneRange('A', 'Z')), "<<==123==>>", "[<>abc<>]"} @@ -30,7 +29,7 @@ func main() { for i := 0; i < 15; i++ { separator := separators[rand.Intn(len(separators))] val := node{ - str: strings.Join(z01.MultRandAlnum(), separator), + str: strings.Join(lib.MultRandAlnum(), separator), sep: separator, } table = append(table, val) @@ -40,6 +39,6 @@ func main() { node{str: "HelloHAhowHAareHAyou?", sep: "HA"}) for _, arg := range table { - z01.Challenge("Split", student.Split, correct.Split, arg.str, arg.sep) + lib.Challenge("Split", student.Split, correct.Split, arg.str, arg.sep) } } diff --git a/tests/go/func/test_splitwhitespaces.go b/tests/go/func/test_splitwhitespaces.go index 2dd3c019..b99b9571 100644 --- a/tests/go/func/test_splitwhitespaces.go +++ b/tests/go/func/test_splitwhitespaces.go @@ -3,10 +3,9 @@ package main import ( "strings" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -14,7 +13,7 @@ func main() { // 30 random slice of strings for i := 0; i < 30; i++ { - val := strings.Join(z01.MultRandASCII(), " ") + val := strings.Join(lib.MultRandASCII(), " ") table = append(table, val) } @@ -22,6 +21,6 @@ func main() { "Hello how are you?") for _, arg := range table { - z01.Challenge("SplitWhiteSpaces", student.SplitWhiteSpaces, correct.SplitWhiteSpaces, arg) + lib.Challenge("SplitWhiteSpaces", student.SplitWhiteSpaces, correct.SplitWhiteSpaces, arg) } } diff --git a/tests/go/func/test_sqrt.go b/tests/go/func/test_sqrt.go index d1b53432..bb899d13 100644 --- a/tests/go/func/test_sqrt.go +++ b/tests/go/func/test_sqrt.go @@ -1,15 +1,14 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandIntBetween(-1000000, 1000000), + lib.MultRandIntBetween(-1000000, 1000000), 0, 1, 2, @@ -26,6 +25,6 @@ func main() { 100, ) for _, arg := range table { - z01.Challenge("Sqrt", student.Sqrt, correct.Sqrt, arg) + lib.Challenge("Sqrt", student.Sqrt, correct.Sqrt, arg) } } diff --git a/tests/go/func/test_strlen.go b/tests/go/func/test_strlen.go index 9f2d3905..ef11d6d9 100644 --- a/tests/go/func/test_strlen.go +++ b/tests/go/func/test_strlen.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -12,14 +11,14 @@ func main() { table := []string{} for i := 0; i < 10; i++ { - randomLenghtOfWord := z01.RandIntBetween(1, 20) - randomStrRandomLenght := z01.RandStr(randomLenghtOfWord, randomStringCharset) + randomLenghtOfWord := lib.RandIntBetween(1, 20) + randomStrRandomLenght := lib.RandStr(randomLenghtOfWord, randomStringCharset) table = append(table, randomStrRandomLenght) } table = append(table, "Héllo!") table = append(table, randomStringCharset) for _, s := range table { - z01.Challenge("StrLen", correct.StrLen, student.StrLen, s) + lib.Challenge("StrLen", correct.StrLen, student.StrLen, s) } } diff --git a/tests/go/func/test_strrev.go b/tests/go/func/test_strrev.go index 375b4631..b2208e9b 100644 --- a/tests/go/func/test_strrev.go +++ b/tests/go/func/test_strrev.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandASCII(), + lib.MultRandASCII(), "Hello!", "Bonjour!", "Hola!", ) for _, arg := range table { - z01.Challenge("StrRev", student.StrRev, correct.StrRev, arg) + lib.Challenge("StrRev", student.StrRev, correct.StrRev, arg) } } diff --git a/tests/go/func/test_swap.go b/tests/go/func/test_swap.go index 928320e9..904d937b 100644 --- a/tests/go/func/test_swap.go +++ b/tests/go/func/test_swap.go @@ -1,24 +1,23 @@ package main import ( - "github.com/01-edu/z01" - - student "./student" + "../lib" + "./student" ) func main() { i := 0 for i < 30 { - a := z01.RandInt() - b := z01.RandInt() + a := lib.RandInt() + b := lib.RandInt() aCopy := a bCopy := b student.Swap(&a, &b) if a != bCopy { - z01.Fatalf("Swap(%d, %d), a == %d instead of %d", aCopy, bCopy, a, bCopy) + lib.Fatalf("Swap(%d, %d), a == %d instead of %d", aCopy, bCopy, a, bCopy) } if b != aCopy { - z01.Fatalf("Swap(%d, %d), b == %d instead of %d", aCopy, bCopy, b, aCopy) + lib.Fatalf("Swap(%d, %d), b == %d instead of %d", aCopy, bCopy, b, aCopy) } i++ } diff --git a/tests/go/func/test_swapbits.go b/tests/go/func/test_swapbits.go index c3bc5aa1..c3f3d3dd 100644 --- a/tests/go/func/test_swapbits.go +++ b/tests/go/func/test_swapbits.go @@ -3,17 +3,16 @@ package main import ( "reflect" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func challengeBytes(fn1, fn2 interface{}, args ...interface{}) { - st1 := z01.Monitor(fn1, args) - st2 := z01.Monitor(fn2, args) + st1 := lib.Monitor(fn1, args) + st2 := lib.Monitor(fn2, args) if !reflect.DeepEqual(st1.Results, st2.Results) { - z01.Fatalf("%s(%08b) == %08b instead of %08b\n", + lib.Fatalf("%s(%08b) == %08b instead of %08b\n", "SwapBits", args[0].(byte), st1.Results[0].(byte), @@ -26,7 +25,7 @@ func main() { args := []byte{0x24, 0x14, 0x11, 0x22, 0xd2, 0x15, 0xff, 0x0, 0x35, 0x58, 0x43} for i := 0; i < 10; i++ { - n := z01.RandIntBetween(0, 255) + n := lib.RandIntBetween(0, 255) args = append(args, byte(n)) } diff --git a/tests/go/func/test_sweetproblem.go b/tests/go/func/test_sweetproblem.go index 70f3d1e1..cae72922 100644 --- a/tests/go/func/test_sweetproblem.go +++ b/tests/go/func/test_sweetproblem.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -32,12 +31,12 @@ func main() { for i := 0; i < 15; i++ { table = append(table, node{ - red: z01.RandIntBetween(0, 30), - green: z01.RandIntBetween(0, 30), - blue: z01.RandIntBetween(0, 30), + red: lib.RandIntBetween(0, 30), + green: lib.RandIntBetween(0, 30), + blue: lib.RandIntBetween(0, 30), }) } for _, arg := range table { - z01.Challenge("SweetProblem", student.Sweetproblem, correct.Sweetproblem, arg.red, arg.green, arg.blue) + lib.Challenge("SweetProblem", student.Sweetproblem, correct.Sweetproblem, arg.red, arg.green, arg.blue) } } diff --git a/tests/go/func/test_tolower.go b/tests/go/func/test_tolower.go index 94741450..cc179c93 100644 --- a/tests/go/func/test_tolower.go +++ b/tests/go/func/test_tolower.go @@ -1,18 +1,17 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { table := append( - z01.MultRandASCII(), + lib.MultRandASCII(), "Hello! How are you?", ) for _, arg := range table { - z01.Challenge("ToLower", student.ToLower, correct.ToLower, arg) + lib.Challenge("ToLower", student.ToLower, correct.ToLower, arg) } } diff --git a/tests/go/func/test_toupper.go b/tests/go/func/test_toupper.go index 7d31f9c8..270a26d8 100644 --- a/tests/go/func/test_toupper.go +++ b/tests/go/func/test_toupper.go @@ -1,20 +1,19 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { - table := z01.MultRandASCII() + table := lib.MultRandASCII() table = append(table, "Hello! How are you?", ) for _, arg := range table { - z01.Challenge("ToUpper", student.ToUpper, correct.ToUpper, arg) + lib.Challenge("ToUpper", student.ToUpper, correct.ToUpper, arg) } } diff --git a/tests/go/func/test_trimatoi.go b/tests/go/func/test_trimatoi.go index 019fda46..f62c877d 100644 --- a/tests/go/func/test_trimatoi.go +++ b/tests/go/func/test_trimatoi.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func stringsToTrimAtoi(a []string) []string { @@ -12,12 +11,12 @@ func stringsToTrimAtoi(a []string) []string { for index := 0; index < 4; index++ { s := "" - s += z01.RandStr(z01.RandIntBetween(0, 2), alpha) - x := z01.RandIntBetween(0, 14) + s += lib.RandStr(lib.RandIntBetween(0, 2), alpha) + x := lib.RandIntBetween(0, 14) if x <= 4 { s += "-" } - s += z01.RandStr(z01.RandIntBetween(0, 10), alpha) + s += lib.RandStr(lib.RandIntBetween(0, 10), alpha) a = append(a, s) } return a @@ -33,10 +32,10 @@ func main() { "sd+x1fa2W3s4", "sd-x1fa2W3s4", "sdx1-fa2W3s4", - z01.RandAlnum(), + lib.RandAlnum(), } a = stringsToTrimAtoi(a) for _, elem := range a { - z01.Challenge("TrimAtoi", student.TrimAtoi, correct.TrimAtoi, elem) + lib.Challenge("TrimAtoi", student.TrimAtoi, correct.TrimAtoi, elem) } } diff --git a/tests/go/func/test_twosum.go b/tests/go/func/test_twosum.go index 344d2162..6d9d4a0a 100644 --- a/tests/go/func/test_twosum.go +++ b/tests/go/func/test_twosum.go @@ -3,16 +3,15 @@ package main import ( "math/rand" - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { for i := 0; i < 20; i++ { token := rand.Perm(20) target := rand.Intn(30) - z01.Challenge("TwoSum", student.TwoSum, correct.TwoSum, token, target) + lib.Challenge("TwoSum", student.TwoSum, correct.TwoSum, token, target) } } diff --git a/tests/go/func/test_ultimatedivmod.go b/tests/go/func/test_ultimatedivmod.go index f7d19766..0e80ef6d 100644 --- a/tests/go/func/test_ultimatedivmod.go +++ b/tests/go/func/test_ultimatedivmod.go @@ -1,26 +1,25 @@ package main import ( - "github.com/01-edu/z01" - - student "./student" + "../lib" + "./student" ) func main() { i := 0 - for i < z01.SliceLen { - a := z01.RandInt() - b := z01.RandInt() + for i < lib.SliceLen { + a := lib.RandInt() + b := lib.RandInt() aCopy := a bCopy := b div := a / b mod := a % b student.UltimateDivMod(&a, &b) if a != div { - z01.Fatalf("DivMod(%d, %d), a == %d instead of %d", aCopy, bCopy, a, div) + lib.Fatalf("DivMod(%d, %d), a == %d instead of %d", aCopy, bCopy, a, div) } if b != mod { - z01.Fatalf("DivMod(%d, %d), b == %d instead of %d", aCopy, bCopy, b, mod) + lib.Fatalf("DivMod(%d, %d), b == %d instead of %d", aCopy, bCopy, b, mod) } i++ } diff --git a/tests/go/func/test_ultimatepointone.go b/tests/go/func/test_ultimatepointone.go index 499abc21..1eeb98ce 100644 --- a/tests/go/func/test_ultimatepointone.go +++ b/tests/go/func/test_ultimatepointone.go @@ -1,9 +1,8 @@ package main import ( - "github.com/01-edu/z01" - - student "./student" + "../lib" + "./student" ) func main() { @@ -12,6 +11,6 @@ func main() { n := &b student.UltimatePointOne(&n) if a != 1 { - z01.Fatalf("UltimatePointOne(&n), a == %d instead of 1", a) + lib.Fatalf("UltimatePointOne(&n), a == %d instead of 1", a) } } diff --git a/tests/go/func/test_unmatch.go b/tests/go/func/test_unmatch.go index 9eb75fad..4f306426 100644 --- a/tests/go/func/test_unmatch.go +++ b/tests/go/func/test_unmatch.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -15,9 +14,9 @@ func main() { arg5 := []int{0, 20, 91, 23, 10, 34} arg6 := []int{1, 1, 2, 2, 3, 4, 3, 4, 5, 5, 8, 9, 8, 9} - randInt1 := z01.RandIntBetween(-100, 100) - randInt2 := z01.RandIntBetween(-1000, 1000) - randInt3 := z01.RandIntBetween(-10, 10) + randInt1 := lib.RandIntBetween(-100, 100) + randInt2 := lib.RandIntBetween(-1000, 1000) + randInt3 := lib.RandIntBetween(-10, 10) arg7 := []int{randInt1, randInt2, randInt1, randInt2, randInt1 + randInt3, randInt1 + randInt3} arg8 := []int{randInt1, randInt2, randInt1, randInt2, randInt1 + randInt3, randInt2 - randInt3} @@ -25,6 +24,6 @@ func main() { args := [][]int{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8} for _, v := range args { - z01.Challenge("Unmatch", student.Unmatch, correct.Unmatch, v) + lib.Challenge("Unmatch", student.Unmatch, correct.Unmatch, v) } } diff --git a/tests/go/func/test_volumechanger.go b/tests/go/func/test_volumechanger.go index 45b8dc6b..813e2784 100644 --- a/tests/go/func/test_volumechanger.go +++ b/tests/go/func/test_volumechanger.go @@ -1,10 +1,9 @@ package main import ( - "github.com/01-edu/z01" - - correct "./correct" - student "./student" + "../lib" + "./correct" + "./student" ) func main() { @@ -16,11 +15,11 @@ func main() { } for i := 0; i < 15; i++ { table = append(table, [2]int{ - z01.RandIntBetween(0, 30), - z01.RandIntBetween(0, 100), + lib.RandIntBetween(0, 30), + lib.RandIntBetween(0, 100), }) } for _, arg := range table { - z01.Challenge("Volumechanger", student.Volumechanger, correct.Volumechanger, arg[0], arg[1]) + lib.Challenge("Volumechanger", student.Volumechanger, correct.Volumechanger, arg[0], arg[1]) } } diff --git a/tests/go/prog/test_addprimesum.go b/tests/go/prog/test_addprimesum.go index 04dee8ef..8f1b7b23 100644 --- a/tests/go/prog/test_addprimesum.go +++ b/tests/go/prog/test_addprimesum.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func isAPrime(nb int) bool { @@ -29,7 +29,7 @@ func isAPrime(nb int) bool { func main() { // adds random numbers - table := z01.MultRandIntBetween(1, 10000) + table := lib.MultRandIntBetween(1, 10000) // fill with all prime numbers between 0 and 100 for i := 0; i < 100; i++ { @@ -39,10 +39,10 @@ func main() { } for _, i := range table { - z01.ChallengeMain("addprimesum", strconv.Itoa(i)) + lib.ChallengeMain("addprimesum", strconv.Itoa(i)) } // special cases - z01.ChallengeMain("addprimesum") - z01.ChallengeMain("addprimesum", `""`) - z01.ChallengeMain("addprimesum", "1", "2") + lib.ChallengeMain("addprimesum") + lib.ChallengeMain("addprimesum", `""`) + lib.ChallengeMain("addprimesum", "1", "2") } diff --git a/tests/go/prog/test_alphamirror.go b/tests/go/prog/test_alphamirror.go index e13ac2b7..008943b4 100644 --- a/tests/go/prog/test_alphamirror.go +++ b/tests/go/prog/test_alphamirror.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := [][]string{ @@ -9,10 +9,10 @@ func main() { {"testing spaces and #!*"}, {"more", "than", "three", "arguments"}, {"Upper anD LoWer cAsE"}, - {z01.RandWords()}, + {lib.RandWords()}, } for _, v := range args { - z01.ChallengeMain("alphamirror", v...) + lib.ChallengeMain("alphamirror", v...) } } diff --git a/tests/go/prog/test_balancedstring.go b/tests/go/prog/test_balancedstring.go index a18ba41a..a2526765 100644 --- a/tests/go/prog/test_balancedstring.go +++ b/tests/go/prog/test_balancedstring.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { table := []string{ @@ -16,14 +16,14 @@ func main() { for i := 0; i < 15; i++ { s := "" - chunks := z01.RandIntBetween(5, 10) + chunks := lib.RandIntBetween(5, 10) for j := 0; j < chunks; j++ { - countC := z01.RandIntBetween(1, 5) - countD := z01.RandIntBetween(1, 5) + countC := lib.RandIntBetween(1, 5) + countD := lib.RandIntBetween(1, 5) tmpC := countC tmpD := countD for tmpC > 0 || tmpD > 0 { - letter := z01.RandStr(1, "CD") + letter := lib.RandStr(1, "CD") if tmpC > 0 && letter == "C" { tmpC-- s += letter @@ -36,7 +36,7 @@ func main() { tmpC = countC tmpD = countD for tmpC > 0 || tmpD > 0 { - letter := z01.RandStr(1, "CD") + letter := lib.RandStr(1, "CD") if tmpC > 0 && letter == "D" { tmpC-- s += letter @@ -50,6 +50,6 @@ func main() { } for _, arg := range table { - z01.ChallengeMain("balancedstring", arg) + lib.ChallengeMain("balancedstring", arg) } } diff --git a/tests/go/prog/test_boolean.go b/tests/go/prog/test_boolean.go index c6ad8986..11ec372c 100644 --- a/tests/go/prog/test_boolean.go +++ b/tests/go/prog/test_boolean.go @@ -3,13 +3,13 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), "1 2 3 4 5") + table := append(lib.MultRandWords(), "1 2 3 4 5") for _, s := range table { - z01.ChallengeMain("boolean", strings.Fields(s)...) + lib.ChallengeMain("boolean", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_brackets.go b/tests/go/prog/test_brackets.go index 3c3023c1..bf880ae8 100644 --- a/tests/go/prog/test_brackets.go +++ b/tests/go/prog/test_brackets.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { oneArgs := []string{ @@ -13,19 +13,19 @@ func main() { // 18 random tests ( at least half are valid) for i := 0; i < 3; i++ { oneArgs = append(oneArgs, - "("+z01.RandASCII()+")", - "["+z01.RandASCII()+"]", - "{"+z01.RandASCII()+"}", - "("+z01.RandAlnum()+")", - "["+z01.RandAlnum()+"]", - "{"+z01.RandAlnum()+"}", + "("+lib.RandASCII()+")", + "["+lib.RandASCII()+"]", + "{"+lib.RandASCII()+"}", + "("+lib.RandAlnum()+")", + "["+lib.RandAlnum()+"]", + "{"+lib.RandAlnum()+"}", ) } - z01.ChallengeMain("brackets") + lib.ChallengeMain("brackets") for _, v := range oneArgs { - z01.ChallengeMain("brackets", v) + lib.ChallengeMain("brackets", v) } multArg := [][]string{ @@ -35,6 +35,6 @@ func main() { } for _, v := range multArg { - z01.ChallengeMain("brackets", v...) + lib.ChallengeMain("brackets", v...) } } diff --git a/tests/go/prog/test_brainfuck.go b/tests/go/prog/test_brainfuck.go index c0360835..0a7ecc86 100644 --- a/tests/go/prog/test_brainfuck.go +++ b/tests/go/prog/test_brainfuck.go @@ -3,7 +3,7 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -13,9 +13,9 @@ func main() { "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>.", "++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++.", "ld++++++++++++++++++++++++++++++++++++++++++++this+is++a++++comment++++++++++++++[>d+<-]>.+.+.>++++++++++.", - strings.Join([]string{"ld++++++++++++++++++++++++++++++++++++++++++++this+is++a++++comment++++++++++++++[>d+<-]>.+", z01.RandStr(z01.RandIntBetween(1, 10), ".+"), ".+.>++++++++++."}, ""), + strings.Join([]string{"ld++++++++++++++++++++++++++++++++++++++++++++this+is++a++++comment++++++++++++++[>d+<-]>.+", lib.RandStr(lib.RandIntBetween(1, 10), ".+"), ".+.>++++++++++."}, ""), } for _, v := range args { - z01.ChallengeMain("brainfuck", v) + lib.ChallengeMain("brainfuck", v) } } diff --git a/tests/go/prog/test_cat.go b/tests/go/prog/test_cat.go index cfb2ac45..e0c354cc 100644 --- a/tests/go/prog/test_cat.go +++ b/tests/go/prog/test_cat.go @@ -6,7 +6,7 @@ import ( "os/exec" "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -14,36 +14,36 @@ func main() { pathFileName2 := "./student/cat/quest8T.txt" if _, err := os.Stat(pathFileName1); err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } if _, err := os.Stat(pathFileName2); err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } table := []string{pathFileName1, pathFileName1 + " " + pathFileName2, "asd"} for _, s := range table { - z01.ChallengeMain("cat", strings.Fields(s)...) + lib.ChallengeMain("cat", strings.Fields(s)...) } if _, err := exec.Command("go", "build", "-o", "cat_student", "./student/cat/main.go").Output(); err != nil { - z01.Fatal(string(err.(*exec.ExitError).Stderr)) + lib.Fatal(string(err.(*exec.ExitError).Stderr)) } if _, err := exec.Command("go", "build", "-o", "cat_solution", "./solutions/cat/main.go").Output(); err != nil { - z01.Fatal(string(err.(*exec.ExitError).Stderr)) + lib.Fatal(string(err.(*exec.ExitError).Stderr)) } pwd, err := os.Getwd() if err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } for i := 0; i < 2; i++ { - randStdin := z01.RandAlnum() + randStdin := lib.RandAlnum() cmd := exec.Command("sh", "-c", pwd+"/cat_solution") solutionResult := execStdin(cmd, randStdin) cmdS := exec.Command(pwd + "/cat_student") studentResult := execStdin(cmdS, randStdin) if solutionResult != studentResult { - z01.Fatalf("./cat prints %s instead of %s\n", studentResult, solutionResult) + lib.Fatalf("./cat prints %s instead of %s\n", studentResult, solutionResult) } } } @@ -51,24 +51,24 @@ func main() { func execStdin(cmd *exec.Cmd, randomStdin string) string { stdin, err := cmd.StdinPipe() if err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } stdout, err := cmd.StdoutPipe() if err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } if err := cmd.Start(); err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } _, err = stdin.Write([]byte(randomStdin)) if err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } stdin.Close() out, _ := ioutil.ReadAll(stdout) if err := cmd.Wait(); err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } return string(out) } diff --git a/tests/go/prog/test_cleanstr.go b/tests/go/prog/test_cleanstr.go index 13cedaf2..63162029 100644 --- a/tests/go/prog/test_cleanstr.go +++ b/tests/go/prog/test_cleanstr.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := []string{ @@ -8,11 +8,11 @@ func main() { " only it's harder ", "how funny", "", - z01.RandSpace(), + lib.RandSpace(), } for _, v := range args { - z01.ChallengeMain("cleanstr", v) + lib.ChallengeMain("cleanstr", v) } - z01.ChallengeMain("cleanstr", "this is not", "happening") + lib.ChallengeMain("cleanstr", "this is not", "happening") } diff --git a/tests/go/prog/test_comcheck.go b/tests/go/prog/test_comcheck.go index 638400a0..d3fea8e1 100644 --- a/tests/go/prog/test_comcheck.go +++ b/tests/go/prog/test_comcheck.go @@ -3,11 +3,11 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), + table := append(lib.MultRandWords(), "01", "galaxy", "galaxy01", @@ -17,6 +17,6 @@ func main() { "as ds galaxy 01 asd") for _, s := range table { - z01.ChallengeMain("comcheck", strings.Fields(s)...) + lib.ChallengeMain("comcheck", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_costumeprofit.go b/tests/go/prog/test_costumeprofit.go index fce03811..a192b6d0 100644 --- a/tests/go/prog/test_costumeprofit.go +++ b/tests/go/prog/test_costumeprofit.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) type node struct { @@ -14,12 +14,12 @@ func main() { table := []node{} for i := 0; i < 25; i++ { - a := z01.RandIntBetween(0, 1000) - b := z01.RandIntBetween(0, 1000) - c := z01.RandIntBetween(0, 1000) - d := z01.RandIntBetween(0, 1000) - e := z01.RandIntBetween(0, 1000) - f := z01.RandIntBetween(0, 1000) + a := lib.RandIntBetween(0, 1000) + b := lib.RandIntBetween(0, 1000) + c := lib.RandIntBetween(0, 1000) + d := lib.RandIntBetween(0, 1000) + e := lib.RandIntBetween(0, 1000) + f := lib.RandIntBetween(0, 1000) table = append(table, node{a, b, c, d, e, f}) } @@ -30,6 +30,6 @@ func main() { d := strconv.Itoa(arg.D) e := strconv.Itoa(arg.E) f := strconv.Itoa(arg.F) - z01.ChallengeMain("costumeprofit", a, b, c, d, e, f) + lib.ChallengeMain("costumeprofit", a, b, c, d, e, f) } } diff --git a/tests/go/prog/test_countdown.go b/tests/go/prog/test_countdown.go index a9e0fb58..2f0862b5 100644 --- a/tests/go/prog/test_countdown.go +++ b/tests/go/prog/test_countdown.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("countdown") + lib.ChallengeMain("countdown") } diff --git a/tests/go/prog/test_displaya.go b/tests/go/prog/test_displaya.go index 5c9f8167..463022ea 100644 --- a/tests/go/prog/test_displaya.go +++ b/tests/go/prog/test_displaya.go @@ -3,18 +3,18 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), "dsfda") + table := append(lib.MultRandWords(), "dsfda") table = append(table, "") table = append(table, "1") table = append(table, "1") for _, s := range table { - z01.ChallengeMain("displaya", strings.Fields(s)...) + lib.ChallengeMain("displaya", strings.Fields(s)...) } - z01.ChallengeMain("displaya", "1", "a") + lib.ChallengeMain("displaya", "1", "a") } diff --git a/tests/go/prog/test_displayalpham.go b/tests/go/prog/test_displayalpham.go index 8cfa9ce0..a1573c33 100644 --- a/tests/go/prog/test_displayalpham.go +++ b/tests/go/prog/test_displayalpham.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("displayalpham") + lib.ChallengeMain("displayalpham") } diff --git a/tests/go/prog/test_displayalrevm.go b/tests/go/prog/test_displayalrevm.go index ab6bf4e2..157fa63c 100644 --- a/tests/go/prog/test_displayalrevm.go +++ b/tests/go/prog/test_displayalrevm.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("displayalrevm") + lib.ChallengeMain("displayalrevm") } diff --git a/tests/go/prog/test_displayfile.go b/tests/go/prog/test_displayfile.go index ef8757ea..868de328 100644 --- a/tests/go/prog/test_displayfile.go +++ b/tests/go/prog/test_displayfile.go @@ -4,17 +4,17 @@ import ( "os" "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { pathFileName := "./student/displayfile/quest8.txt" _, err := os.Stat(pathFileName) if err != nil { - z01.Fatal(err) + lib.Fatal(err) } table := []string{"", pathFileName, "quest8.txt asdsada"} for _, s := range table { - z01.ChallengeMain("displayfile", strings.Fields(s)...) + lib.ChallengeMain("displayfile", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_displayfirstparam.go b/tests/go/prog/test_displayfirstparam.go index 7ab67dfb..1f59c521 100644 --- a/tests/go/prog/test_displayfirstparam.go +++ b/tests/go/prog/test_displayfirstparam.go @@ -3,16 +3,16 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), " ") + table := append(lib.MultRandWords(), " ") table = append(table, "1") table = append(table, "1 2") table = append(table, "1 2 3") for _, s := range table { - z01.ChallengeMain("displayfirstparam", strings.Fields(s)...) + lib.ChallengeMain("displayfirstparam", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_displaylastparam.go b/tests/go/prog/test_displaylastparam.go index 4ec8b252..70ac2d57 100644 --- a/tests/go/prog/test_displaylastparam.go +++ b/tests/go/prog/test_displaylastparam.go @@ -3,15 +3,15 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), " ") + table := append(lib.MultRandWords(), " ") table = append(table, "1") table = append(table, "1 2") for _, s := range table { - z01.ChallengeMain("displaylastparam", strings.Fields(s)...) + lib.ChallengeMain("displaylastparam", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_displayz.go b/tests/go/prog/test_displayz.go index 198fd5c9..46d2a1db 100644 --- a/tests/go/prog/test_displayz.go +++ b/tests/go/prog/test_displayz.go @@ -3,18 +3,18 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), "dsfdz") + table := append(lib.MultRandWords(), "dsfdz") table = append(table, "") table = append(table, "1") table = append(table, "1") for _, s := range table { - z01.ChallengeMain("displayz", strings.Fields(s)...) + lib.ChallengeMain("displayz", strings.Fields(s)...) } - z01.ChallengeMain("displayz", "1", "z") + lib.ChallengeMain("displayz", "1", "z") } diff --git a/tests/go/prog/test_doop.go b/tests/go/prog/test_doop.go index 1093c040..29b71e5e 100644 --- a/tests/go/prog/test_doop.go +++ b/tests/go/prog/test_doop.go @@ -5,7 +5,7 @@ import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -14,8 +14,8 @@ func main() { table := []string{} for i := 0; i < 4; i++ { - firstArg := strconv.Itoa(z01.RandIntBetween(-1000, 1000)) - secondArg := strconv.Itoa(z01.RandIntBetween(0, 1000)) + firstArg := strconv.Itoa(lib.RandIntBetween(-1000, 1000)) + secondArg := strconv.Itoa(lib.RandIntBetween(0, 1000)) for _, operator := range operatorsTable { table = append(table, firstArg+" "+operator+" "+secondArg) @@ -37,6 +37,6 @@ func main() { table = append(table, "9223372036854775809 - 3") table = append(table, "9223372036854775807 * 3") for _, s := range table { - z01.ChallengeMain("doop", strings.Fields(s)...) + lib.ChallengeMain("doop", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_expandstr.go b/tests/go/prog/test_expandstr.go index f2e73925..4e8b01c8 100644 --- a/tests/go/prog/test_expandstr.go +++ b/tests/go/prog/test_expandstr.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := [][]string{ @@ -9,10 +9,10 @@ func main() { {"you see it's easy to display the same thing"}, } - args = append(args, z01.MultRandWords()) + args = append(args, lib.MultRandWords()) for _, v := range args { - z01.ChallengeMain("expandstr", v...) + lib.ChallengeMain("expandstr", v...) } - z01.ChallengeMain("expandstr") + lib.ChallengeMain("expandstr") } diff --git a/tests/go/prog/test_firstword.go b/tests/go/prog/test_firstword.go index 78b5310e..5487e79f 100644 --- a/tests/go/prog/test_firstword.go +++ b/tests/go/prog/test_firstword.go @@ -1,9 +1,9 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - table := append(z01.MultRandWords(), + table := append(lib.MultRandWords(), "", " a as", " f d", @@ -13,6 +13,6 @@ func main() { "salut ! !", ) for _, s := range table { - z01.ChallengeMain("firstword", s) + lib.ChallengeMain("firstword", s) } } diff --git a/tests/go/prog/test_fixthemain.go b/tests/go/prog/test_fixthemain.go index 2b4804ef..27b6bb3d 100644 --- a/tests/go/prog/test_fixthemain.go +++ b/tests/go/prog/test_fixthemain.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("fixthemain") + lib.ChallengeMain("fixthemain") } diff --git a/tests/go/prog/test_flags.go b/tests/go/prog/test_flags.go index 855b62d2..ae11be37 100644 --- a/tests/go/prog/test_flags.go +++ b/tests/go/prog/test_flags.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" type node struct { flags []string @@ -15,8 +15,8 @@ func main() { var randflag []string var randflagarg []string for i := 0; i < 2; i++ { - randflagarg = append(randflagarg, z01.RandWords()) - randflag = append(randflag, z01.RandWords()) + randflagarg = append(randflagarg, lib.RandWords()) + randflag = append(randflag, lib.RandWords()) } node := &node{ @@ -28,20 +28,20 @@ func main() { node.randArg = append(node.randArg, "") - z01.ChallengeMain("flags", node.flagsShorthand[0]+"v2", "v1") - z01.ChallengeMain("flags", node.flagsShorthand[1], "v1") - z01.ChallengeMain("flags", "-h") - z01.ChallengeMain("flags", "--help") - z01.ChallengeMain("flags") + lib.ChallengeMain("flags", node.flagsShorthand[0]+"v2", "v1") + lib.ChallengeMain("flags", node.flagsShorthand[1], "v1") + lib.ChallengeMain("flags", "-h") + lib.ChallengeMain("flags", "--help") + lib.ChallengeMain("flags") for _, v2 := range node.randArgFlag { for _, v1 := range node.randArg { - z01.ChallengeMain("flags", node.flags[0]+v2, node.flags[1], v1) + lib.ChallengeMain("flags", node.flags[0]+v2, node.flags[1], v1) } } for _, v2 := range node.randArgFlag { for _, v1 := range node.randArg { - z01.ChallengeMain("flags", node.flagsShorthand[0]+v2, node.flagsShorthand[1], v1) + lib.ChallengeMain("flags", node.flagsShorthand[0]+v2, node.flagsShorthand[1], v1) } } } diff --git a/tests/go/prog/test_fprime.go b/tests/go/prog/test_fprime.go index af4d3aba..07cc7825 100644 --- a/tests/go/prog/test_fprime.go +++ b/tests/go/prog/test_fprime.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -22,9 +22,9 @@ func main() { "1000003", } for i := 0; i < 10; i++ { - table = append(table, strconv.Itoa(z01.RandIntBetween(1, 100))) + table = append(table, strconv.Itoa(lib.RandIntBetween(1, 100))) } for _, s := range table { - z01.ChallengeMain("fprime", s) + lib.ChallengeMain("fprime", s) } } diff --git a/tests/go/prog/test_gcd.go b/tests/go/prog/test_gcd.go index e1568ff0..106917ae 100644 --- a/tests/go/prog/test_gcd.go +++ b/tests/go/prog/test_gcd.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -15,11 +15,11 @@ func main() { {"11", "77"}, } for i := 0; i < 25; i++ { - number1 := strconv.Itoa(z01.RandIntBetween(1, 100000)) - number2 := strconv.Itoa(z01.RandIntBetween(1, 100)) + number1 := strconv.Itoa(lib.RandIntBetween(1, 100000)) + number2 := strconv.Itoa(lib.RandIntBetween(1, 100)) args = append(args, []string{number1, number2}) } for _, v := range args { - z01.ChallengeMain("gcd", v...) + lib.ChallengeMain("gcd", v...) } } diff --git a/tests/go/prog/test_grouping.go b/tests/go/prog/test_grouping.go index 8d5d9bee..d08be83a 100644 --- a/tests/go/prog/test_grouping.go +++ b/tests/go/prog/test_grouping.go @@ -1,14 +1,14 @@ package main -import "github.com/01-edu/z01" +import "../lib" func validRegExp(n int) string { result := "(" for i := 0; i < n; i++ { - result += z01.RandStr(1, z01.Lower) - if z01.RandInt()%2 == 0 { - result += z01.RandStr(1, z01.Lower) + result += lib.RandStr(1, lib.Lower) + if lib.RandInt()%2 == 0 { + result += lib.RandStr(1, lib.Lower) } if i != n-1 { result += "|" @@ -26,12 +26,12 @@ func main() { {"(hi)", "He swore he just saw his sushi move."}, {"(s)", ""}, {"i", "Something in the air"}, - {validRegExp(2), z01.RandStr(60, z01.Lower+z01.Space)}, - {validRegExp(2), z01.RandStr(60, z01.Lower+z01.Space)}, - {validRegExp(6), z01.RandStr(60, z01.Lower+z01.Space)}, - {z01.RandStr(1, "axyz"), z01.RandStr(10, "axyzdassbzzxxxyy cdq ")}, + {validRegExp(2), lib.RandStr(60, lib.Lower+lib.Space)}, + {validRegExp(2), lib.RandStr(60, lib.Lower+lib.Space)}, + {validRegExp(6), lib.RandStr(60, lib.Lower+lib.Space)}, + {lib.RandStr(1, "axyz"), lib.RandStr(10, "axyzdassbzzxxxyy cdq ")}, } for _, s := range args { - z01.ChallengeMain("grouping", s[0], s[1]) + lib.ChallengeMain("grouping", s[0], s[1]) } } diff --git a/tests/go/prog/test_hello.go b/tests/go/prog/test_hello.go index 0a5f6037..3ccedd55 100644 --- a/tests/go/prog/test_hello.go +++ b/tests/go/prog/test_hello.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("hello") + lib.ChallengeMain("hello") } diff --git a/tests/go/prog/test_hiddenp.go b/tests/go/prog/test_hiddenp.go index 72afb2a2..f97f991c 100644 --- a/tests/go/prog/test_hiddenp.go +++ b/tests/go/prog/test_hiddenp.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := [][2]string{ @@ -12,11 +12,11 @@ func main() { } for i := 0; i < 30; i++ { args = append(args, - [2]string{z01.RandStr(1, z01.Lower), z01.RandLower()}, - [2]string{z01.RandStr(1, z01.Upper), z01.RandUpper()}, + [2]string{lib.RandStr(1, lib.Lower), lib.RandLower()}, + [2]string{lib.RandStr(1, lib.Upper), lib.RandUpper()}, ) } for _, v := range args { - z01.ChallengeMain("hiddenp", v[0], v[1]) + lib.ChallengeMain("hiddenp", v[0], v[1]) } } diff --git a/tests/go/prog/test_inter.go b/tests/go/prog/test_inter.go index 166ad460..16b35aa3 100644 --- a/tests/go/prog/test_inter.go +++ b/tests/go/prog/test_inter.go @@ -3,11 +3,11 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - args := append(z01.MultRandWords(), + args := append(lib.MultRandWords(), "padinton paqefwtdjetyiytjneytjoeyjnejeyj", "ddf6vewg64f twthgdwthdwfteewhrtag6h4ffdhsd", "abcdefghij efghijlmnopq", @@ -17,15 +17,15 @@ func main() { ) for i := 0; i < 5; i++ { - s1 := z01.RandAlnum() - s2 := z01.RandAlnum() + s1 + z01.RandAlnum() + s1 := lib.RandAlnum() + s2 := lib.RandAlnum() + s1 + lib.RandAlnum() args = append(args, s1+" "+s2, - z01.RandAlnum()+" "+z01.RandAlnum(), + lib.RandAlnum()+" "+lib.RandAlnum(), ) } for _, s := range args { - z01.ChallengeMain("inter", strings.Fields(s)...) + lib.ChallengeMain("inter", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_ispowerof2.go b/tests/go/prog/test_ispowerof2.go index 3b19591a..53c46f5a 100644 --- a/tests/go/prog/test_ispowerof2.go +++ b/tests/go/prog/test_ispowerof2.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -19,9 +19,9 @@ func main() { {}, } for i := 0; i < 12; i++ { - args = append(args, []string{strconv.Itoa(z01.RandIntBetween(1, 2048))}) + args = append(args, []string{strconv.Itoa(lib.RandIntBetween(1, 2048))}) } for _, v := range args { - z01.ChallengeMain("ispowerof2", v...) + lib.ChallengeMain("ispowerof2", v...) } } diff --git a/tests/go/prog/test_lastword.go b/tests/go/prog/test_lastword.go index f77e51fd..e291c1fc 100644 --- a/tests/go/prog/test_lastword.go +++ b/tests/go/prog/test_lastword.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := []string{ @@ -10,12 +10,12 @@ func main() { " lorem,ipsum ", } - args = append(args, z01.MultRandWords()) + args = append(args, lib.MultRandWords()) for _, v := range args { - z01.ChallengeMain("lastword", v) + lib.ChallengeMain("lastword", v) } - z01.ChallengeMain("lastword", "a", "b") - z01.ChallengeMain("lastword") + lib.ChallengeMain("lastword", "a", "b") + lib.ChallengeMain("lastword") } diff --git a/tests/go/prog/test_nbrconvertalpha.go b/tests/go/prog/test_nbrconvertalpha.go index 337a655b..0b4aa3fb 100644 --- a/tests/go/prog/test_nbrconvertalpha.go +++ b/tests/go/prog/test_nbrconvertalpha.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -17,7 +17,7 @@ func main() { "", }} for i := 0; i < 5; i++ { - m := z01.MultRandIntBetween(1, 46) + m := lib.MultRandIntBetween(1, 46) s := "" for _, j := range m { s += strconv.Itoa(j) + " " @@ -26,6 +26,6 @@ func main() { } for _, args := range table { - z01.ChallengeMain("nbrconvertalpha", strings.Fields(args)...) + lib.ChallengeMain("nbrconvertalpha", strings.Fields(args)...) } } diff --git a/tests/go/prog/test_nenokku.go b/tests/go/prog/test_nenokku.go index f7a31d92..da32c4a7 100644 --- a/tests/go/prog/test_nenokku.go +++ b/tests/go/prog/test_nenokku.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { table := [][]string{{ @@ -25,17 +25,17 @@ func main() { for i := 0; i < 6; i++ { result := []string{} - nOps := z01.RandIntBetween(3, 15) - index := z01.RandIntBetween(0, len(sets)-1) + nOps := lib.RandIntBetween(3, 15) + index := lib.RandIntBetween(0, len(sets)-1) for j := 0; j < nOps; j++ { - k := z01.RandIntBetween(0, len(ops)-1) - s := z01.RandIntBetween(0, len(sets[index])-1) + k := lib.RandIntBetween(0, len(ops)-1) + s := lib.RandIntBetween(0, len(sets[index])-1) result = append(result, ops[k]+" "+sets[index][s]) } table = append(table, result) } for _, arg := range table { - z01.ChallengeMain("nenokku", arg...) + lib.ChallengeMain("nenokku", arg...) } } diff --git a/tests/go/prog/test_onlya.go b/tests/go/prog/test_onlya.go index 4bb17439..a7349d6b 100644 --- a/tests/go/prog/test_onlya.go +++ b/tests/go/prog/test_onlya.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("onlya") + lib.ChallengeMain("onlya") } diff --git a/tests/go/prog/test_onlyz.go b/tests/go/prog/test_onlyz.go index d2e52ec2..aba89342 100644 --- a/tests/go/prog/test_onlyz.go +++ b/tests/go/prog/test_onlyz.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("onlyz") + lib.ChallengeMain("onlyz") } diff --git a/tests/go/prog/test_options.go b/tests/go/prog/test_options.go index 4552dc8c..23cceb0d 100644 --- a/tests/go/prog/test_options.go +++ b/tests/go/prog/test_options.go @@ -3,13 +3,13 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { var table []string - table = append(table, "-"+z01.RandLower(), + table = append(table, "-"+lib.RandLower(), " ", "-%", "-?", @@ -25,10 +25,10 @@ func main() { "-hz", "-zh", "-z -h", - strings.Join([]string{"-", z01.RandStr(10, z01.RuneRange('a', 'z'))}, ""), + strings.Join([]string{"-", lib.RandStr(10, lib.RuneRange('a', 'z'))}, ""), ) for _, s := range table { - z01.ChallengeMain("options", strings.Fields(s)...) + lib.ChallengeMain("options", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_paramcount.go b/tests/go/prog/test_paramcount.go index 612ded05..6aad4196 100644 --- a/tests/go/prog/test_paramcount.go +++ b/tests/go/prog/test_paramcount.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -16,20 +16,20 @@ func main() { for i := 0; i < 10; i++ { var arg []string - init := z01.RandIntBetween(0, 10) - for i := init; i < init+z01.RandIntBetween(5, 10); i++ { + init := lib.RandIntBetween(0, 10) + for i := init; i < init+lib.RandIntBetween(5, 10); i++ { arg = append(arg, strconv.Itoa(i)) } args = append(args, arg) } for i := 0; i < 1; i++ { - args = append(args, z01.MultRandWords()) + args = append(args, lib.MultRandWords()) } for _, v := range args { - z01.ChallengeMain("paramcount", v...) + lib.ChallengeMain("paramcount", v...) } - z01.ChallengeMain("paramcount") + lib.ChallengeMain("paramcount") } diff --git a/tests/go/prog/test_piglatin.go b/tests/go/prog/test_piglatin.go index 8c015305..c1442a3b 100644 --- a/tests/go/prog/test_piglatin.go +++ b/tests/go/prog/test_piglatin.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := [][]string{ @@ -9,10 +9,10 @@ func main() { } for i := 0; i < 4; i++ { - args = append(args, z01.MultRandBasic()) + args = append(args, lib.MultRandBasic()) } for _, v := range args { - z01.ChallengeMain("piglatin", v...) + lib.ChallengeMain("piglatin", v...) } } diff --git a/tests/go/prog/test_pilot.go b/tests/go/prog/test_pilot.go index f55096cd..1ee4884f 100644 --- a/tests/go/prog/test_pilot.go +++ b/tests/go/prog/test_pilot.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("pilot") + lib.ChallengeMain("pilot") } diff --git a/tests/go/prog/test_point.go b/tests/go/prog/test_point.go index 5de153cb..3b4c33e1 100644 --- a/tests/go/prog/test_point.go +++ b/tests/go/prog/test_point.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("point") + lib.ChallengeMain("point") } diff --git a/tests/go/prog/test_printalphabet.go b/tests/go/prog/test_printalphabet.go index c4b3cbec..3da02dbf 100644 --- a/tests/go/prog/test_printalphabet.go +++ b/tests/go/prog/test_printalphabet.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("printalphabet") + lib.ChallengeMain("printalphabet") } diff --git a/tests/go/prog/test_printbits.go b/tests/go/prog/test_printbits.go index 3a55ff22..17251283 100644 --- a/tests/go/prog/test_printbits.go +++ b/tests/go/prog/test_printbits.go @@ -4,22 +4,22 @@ import ( "strconv" "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { var arg []string for i := 0; i < 20; i++ { - arg = append(arg, strconv.Itoa(z01.RandIntBetween(0, 255))) + arg = append(arg, strconv.Itoa(lib.RandIntBetween(0, 255))) } arg = append(arg, "") arg = append(arg, "a") arg = append(arg, "bc") arg = append(arg, "def") arg = append(arg, "notanumber") - arg = append(arg, z01.RandBasic()) + arg = append(arg, lib.RandBasic()) for _, v := range arg { - z01.ChallengeMain("printbits", strings.Fields(v)...) + lib.ChallengeMain("printbits", strings.Fields(v)...) } } diff --git a/tests/go/prog/test_printchessboard.go b/tests/go/prog/test_printchessboard.go index 81d179fa..47287e57 100644 --- a/tests/go/prog/test_printchessboard.go +++ b/tests/go/prog/test_printchessboard.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -21,12 +21,12 @@ func main() { ) for i := 0; i < 2; i++ { - number1 := strconv.Itoa(z01.RandIntBetween(1, 200)) - number2 := strconv.Itoa(z01.RandIntBetween(1, 200)) + number1 := strconv.Itoa(lib.RandIntBetween(1, 200)) + number2 := strconv.Itoa(lib.RandIntBetween(1, 200)) table = append(table, []string{number1, number2}) } for _, v := range table { - z01.ChallengeMain("printchessboard", v...) + lib.ChallengeMain("printchessboard", v...) } } diff --git a/tests/go/prog/test_printdigits.go b/tests/go/prog/test_printdigits.go index 825920d7..9ae2a19b 100644 --- a/tests/go/prog/test_printdigits.go +++ b/tests/go/prog/test_printdigits.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("printdigits") + lib.ChallengeMain("printdigits") } diff --git a/tests/go/prog/test_printhex.go b/tests/go/prog/test_printhex.go index 0e065fed..1459dacf 100644 --- a/tests/go/prog/test_printhex.go +++ b/tests/go/prog/test_printhex.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -16,7 +16,7 @@ func main() { "0", ) for i := 0; i < 10; i++ { - table = append(table, strconv.Itoa(z01.RandIntBetween(-1000, 2000000000))) + table = append(table, strconv.Itoa(lib.RandIntBetween(-1000, 2000000000))) } for i := 0; i < 15; i++ { @@ -24,6 +24,6 @@ func main() { } for _, s := range table { - z01.ChallengeMain("printhex", strings.Fields(s)...) + lib.ChallengeMain("printhex", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_printparams.go b/tests/go/prog/test_printparams.go index 9e585d25..a4f4976e 100644 --- a/tests/go/prog/test_printparams.go +++ b/tests/go/prog/test_printparams.go @@ -3,12 +3,12 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), "choumi is the best cat") + table := append(lib.MultRandWords(), "choumi is the best cat") for _, s := range table { - z01.ChallengeMain("printparams", strings.Fields(s)...) + lib.ChallengeMain("printparams", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_printprogramname.go b/tests/go/prog/test_printprogramname.go index faff074d..9c82763b 100644 --- a/tests/go/prog/test_printprogramname.go +++ b/tests/go/prog/test_printprogramname.go @@ -4,21 +4,21 @@ import ( "os" "os/exec" - "github.com/01-edu/z01" + "../lib" ) var name = "student" func test(newName string) { if err := os.Rename(name, newName); err != nil { - z01.Fatalln(err) + lib.Fatalln(err) } b, err := exec.Command("./" + name).CombinedOutput() if err != nil { - z01.Fatalln(b) + lib.Fatalln(b) } if string(b) != name+"\n" { - z01.Fatalln("Failed to print the program name") + lib.Fatalln("Failed to print the program name") } name = newName } diff --git a/tests/go/prog/test_printrevcomb.go b/tests/go/prog/test_printrevcomb.go index 06e3bf1d..e7daf9da 100644 --- a/tests/go/prog/test_printrevcomb.go +++ b/tests/go/prog/test_printrevcomb.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("printrevcomb") + lib.ChallengeMain("printrevcomb") } diff --git a/tests/go/prog/test_printreversealphabet.go b/tests/go/prog/test_printreversealphabet.go index 5dc095cf..a9a6e683 100644 --- a/tests/go/prog/test_printreversealphabet.go +++ b/tests/go/prog/test_printreversealphabet.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("printreversealphabet") + lib.ChallengeMain("printreversealphabet") } diff --git a/tests/go/prog/test_raid2.go b/tests/go/prog/test_raid2.go index 2fee0967..8898abe8 100644 --- a/tests/go/prog/test_raid2.go +++ b/tests/go/prog/test_raid2.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { valid := [][]string{ @@ -284,13 +284,13 @@ func main() { } for _, v := range valid { - z01.ChallengeMain("raid2", v...) + lib.ChallengeMain("raid2", v...) } for _, v := range invalid { - z01.ChallengeMain("raid2", v...) + lib.ChallengeMain("raid2", v...) } - z01.ChallengeMain("raid2") - z01.ChallengeMain("raid2", "not", "a", "sudoku") + lib.ChallengeMain("raid2") + lib.ChallengeMain("raid2", "not", "a", "sudoku") } diff --git a/tests/go/prog/test_raid3.go b/tests/go/prog/test_raid3.go index da043133..8cedb29f 100644 --- a/tests/go/prog/test_raid3.go +++ b/tests/go/prog/test_raid3.go @@ -4,7 +4,7 @@ import ( "os/exec" "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -12,7 +12,7 @@ func main() { b, err := exec.Command(name, arg...).CombinedOutput() s := string(b) if err != nil { - z01.Fatal(s) + lib.Fatal(s) } return s } @@ -29,7 +29,7 @@ func main() { correct = execFatal("sh", "-c", "./"+args+" "+strconv.Itoa(x)+" "+strconv.Itoa(y)+" | ./raid3") } if output != correct { - z01.Fatalf("./%s %d %d | ./raid3 prints %q instead of %q\n", + lib.Fatalf("./%s %d %d | ./raid3 prints %q instead of %q\n", args, x, y, output, correct) } } @@ -46,8 +46,8 @@ func main() { // testing all raids1 table := []string{"raid1a", "raid1b", "raid1c", "raid1d", "raid1e"} for _, s := range table { - x := z01.RandIntBetween(1, 50) - y := z01.RandIntBetween(1, 50) + x := lib.RandIntBetween(1, 50) + y := lib.RandIntBetween(1, 50) executeTest(s, x, y) } diff --git a/tests/go/prog/test_range.go b/tests/go/prog/test_range.go index 5f564481..efb83b7b 100644 --- a/tests/go/prog/test_range.go +++ b/tests/go/prog/test_range.go @@ -3,19 +3,19 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { for i := 0; i < 10; i++ { - start := z01.RandIntBetween(-20, 20) - end := z01.RandIntBetween(-20, 20) - z01.ChallengeMain("range", strconv.Itoa(start), strconv.Itoa(end)) + start := lib.RandIntBetween(-20, 20) + end := lib.RandIntBetween(-20, 20) + lib.ChallengeMain("range", strconv.Itoa(start), strconv.Itoa(end)) } - z01.ChallengeMain("range", "2", "1", "3") - z01.ChallengeMain("range", "a", "1") - z01.ChallengeMain("range", "1", "b") - z01.ChallengeMain("range", "1", "nan") - z01.ChallengeMain("range", "nan", "b") - z01.ChallengeMain("range") + lib.ChallengeMain("range", "2", "1", "3") + lib.ChallengeMain("range", "a", "1") + lib.ChallengeMain("range", "1", "b") + lib.ChallengeMain("range", "1", "nan") + lib.ChallengeMain("range", "nan", "b") + lib.ChallengeMain("range") } diff --git a/tests/go/prog/test_rectangle.go b/tests/go/prog/test_rectangle.go index 45ee27ba..8186a9cf 100644 --- a/tests/go/prog/test_rectangle.go +++ b/tests/go/prog/test_rectangle.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("rectangle") + lib.ChallengeMain("rectangle") } diff --git a/tests/go/prog/test_repeatalpha.go b/tests/go/prog/test_repeatalpha.go index 94d51d69..39ef3e39 100644 --- a/tests/go/prog/test_repeatalpha.go +++ b/tests/go/prog/test_repeatalpha.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := []string{ @@ -15,11 +15,11 @@ func main() { "MaTheMatiCs", } - args = append(args, z01.MultRandAlnum()...) + args = append(args, lib.MultRandAlnum()...) for _, v := range args { - z01.ChallengeMain("repeatalpha", v) + lib.ChallengeMain("repeatalpha", v) } - z01.ChallengeMain("repeatalpha") - z01.ChallengeMain("repeatalpha", "", "") + lib.ChallengeMain("repeatalpha") + lib.ChallengeMain("repeatalpha", "", "") } diff --git a/tests/go/prog/test_reverserange.go b/tests/go/prog/test_reverserange.go index 13233f9e..2af69b2f 100644 --- a/tests/go/prog/test_reverserange.go +++ b/tests/go/prog/test_reverserange.go @@ -3,19 +3,19 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { for i := 0; i < 10; i++ { - start := z01.RandIntBetween(-20, 20) - end := z01.RandIntBetween(-20, 20) - z01.ChallengeMain("reverserange", strconv.Itoa(start), strconv.Itoa(end)) + start := lib.RandIntBetween(-20, 20) + end := lib.RandIntBetween(-20, 20) + lib.ChallengeMain("reverserange", strconv.Itoa(start), strconv.Itoa(end)) } - z01.ChallengeMain("reverserange", "2", "1", "3") - z01.ChallengeMain("reverserange", "a", "1") - z01.ChallengeMain("reverserange", "1", "b") - z01.ChallengeMain("reverserange", "1", "nan") - z01.ChallengeMain("reverserange", "nan", "b") - z01.ChallengeMain("reverserange") + lib.ChallengeMain("reverserange", "2", "1", "3") + lib.ChallengeMain("reverserange", "a", "1") + lib.ChallengeMain("reverserange", "1", "b") + lib.ChallengeMain("reverserange", "1", "nan") + lib.ChallengeMain("reverserange", "nan", "b") + lib.ChallengeMain("reverserange") } diff --git a/tests/go/prog/test_reversestrcap.go b/tests/go/prog/test_reversestrcap.go index 68aae038..f3cf1235 100644 --- a/tests/go/prog/test_reversestrcap.go +++ b/tests/go/prog/test_reversestrcap.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := [][]string{ @@ -9,13 +9,13 @@ func main() { } for i := 0; i < 15; i++ { - args = append(args, z01.MultRandAlnum()) + args = append(args, lib.MultRandAlnum()) } args = append(args, []string{""}) for _, v := range args { - z01.ChallengeMain("reversestrcap", v...) + lib.ChallengeMain("reversestrcap", v...) } - z01.ChallengeMain("reversestrcap") + lib.ChallengeMain("reversestrcap") } diff --git a/tests/go/prog/test_revparams.go b/tests/go/prog/test_revparams.go index 8aa5dee4..58654b73 100644 --- a/tests/go/prog/test_revparams.go +++ b/tests/go/prog/test_revparams.go @@ -1,8 +1,8 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("revparams", "choumi", "is", "the", "best", "cat") - z01.ChallengeMain("revparams", z01.MultRandWords()...) + lib.ChallengeMain("revparams", "choumi", "is", "the", "best", "cat") + lib.ChallengeMain("revparams", lib.MultRandWords()...) } diff --git a/tests/go/prog/test_revwstr.go b/tests/go/prog/test_revwstr.go index b5509d73..b20eb9cb 100644 --- a/tests/go/prog/test_revwstr.go +++ b/tests/go/prog/test_revwstr.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { table := []string{ @@ -13,19 +13,19 @@ func main() { // 3 valid random sentences with no spaces at the beginning nor the end and only one space for separator. for i := 0; i < 3; i++ { - numberOfWords := z01.RandIntBetween(1, 6) - sentence := z01.RandAlnum() + numberOfWords := lib.RandIntBetween(1, 6) + sentence := lib.RandAlnum() for j := 0; j < numberOfWords; j++ { - sentence += " " + z01.RandAlnum() + sentence += " " + lib.RandAlnum() } - sentence += z01.RandAlnum() + sentence += lib.RandAlnum() table = append(table, sentence) } for _, s := range table { - z01.ChallengeMain("revwstr", s) + lib.ChallengeMain("revwstr", s) } - z01.ChallengeMain("revwstr") - z01.ChallengeMain("revwstr", "1param", "2param", "3param", "4param") + lib.ChallengeMain("revwstr") + lib.ChallengeMain("revwstr", "1param", "2param", "3param", "4param") } diff --git a/tests/go/prog/test_robottoorigin.go b/tests/go/prog/test_robottoorigin.go index 20f62a98..8f2eab33 100644 --- a/tests/go/prog/test_robottoorigin.go +++ b/tests/go/prog/test_robottoorigin.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { table := []string{ @@ -9,10 +9,10 @@ func main() { } for i := 0; i < 15; i++ { - table = append(table, z01.RandStr(z01.RandIntBetween(5, 1000), "UDLR")) + table = append(table, lib.RandStr(lib.RandIntBetween(5, 1000), "UDLR")) } for _, arg := range table { - z01.ChallengeMain("robottoorigin", arg) + lib.ChallengeMain("robottoorigin", arg) } } diff --git a/tests/go/prog/test_romannumbers.go b/tests/go/prog/test_romannumbers.go index 83abf7e0..ef8f706a 100644 --- a/tests/go/prog/test_romannumbers.go +++ b/tests/go/prog/test_romannumbers.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -16,9 +16,9 @@ func main() { "good luck", } for i := 0; i < 7; i++ { - rand = append(rand, strconv.Itoa(z01.RandIntBetween(0, 4000))) + rand = append(rand, strconv.Itoa(lib.RandIntBetween(0, 4000))) } for _, v := range rand { - z01.ChallengeMain("romannumbers", v) + lib.ChallengeMain("romannumbers", v) } } diff --git a/tests/go/prog/test_rostring.go b/tests/go/prog/test_rostring.go index 6557842f..9c225a9e 100644 --- a/tests/go/prog/test_rostring.go +++ b/tests/go/prog/test_rostring.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := []string{ @@ -9,12 +9,12 @@ func main() { " AkjhZ zLKIJz , 23y", "", } - args = append(args, z01.MultRandWords()...) + args = append(args, lib.MultRandWords()...) for _, arg := range args { - z01.ChallengeMain("rostring", arg) + lib.ChallengeMain("rostring", arg) } - z01.ChallengeMain("rostring") - z01.ChallengeMain("rostring", "this", "is") - z01.ChallengeMain("rostring", "not", "good", "for you") + lib.ChallengeMain("rostring") + lib.ChallengeMain("rostring", "this", "is") + lib.ChallengeMain("rostring", "not", "good", "for you") } diff --git a/tests/go/prog/test_rot13.go b/tests/go/prog/test_rot13.go index 59d6ea34..860a173f 100644 --- a/tests/go/prog/test_rot13.go +++ b/tests/go/prog/test_rot13.go @@ -1,16 +1,16 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - table := append(z01.MultRandWords(), + table := append(lib.MultRandWords(), " ", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPRSTUVWXYZ", "a b c d e f g h ijklmnopqrstuvwxyz A B C D E FGHIJKLMNOPRSTUVWXYZ", ) for _, s := range table { - z01.ChallengeMain("rot13", s) + lib.ChallengeMain("rot13", s) } - z01.ChallengeMain("rot13", "1 argument", "2 arguments") - z01.ChallengeMain("rot13", "1 argument", "2 arguments", "3 arguments") + lib.ChallengeMain("rot13", "1 argument", "2 arguments") + lib.ChallengeMain("rot13", "1 argument", "2 arguments", "3 arguments") } diff --git a/tests/go/prog/test_rotatevowels.go b/tests/go/prog/test_rotatevowels.go index f564b2fb..a4c2442c 100644 --- a/tests/go/prog/test_rotatevowels.go +++ b/tests/go/prog/test_rotatevowels.go @@ -3,27 +3,27 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - Lower := z01.RuneRange('a', 'z') - Upper := z01.RuneRange('A', 'Z') + Lower := lib.RuneRange('a', 'z') + Upper := lib.RuneRange('A', 'Z') letters := Lower + Upper + " " var arr []string for i := 0; i < 10; i++ { - str := z01.RandStr(z01.RandIntBetween(2, 20), letters) + str := lib.RandStr(lib.RandIntBetween(2, 20), letters) arr = append(arr, str) } arr = append(arr, "") for _, v := range arr { - z01.ChallengeMain("rotatevowels", strings.Fields(v)...) + lib.ChallengeMain("rotatevowels", strings.Fields(v)...) } - z01.ChallengeMain("rotatevowels", "Hello World") - z01.ChallengeMain("rotatevowels", "HEllO World", "problem solved") - z01.ChallengeMain("rotatevowels", "str", "shh", "psst") - z01.ChallengeMain("rotatevowels", "happy thoughts", "good luck") - z01.ChallengeMain("rotatevowels", "al's elEphAnt is overly underweight!") - z01.ChallengeMain("rotatevowels", "aEi", "Ou") + lib.ChallengeMain("rotatevowels", "Hello World") + lib.ChallengeMain("rotatevowels", "HEllO World", "problem solved") + lib.ChallengeMain("rotatevowels", "str", "shh", "psst") + lib.ChallengeMain("rotatevowels", "happy thoughts", "good luck") + lib.ChallengeMain("rotatevowels", "al's elEphAnt is overly underweight!") + lib.ChallengeMain("rotatevowels", "aEi", "Ou") } diff --git a/tests/go/prog/test_rpncalc.go b/tests/go/prog/test_rpncalc.go index 860fb3fe..99addaad 100644 --- a/tests/go/prog/test_rpncalc.go +++ b/tests/go/prog/test_rpncalc.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { args := []string{ @@ -21,8 +21,8 @@ func main() { } for _, v := range args { - z01.ChallengeMain("rpncalc", v) + lib.ChallengeMain("rpncalc", v) } - z01.ChallengeMain("rpncalc") - z01.ChallengeMain("rpncalc", "1 2 * 3 * 4 +", "10 33 - 12 %") + lib.ChallengeMain("rpncalc") + lib.ChallengeMain("rpncalc", "1 2 * 3 * 4 +", "10 33 - 12 %") } diff --git a/tests/go/prog/test_searchreplace.go b/tests/go/prog/test_searchreplace.go index 87390c82..22b6afe6 100644 --- a/tests/go/prog/test_searchreplace.go +++ b/tests/go/prog/test_searchreplace.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { type nodeTest struct { @@ -12,12 +12,12 @@ func main() { table := []nodeTest{} for i := 0; i < 20; i++ { - letter1 := []rune(z01.RandAlnum()) - letter2 := []rune(z01.RandAlnum()) + letter1 := []rune(lib.RandAlnum()) + letter2 := []rune(lib.RandAlnum()) table = append(table, nodeTest{ - dataSearched: z01.RandWords(), + dataSearched: lib.RandWords(), letterLookedFor: string(letter1[0]), letterReplacing: string(letter2[0]), }) @@ -42,6 +42,6 @@ func main() { ) for _, arg := range table { - z01.ChallengeMain("searchreplace", arg.dataSearched, arg.letterLookedFor, arg.letterReplacing) + lib.ChallengeMain("searchreplace", arg.dataSearched, arg.letterLookedFor, arg.letterReplacing) } } diff --git a/tests/go/prog/test_sortparams.go b/tests/go/prog/test_sortparams.go index f25ad361..7278e361 100644 --- a/tests/go/prog/test_sortparams.go +++ b/tests/go/prog/test_sortparams.go @@ -1,7 +1,7 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - z01.ChallengeMain("sortparams", z01.MultRandWords()...) + lib.ChallengeMain("sortparams", lib.MultRandWords()...) } diff --git a/tests/go/prog/test_switchcase.go b/tests/go/prog/test_switchcase.go index 03a8041b..d45d8685 100644 --- a/tests/go/prog/test_switchcase.go +++ b/tests/go/prog/test_switchcase.go @@ -1,14 +1,14 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { - table := append(z01.MultRandWords(), + table := append(lib.MultRandWords(), " ", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghi jklmnop qrstuvwxyz ABCDEFGHI JKLMNOPQR STUVWXYZ ! ", ) for _, s := range table { - z01.ChallengeMain("switchcase", s) + lib.ChallengeMain("switchcase", s) } } diff --git a/tests/go/prog/test_tabmult.go b/tests/go/prog/test_tabmult.go index c4d0966c..bac11f84 100644 --- a/tests/go/prog/test_tabmult.go +++ b/tests/go/prog/test_tabmult.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -12,10 +12,10 @@ func main() { table = append(table, strconv.Itoa(i)) } for i := 0; i < 5; i++ { - table = append(table, strconv.Itoa(z01.RandIntBetween(1, 1000))) + table = append(table, strconv.Itoa(lib.RandIntBetween(1, 1000))) } for _, arg := range table { - z01.ChallengeMain("tabmult", arg) + lib.ChallengeMain("tabmult", arg) } } diff --git a/tests/go/prog/test_tetrisoptimizer.go b/tests/go/prog/test_tetrisoptimizer.go index f1f1dffb..558afdc2 100644 --- a/tests/go/prog/test_tetrisoptimizer.go +++ b/tests/go/prog/test_tetrisoptimizer.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "github.com/01-edu/z01" + "../lib" ) type ( @@ -75,12 +75,12 @@ func main() { // load samples f, err := os.Open(samples) if err != nil { - z01.Fatal("Cannot open directory", err) + lib.Fatal("Cannot open directory", err) } defer f.Close() filenames, err := f.Readdirnames(0) if err != nil { - z01.Fatal("Cannot read directory", err) + lib.Fatal("Cannot read directory", err) } // separate samples into good (valid) and bad (invalid) files @@ -99,7 +99,7 @@ func main() { cmd := exec.Command("go", "build", "-o", exe, "-trimpath", "-ldflags", "-s -w", student) cmd.Env = append(os.Environ(), "CGO_ENABLED=0", "GOARCH=amd64") if out, err := cmd.CombinedOutput(); err != nil { - z01.Fatal("Cannot compile :", string(out)) + lib.Fatal("Cannot compile :", string(out)) } ctx, cancel := context.WithTimeout(context.Background(), timeout) @@ -109,7 +109,7 @@ func main() { for _, badFile := range badFiles { b, _ := exec.CommandContext(ctx, exe, badFile).CombinedOutput() if string(b) != "ERROR\n" { - z01.Fatal(`Failed to handle bad format, should output : "ERROR\n"`) + lib.Fatal(`Failed to handle bad format, should output : "ERROR\n"`) } } @@ -125,35 +125,35 @@ func main() { return } if err != nil { - z01.Fatal("Failed to process a valid map : execution failed") + lib.Fatal("Failed to process a valid map : execution failed") } s := string(b) lines := strings.Split(s, "\n") if lines[len(lines)-1] != "" { - z01.Fatal(`Failed to process a valid map : missing final '\n'`) + lib.Fatal(`Failed to process a valid map : missing final '\n'`) } lines = lines[:len(lines)-1] for _, line := range lines { if len(line) != len(lines) { - z01.Fatal("Failed to process a valid map : invalid square, it is expected as many lines as characters") + lib.Fatal("Failed to process a valid map : invalid square, it is expected as many lines as characters") } } if len(lines) < size { - z01.Fatal("Failed to process a valid map : the square cannot be that small") + lib.Fatal("Failed to process a valid map : the square cannot be that small") } b, err = ioutil.ReadFile(goodFile) if err != nil { - z01.Fatal("Failed to read a valid map") + lib.Fatal("Failed to read a valid map") } pieces := strings.Split(string(b), "\n\n") surface := len(lines) * len(lines) if strings.Count(s, ".") != surface-len(pieces)*4 { - z01.Fatal("Failed to process a valid map : the number of holes (character '.') is not correct") + lib.Fatal("Failed to process a valid map : the number of holes (character '.') is not correct") } letter := 'A' for _, piece := range pieces { if read(s, letter) != read(piece, '#') { - z01.Fatal("Failed to process a valid map : a tetromino is missing") + lib.Fatal("Failed to process a valid map : a tetromino is missing") } letter += 1 } diff --git a/tests/go/prog/test_union.go b/tests/go/prog/test_union.go index 0065b47e..653d0182 100644 --- a/tests/go/prog/test_union.go +++ b/tests/go/prog/test_union.go @@ -3,7 +3,7 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { @@ -14,14 +14,14 @@ func main() { arg5 := []string{" this is ", " wait shr"} arg6 := []string{" more ", "then", "two", "arguments"} - str1 := z01.RandAlnum() - str2 := strings.Join([]string{z01.RandAlnum(), str1, z01.RandAlnum()}, "") + str1 := lib.RandAlnum() + str2 := strings.Join([]string{lib.RandAlnum(), str1, lib.RandAlnum()}, "") arg7 := []string{str1, str2} - arg8 := []string{z01.RandAlnum(), z01.RandAlnum()} + arg8 := []string{lib.RandAlnum(), lib.RandAlnum()} args := [][]string{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8} for _, v := range args { - z01.ChallengeMain("union", v...) + lib.ChallengeMain("union", v...) } } diff --git a/tests/go/prog/test_uniqueoccurences.go b/tests/go/prog/test_uniqueoccurences.go index e20de06c..f346724e 100644 --- a/tests/go/prog/test_uniqueoccurences.go +++ b/tests/go/prog/test_uniqueoccurences.go @@ -1,6 +1,6 @@ package main -import "github.com/01-edu/z01" +import "../lib" func main() { table := []string{ @@ -11,10 +11,10 @@ func main() { } for i := 0; i < 15; i++ { - table = append(table, z01.RandStr(z01.RandIntBetween(5, 10), z01.Lower)) + table = append(table, lib.RandStr(lib.RandIntBetween(5, 10), lib.Lower)) } for _, arg := range table { - z01.ChallengeMain("uniqueoccurences", arg) + lib.ChallengeMain("uniqueoccurences", arg) } } diff --git a/tests/go/prog/test_wdmatch.go b/tests/go/prog/test_wdmatch.go index a57764c7..320a5cf7 100644 --- a/tests/go/prog/test_wdmatch.go +++ b/tests/go/prog/test_wdmatch.go @@ -3,11 +3,11 @@ package main import ( "strings" - "github.com/01-edu/z01" + "../lib" ) func main() { - table := append(z01.MultRandWords(), + table := append(lib.MultRandWords(), " ", "faya fgvvfdxcacpolhyghbreda", "faya fgvvfdxcacpolhyghbred", @@ -16,6 +16,6 @@ func main() { ) for _, s := range table { - z01.ChallengeMain("wdmatch", strings.Fields(s)...) + lib.ChallengeMain("wdmatch", strings.Fields(s)...) } } diff --git a/tests/go/prog/test_ztail.go b/tests/go/prog/test_ztail.go index e0fec4d4..d6435dd3 100644 --- a/tests/go/prog/test_ztail.go +++ b/tests/go/prog/test_ztail.go @@ -17,16 +17,16 @@ func main() { // b, errC := exec.Command("tail", args...).CombinedOutput() // correct := string(b) // b, err := exec.Command - // out, err := z01.MainOut("student/ztail", args...) + // out, err := lib.MainOut("student/ztail", args...) // if out != correct { - // z01.Fatalf("./ztail \"%s\" prints %q instead of %q\n", + // lib.Fatalf("./ztail \"%s\" prints %q instead of %q\n", // strings.Join(args, " "), out, correct) // } // if errC != nil && err == nil { - // z01.Fatalf("./ztail \"%s\" prints %q instead of %q\n", strings.Join(args, " "), "", errC) + // lib.Fatalf("./ztail \"%s\" prints %q instead of %q\n", strings.Join(args, " "), "", errC) // } // if err != nil && errC != nil && err != errC.Error() { - // z01.Fatalf("./ztail %s prints %q instead of %q\n", strings.Join(args, " "), err, errC) + // lib.Fatalf("./ztail %s prints %q instead of %q\n", strings.Join(args, " "), err, errC) // } } }