From 101c5e8be5a4be5cfe503ee3e22b2c099c4d1f5f Mon Sep 17 00:00:00 2001 From: Xavier Petit <32063953+xpetit@users.noreply.github.com> Date: Wed, 22 Apr 2020 10:36:43 +0200 Subject: [PATCH] Abandon testing package for functions, pass exercise name as an argument (no more magic) --- tests/go/abort_test.go | 8 +++----- tests/go/activebits_test.go | 8 +++----- tests/go/alphacount_test.go | 8 +++----- tests/go/any_test.go | 8 +++----- tests/go/appendrange_test.go | 8 +++----- tests/go/atoi_test.go | 7 +++---- tests/go/atoibase_test.go | 8 +++----- tests/go/basicatoi2_test.go | 7 +++---- tests/go/basicatoi_test.go | 7 +++---- tests/go/basicjoin_test.go | 8 +++----- tests/go/capitalize_test.go | 8 +++----- tests/go/collatzcountdown_test.go | 8 +++----- tests/go/compare_test.go | 8 +++----- tests/go/concat_test.go | 8 +++----- tests/go/concatparams_test.go | 8 +++----- tests/go/convertbase_test.go | 8 +++----- tests/go/countif_test.go | 8 +++----- tests/go/eightqueens_test.go | 8 +++----- tests/go/fibonacci_test.go | 8 +++----- tests/go/findnextprime_test.go | 8 +++----- tests/go/firstrune_test.go | 8 +++----- tests/go/foreach_test.go | 8 +++----- tests/go/index_test.go | 8 +++----- tests/go/isalpha_test.go | 8 +++----- tests/go/islower_test.go | 8 +++----- tests/go/isnegative_test.go | 8 +++----- tests/go/isnumeric_test.go | 7 +++---- tests/go/isprime_test.go | 8 +++----- tests/go/isprintable_test.go | 7 +++---- tests/go/issorted_test.go | 7 +++---- tests/go/isupper_test.go | 8 +++----- tests/go/iterativefactorial_test.go | 7 +++---- tests/go/iterativepower_test.go | 12 +++++------- tests/go/itoa_test.go | 8 +++----- tests/go/itoabase_test.go | 12 +++++------- tests/go/join_test.go | 8 +++----- tests/go/lastrune_test.go | 8 +++----- tests/go/makerange_test.go | 8 +++----- tests/go/map_test.go | 8 +++----- tests/go/max_test.go | 8 +++----- tests/go/nrune_test.go | 7 +++---- tests/go/printcomb2_test.go | 8 +++----- tests/go/printcomb_test.go | 8 +++----- tests/go/printcombn_test.go | 8 +++----- tests/go/printnbr_test.go | 8 +++----- tests/go/printnbrbase_test.go | 8 +++----- tests/go/printnbrinorder_test.go | 8 +++----- tests/go/printstr_test.go | 8 +++----- tests/go/printwordstables_test.go | 7 +++---- tests/go/raid1a_test.go | 8 +++----- tests/go/raid1b_test.go | 8 +++----- tests/go/raid1c_test.go | 8 +++----- tests/go/raid1d_test.go | 8 +++----- tests/go/raid1e_test.go | 8 +++----- tests/go/recursivefactorial_test.go | 7 +++---- tests/go/recursivepower_test.go | 12 +++++------- tests/go/rot14_test.go | 8 +++----- tests/go/solutions/atoibaseprog/atoibaseprog_test.go | 6 ++---- tests/go/solutions/atoiprog/atoiprog_test.go | 5 ++--- tests/go/solutions/chunk/chunk_test.go | 6 ++---- .../doppelgangerprog/doppelgangerprog_test.go | 6 ++---- tests/go/solutions/fib/fib_test.go | 6 ++---- .../findprevprimeprog/findprevprimeprog_test.go | 6 ++---- .../go/solutions/firstruneprog/firstruneprog_test.go | 6 ++---- tests/go/solutions/foldint/foldint_test.go | 6 ++---- tests/go/solutions/foreachprog/foreachprog_test.go | 6 ++---- tests/go/solutions/game23/game23_test.go | 6 ++---- .../halfcontestprog/halfcontestprog_test.go | 6 ++---- .../interestingnumber/interestingnumber_test.go | 6 ++---- tests/go/solutions/isanagram/isanagram_test.go | 6 ++---- tests/go/solutions/itoabaseprog/itoabaseprog_test.go | 10 ++++------ tests/go/solutions/itoaprog/itoaprog_test.go | 6 ++---- tests/go/solutions/lastruneprog/lastruneprog_test.go | 6 ++---- tests/go/solutions/lcm/lcm_test.go | 6 ++---- tests/go/solutions/maxprog/maxprog_test.go | 6 ++---- tests/go/solutions/nauuo/nauuo_test.go | 6 ++---- tests/go/solutions/nruneprog/nruneprog_test.go | 5 ++--- tests/go/solutions/printmemory/printmemory_test.go | 8 +++----- tests/go/solutions/priorprime/priorprime_test.go | 6 ++---- .../reachablenumberprog/reachablenumber_test.go | 6 ++---- tests/go/solutions/reduceint/reduceint_test.go | 6 ++---- .../revivethreenums/revivethreenums_test.go | 6 ++---- tests/go/solutions/sliceprog/sliceprog_test.go | 6 ++---- tests/go/solutions/splitprog/splitprog_test.go | 5 ++--- tests/go/solutions/strlenprog/strlenprog_test.go | 6 ++---- tests/go/solutions/sweetproblem/sweetproblem_test.go | 6 ++---- tests/go/solutions/twosum/twosum_test.go | 5 ++--- .../go/solutions/volumechanger/volumechanger_test.go | 6 ++---- tests/go/split_test.go | 7 +++---- tests/go/splitwhitespaces_test.go | 7 +++---- tests/go/sqrt_test.go | 8 +++----- tests/go/strlen_test.go | 8 +++----- tests/go/strrev_test.go | 8 +++----- tests/go/tolower_test.go | 8 +++----- tests/go/toupper_test.go | 8 +++----- tests/go/trimatoi_test.go | 8 +++----- tests/go/unmatch_test.go | 8 +++----- 97 files changed, 269 insertions(+), 447 deletions(-) diff --git a/tests/go/abort_test.go b/tests/go/abort_test.go index 7284eed66..773c49566 100644 --- a/tests/go/abort_test.go +++ b/tests/go/abort_test.go @@ -1,18 +1,16 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestAbort(t *testing.T) { +func main() { arg := z01.MultRandInt() arg = append(arg, z01.RandInt()) for i := 0; i < 15; i++ { - z01.Challenge(t, student.Abort, solutions.Abort, arg[0], arg[1], arg[2], arg[3], arg[4]) + z01.Challenge("Abort", student.Abort, solutions.Abort, arg[0], arg[1], arg[2], arg[3], arg[4]) arg = z01.MultRandInt() arg = append(arg, z01.RandInt()) } diff --git a/tests/go/activebits_test.go b/tests/go/activebits_test.go index 592789161..b70bda34e 100644 --- a/tests/go/activebits_test.go +++ b/tests/go/activebits_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestActiveBits(t *testing.T) { +func main() { args := []int{z01.RandIntBetween(2, 20)} for i := 0; i < 20; i++ { @@ -16,6 +14,6 @@ func TestActiveBits(t *testing.T) { } for _, v := range args { - z01.Challenge(t, student.ActiveBits, solutions.ActiveBits, v) + z01.Challenge("ActiveBits", student.ActiveBits, solutions.ActiveBits, v) } } diff --git a/tests/go/alphacount_test.go b/tests/go/alphacount_test.go index f175aacbf..50842dd33 100644 --- a/tests/go/alphacount_test.go +++ b/tests/go/alphacount_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestAlphaCount(t *testing.T) { +func main() { var arr []string for l := 0; l < 7; l++ { a := z01.RandIntBetween(5, 20) @@ -24,6 +22,6 @@ func TestAlphaCount(t *testing.T) { arr = append(arr, "Hello 78 World! 4455 /") for i := 0; i < len(arr); i++ { - z01.Challenge(t, student.AlphaCount, solutions.AlphaCount, arr[i]) + z01.Challenge("AlphaCount", student.AlphaCount, solutions.AlphaCount, arr[i]) } } diff --git a/tests/go/any_test.go b/tests/go/any_test.go index 99a4923e3..dfb620957 100644 --- a/tests/go/any_test.go +++ b/tests/go/any_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestAny(t *testing.T) { +func main() { functionsArray := []func(string) bool{solutions.IsNumeric, solutions.IsLower, solutions.IsUpper} type node struct { @@ -61,6 +59,6 @@ func TestAny(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.Any, solutions.Any, arg.f, arg.arr) + z01.Challenge("Any", student.Any, solutions.Any, arg.f, arg.arr) } } diff --git a/tests/go/appendrange_test.go b/tests/go/appendrange_test.go index bc2769236..0ffb12fc5 100644 --- a/tests/go/appendrange_test.go +++ b/tests/go/appendrange_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestAppendRange(t *testing.T) { +func main() { type node struct { min int max int @@ -46,6 +44,6 @@ func TestAppendRange(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.AppendRange, solutions.AppendRange, arg.min, arg.max) + z01.Challenge("AppendRange", student.AppendRange, solutions.AppendRange, arg.min, arg.max) } } diff --git a/tests/go/atoi_test.go b/tests/go/atoi_test.go index df39b211e..1bf8ff95d 100644 --- a/tests/go/atoi_test.go +++ b/tests/go/atoi_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "strconv" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestAtoi(t *testing.T) { +func main() { table := make([]string, 30) for i := range table { table[i] = strconv.Itoa(z01.RandInt()) @@ -34,6 +33,6 @@ func TestAtoi(t *testing.T) { "123a45", ) for _, arg := range table { - z01.Challenge(t, student.Atoi, solutions.Atoi, arg) + z01.Challenge("Atoi", student.Atoi, solutions.Atoi, arg) } } diff --git a/tests/go/atoibase_test.go b/tests/go/atoibase_test.go index bc193fd84..b1c9c7ef1 100644 --- a/tests/go/atoibase_test.go +++ b/tests/go/atoibase_test.go @@ -1,8 +1,6 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" @@ -10,7 +8,7 @@ import ( ) // this is the function that creates the TESTS -func TestAtoiBase(t *testing.T) { +func main() { type node struct { s string base string @@ -44,6 +42,6 @@ func TestAtoiBase(t *testing.T) { node{s: "bbbbbab", base: "-ab"}, ) for _, arg := range table { - z01.Challenge(t, student.AtoiBase, solutions.AtoiBase, arg.s, arg.base) + z01.Challenge("AtoiBase", student.AtoiBase, solutions.AtoiBase, arg.s, arg.base) } } diff --git a/tests/go/basicatoi2_test.go b/tests/go/basicatoi2_test.go index a7d8b1e73..5e2626db3 100644 --- a/tests/go/basicatoi2_test.go +++ b/tests/go/basicatoi2_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "strconv" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestBasicAtoi2(t *testing.T) { +func main() { table := make([]string, 30) for i := range table { table[i] = strconv.Itoa(z01.RandPosZ()) @@ -28,6 +27,6 @@ func TestBasicAtoi2(t *testing.T) { "123.0", ) for _, arg := range table { - z01.Challenge(t, student.BasicAtoi2, solutions.BasicAtoi2, arg) + z01.Challenge("BasicAtoi2", student.BasicAtoi2, solutions.BasicAtoi2, arg) } } diff --git a/tests/go/basicatoi_test.go b/tests/go/basicatoi_test.go index 89a043a03..38a7a15b8 100644 --- a/tests/go/basicatoi_test.go +++ b/tests/go/basicatoi_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "strconv" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestBasicAtoi(t *testing.T) { +func main() { table := make([]string, 30) for i := range table { table[i] = strconv.Itoa(z01.RandPosZ()) @@ -24,6 +23,6 @@ func TestBasicAtoi(t *testing.T) { "000000", ) for _, arg := range table { - z01.Challenge(t, student.BasicAtoi, solutions.BasicAtoi, arg) + z01.Challenge("BasicAtoi", student.BasicAtoi, solutions.BasicAtoi, arg) } } diff --git a/tests/go/basicjoin_test.go b/tests/go/basicjoin_test.go index d08842763..8d71bc7fb 100644 --- a/tests/go/basicjoin_test.go +++ b/tests/go/basicjoin_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestBasicJoin(t *testing.T) { +func main() { table := [][]string{} // 30 valid pair of ramdom slice of strings to concatenate @@ -20,6 +18,6 @@ func TestBasicJoin(t *testing.T) { []string{"Hello!", " How are you?", "well and yourself?"}, ) for _, arg := range table { - z01.Challenge(t, student.BasicJoin, solutions.BasicJoin, arg) + z01.Challenge("BasicJoin", student.BasicJoin, solutions.BasicJoin, arg) } } diff --git a/tests/go/capitalize_test.go b/tests/go/capitalize_test.go index b70f3884d..d9d2d1340 100644 --- a/tests/go/capitalize_test.go +++ b/tests/go/capitalize_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestCapitalize(t *testing.T) { +func main() { table := append( z01.MultRandASCII(), "Hello! How are you? How+are+things+4you?", @@ -21,6 +19,6 @@ func TestCapitalize(t *testing.T) { "9a LALALA!", ) for _, arg := range table { - z01.Challenge(t, student.Capitalize, solutions.Capitalize, arg) + z01.Challenge("Capitalize", student.Capitalize, solutions.Capitalize, arg) } } diff --git a/tests/go/collatzcountdown_test.go b/tests/go/collatzcountdown_test.go index b1fb8e38e..02fa4fd72 100644 --- a/tests/go/collatzcountdown_test.go +++ b/tests/go/collatzcountdown_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestCollatzCountdown(t *testing.T) { +func main() { args := []int{z01.RandIntBetween(-6, 20)} args = append(args, -5, 0) for i := 0; i < 20; i++ { @@ -16,6 +14,6 @@ func TestCollatzCountdown(t *testing.T) { } for _, v := range args { - z01.Challenge(t, student.CollatzCountdown, solutions.CollatzCountdown, v) + z01.Challenge("CollatzCountdown", student.CollatzCountdown, solutions.CollatzCountdown, v) } } diff --git a/tests/go/compare_test.go b/tests/go/compare_test.go index 95039ff91..5ac3ca5c2 100644 --- a/tests/go/compare_test.go +++ b/tests/go/compare_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestCompare(t *testing.T) { +func main() { type node struct { s string toCompare string @@ -47,6 +45,6 @@ func TestCompare(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.Compare, solutions.Compare, arg.s, arg.toCompare) + z01.Challenge("Compare", student.Compare, solutions.Compare, arg.s, arg.toCompare) } } diff --git a/tests/go/concat_test.go b/tests/go/concat_test.go index 9fd715d5e..964d8971d 100644 --- a/tests/go/concat_test.go +++ b/tests/go/concat_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestConcat(t *testing.T) { +func main() { table := [][]string{} // 30 valid pair of ramdom strings to concatenate @@ -21,6 +19,6 @@ func TestConcat(t *testing.T) { []string{"Hello!", " How are you?"}, ) for _, arg := range table { - z01.Challenge(t, student.Concat, solutions.Concat, arg[0], arg[1]) + z01.Challenge("Concat", student.Concat, solutions.Concat, arg[0], arg[1]) } } diff --git a/tests/go/concatparams_test.go b/tests/go/concatparams_test.go index b9420e641..226497da9 100644 --- a/tests/go/concatparams_test.go +++ b/tests/go/concatparams_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestConcatParams(t *testing.T) { +func main() { table := [][]string{} //30 random slice of strings @@ -23,6 +21,6 @@ func TestConcatParams(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.ConcatParams, solutions.ConcatParams, arg) + z01.Challenge("ConcatParams", student.ConcatParams, solutions.ConcatParams, arg) } } diff --git a/tests/go/convertbase_test.go b/tests/go/convertbase_test.go index b6ba974a3..a45f7e76d 100644 --- a/tests/go/convertbase_test.go +++ b/tests/go/convertbase_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestConvertBase(t *testing.T) { +func main() { type node struct { nbr string baseFrom string @@ -36,6 +34,6 @@ func TestConvertBase(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.ConvertBase, solutions.ConvertBase, arg.nbr, arg.baseFrom, arg.baseTo) + z01.Challenge("ConvertBase", student.ConvertBase, solutions.ConvertBase, arg.nbr, arg.baseFrom, arg.baseTo) } } diff --git a/tests/go/countif_test.go b/tests/go/countif_test.go index 0e03ed716..ff042f810 100644 --- a/tests/go/countif_test.go +++ b/tests/go/countif_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestCountIf(t *testing.T) { +func main() { functionsArray := []func(string) bool{solutions.IsNumeric, solutions.IsLower, solutions.IsUpper} type node struct { @@ -62,6 +60,6 @@ func TestCountIf(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.CountIf, solutions.CountIf, arg.f, arg.arr) + z01.Challenge("CountIf", student.CountIf, solutions.CountIf, arg.f, arg.arr) } } diff --git a/tests/go/eightqueens_test.go b/tests/go/eightqueens_test.go index affcfa7e5..2e32e3372 100644 --- a/tests/go/eightqueens_test.go +++ b/tests/go/eightqueens_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestEightQueens(t *testing.T) { - z01.Challenge(t, student.EightQueens, solutions.EightQueens) +func main() { + z01.Challenge("EightQueens", student.EightQueens, solutions.EightQueens) } diff --git a/tests/go/fibonacci_test.go b/tests/go/fibonacci_test.go index 28ba9b159..9b612ec57 100644 --- a/tests/go/fibonacci_test.go +++ b/tests/go/fibonacci_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestFibonacci(t *testing.T) { +func main() { table := append( z01.MultRandIntBetween(0, 25), 4, @@ -17,6 +15,6 @@ func TestFibonacci(t *testing.T) { -5, ) for _, arg := range table { - z01.Challenge(t, student.Fibonacci, solutions.Fibonacci, arg) + z01.Challenge("Fibonacci", student.Fibonacci, solutions.Fibonacci, arg) } } diff --git a/tests/go/findnextprime_test.go b/tests/go/findnextprime_test.go index a72140ec6..4ae3d2ff2 100644 --- a/tests/go/findnextprime_test.go +++ b/tests/go/findnextprime_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestFindNextPrime(t *testing.T) { +func main() { table := append( z01.MultRandIntBetween(-1000000, 1000000), 0, @@ -31,6 +29,6 @@ func TestFindNextPrime(t *testing.T) { 1000000088, ) for _, arg := range table { - z01.Challenge(t, student.FindNextPrime, solutions.FindNextPrime, arg) + z01.Challenge("FindNextPrime", student.FindNextPrime, solutions.FindNextPrime, arg) } } diff --git a/tests/go/firstrune_test.go b/tests/go/firstrune_test.go index a3ba8fa1d..9a99df91a 100644 --- a/tests/go/firstrune_test.go +++ b/tests/go/firstrune_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestFirstRune(t *testing.T) { +func main() { table := append( z01.MultRandASCII(), "Hello!", @@ -18,6 +16,6 @@ func TestFirstRune(t *testing.T) { "♥01", ) for _, arg := range table { - z01.Challenge(t, student.FirstRune, solutions.FirstRune, arg) + z01.Challenge("FirstRune", student.FirstRune, solutions.FirstRune, arg) } } diff --git a/tests/go/foreach_test.go b/tests/go/foreach_test.go index 646361971..6a4eab21c 100644 --- a/tests/go/foreach_test.go +++ b/tests/go/foreach_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestForEach(t *testing.T) { +func main() { functionsArray := []func(int){solutions.Add0, solutions.Add1, solutions.Add2, solutions.Add3} type node struct { @@ -36,6 +34,6 @@ func TestForEach(t *testing.T) { }) for _, arg := range table { - z01.Challenge(t, student.ForEach, solutions.ForEach, arg.f, arg.arr) + z01.Challenge("ForEach", student.ForEach, solutions.ForEach, arg.f, arg.arr) } } diff --git a/tests/go/index_test.go b/tests/go/index_test.go index 07f35b7be..79c87d2d7 100644 --- a/tests/go/index_test.go +++ b/tests/go/index_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestIndex(t *testing.T) { +func main() { type node struct { s string toFind string @@ -49,6 +47,6 @@ func TestIndex(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.Index, solutions.Index, arg.s, arg.toFind) + z01.Challenge("Index", student.Index, solutions.Index, arg.s, arg.toFind) } } diff --git a/tests/go/isalpha_test.go b/tests/go/isalpha_test.go index b15032f13..ed7717aa6 100644 --- a/tests/go/isalpha_test.go +++ b/tests/go/isalpha_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestIsAlpha(t *testing.T) { +func main() { table := append( z01.MultRandASCII(), "Hello! €How are you?", @@ -23,6 +21,6 @@ func TestIsAlpha(t *testing.T) { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!", ) for _, arg := range table { - z01.Challenge(t, student.IsAlpha, solutions.IsAlpha, arg) + z01.Challenge("IsAlpha", student.IsAlpha, solutions.IsAlpha, arg) } } diff --git a/tests/go/islower_test.go b/tests/go/islower_test.go index b3a88a8b2..c7bf4a12d 100644 --- a/tests/go/islower_test.go +++ b/tests/go/islower_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestIsLower(t *testing.T) { +func main() { // 15 unvalid strings in the table table := z01.MultRandASCII() @@ -42,6 +40,6 @@ func TestIsLower(t *testing.T) { "hello!", ) for _, arg := range table { - z01.Challenge(t, student.IsLower, solutions.IsLower, arg) + z01.Challenge("IsLower", student.IsLower, solutions.IsLower, arg) } } diff --git a/tests/go/isnegative_test.go b/tests/go/isnegative_test.go index 22fb51018..503655d7b 100644 --- a/tests/go/isnegative_test.go +++ b/tests/go/isnegative_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestIsNegative(t *testing.T) { +func main() { table := append( z01.MultRandInt(), z01.MinInt, @@ -17,6 +15,6 @@ func TestIsNegative(t *testing.T) { 0, ) for _, arg := range table { - z01.Challenge(t, student.IsNegative, solutions.IsNegative, arg) + z01.Challenge("IsNegative", student.IsNegative, solutions.IsNegative, arg) } } diff --git a/tests/go/isnumeric_test.go b/tests/go/isnumeric_test.go index 6995bda5c..38a95d41a 100644 --- a/tests/go/isnumeric_test.go +++ b/tests/go/isnumeric_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "strconv" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestIsNumeric(t *testing.T) { +func main() { // 15 unvalid strings in the table table := z01.MultRandASCII() @@ -35,6 +34,6 @@ func TestIsNumeric(t *testing.T) { "01,02,03", ) for _, arg := range table { - z01.Challenge(t, student.IsNumeric, solutions.IsNumeric, arg) + z01.Challenge("IsNumeric", student.IsNumeric, solutions.IsNumeric, arg) } } diff --git a/tests/go/isprime_test.go b/tests/go/isprime_test.go index b6efce22a..aea1d3407 100644 --- a/tests/go/isprime_test.go +++ b/tests/go/isprime_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestIsPrime(t *testing.T) { +func main() { table := append( z01.MultRandIntBetween(-1000000, 1000000), 0, @@ -30,6 +28,6 @@ func TestIsPrime(t *testing.T) { 1000000087, ) for _, arg := range table { - z01.Challenge(t, student.IsPrime, solutions.IsPrime, arg) + z01.Challenge("IsPrime", student.IsPrime, solutions.IsPrime, arg) } } diff --git a/tests/go/isprintable_test.go b/tests/go/isprintable_test.go index 88fa0c6cd..aacc300a4 100644 --- a/tests/go/isprintable_test.go +++ b/tests/go/isprintable_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "math/rand" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestIsPrintable(t *testing.T) { +func main() { // 15 unvalid strings in the table table := z01.MultRandASCII() @@ -45,6 +44,6 @@ func TestIsPrintable(t *testing.T) { "\n", ) for _, arg := range table { - z01.Challenge(t, student.IsPrintable, solutions.IsPrintable, arg) + z01.Challenge("IsPrintable", student.IsPrintable, solutions.IsPrintable, arg) } } diff --git a/tests/go/issorted_test.go b/tests/go/issorted_test.go index 3288bd90b..83981a141 100644 --- a/tests/go/issorted_test.go +++ b/tests/go/issorted_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "sort" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestIsSorted(t *testing.T) { +func main() { functionsArray := []func(int, int) int{solutions.IsSortedByDiff, solutions.IsSortedBy1, solutions.IsSortedBy10} type node struct { @@ -76,6 +75,6 @@ func TestIsSorted(t *testing.T) { }) for _, arg := range table { - z01.Challenge(t, student.IsSorted, solutions.IsSorted, arg.f, arg.arr) + z01.Challenge("IsSorted", student.IsSorted, solutions.IsSorted, arg.f, arg.arr) } } diff --git a/tests/go/isupper_test.go b/tests/go/isupper_test.go index 831ab9603..3acae4dbb 100644 --- a/tests/go/isupper_test.go +++ b/tests/go/isupper_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestIsUpper(t *testing.T) { +func main() { // 15 unvalid strings in the table table := z01.MultRandASCII() @@ -44,6 +42,6 @@ func TestIsUpper(t *testing.T) { "HELLO!", ) for _, arg := range table { - z01.Challenge(t, student.IsUpper, solutions.IsUpper, arg) + z01.Challenge("IsUpper", student.IsUpper, solutions.IsUpper, arg) } } diff --git a/tests/go/iterativefactorial_test.go b/tests/go/iterativefactorial_test.go index 515291192..3e9c986fe 100644 --- a/tests/go/iterativefactorial_test.go +++ b/tests/go/iterativefactorial_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "math/bits" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestIterativeFactorial(t *testing.T) { +func main() { table := append( z01.MultRandInt(), z01.IntRange(0, 12)..., @@ -19,6 +18,6 @@ func TestIterativeFactorial(t *testing.T) { table = append(table, z01.IntRange(13, 20)...) } for _, arg := range table { - z01.Challenge(t, student.IterativeFactorial, solutions.IterativeFactorial, arg) + z01.Challenge("IterativeFactorial", student.IterativeFactorial, solutions.IterativeFactorial, arg) } } diff --git a/tests/go/iterativepower_test.go b/tests/go/iterativepower_test.go index ad5b47146..8f68e067f 100644 --- a/tests/go/iterativepower_test.go +++ b/tests/go/iterativepower_test.go @@ -1,22 +1,20 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestIterativePower(t *testing.T) { +func main() { i := 0 for i < 30 { nb := z01.RandIntBetween(-8, 8) power := z01.RandIntBetween(-10, 10) - z01.Challenge(t, student.IterativePower, solutions.IterativePower, nb, power) + z01.Challenge("IterativePower", student.IterativePower, solutions.IterativePower, nb, power) i++ } - z01.Challenge(t, student.IterativePower, solutions.IterativePower, 0, 0) - z01.Challenge(t, student.IterativePower, solutions.IterativePower, 0, 1) + z01.Challenge("IterativePower", student.IterativePower, solutions.IterativePower, 0, 0) + z01.Challenge("IterativePower", student.IterativePower, solutions.IterativePower, 0, 1) } diff --git a/tests/go/itoa_test.go b/tests/go/itoa_test.go index d1dae47e2..7a7215a32 100644 --- a/tests/go/itoa_test.go +++ b/tests/go/itoa_test.go @@ -1,16 +1,14 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestItoa(t *testing.T) { +func main() { for i := 0; i < 50; i++ { arg := z01.RandIntBetween(-2000000000, 2000000000) - z01.Challenge(t, student.Itoa, solutions.Itoa, arg) + z01.Challenge("Itoa", student.Itoa, solutions.Itoa, arg) } } diff --git a/tests/go/itoabase_test.go b/tests/go/itoabase_test.go index 66e03bfe6..62479e103 100644 --- a/tests/go/itoabase_test.go +++ b/tests/go/itoabase_test.go @@ -1,23 +1,21 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestItoaBase(t *testing.T) { +func main() { for i := 0; i < 30; i++ { value := z01.RandIntBetween(-1000000, 1000000) base := z01.RandIntBetween(2, 16) - z01.Challenge(t, student.ItoaBase, solutions.ItoaBase, value, base) + z01.Challenge("ItoaBase", student.ItoaBase, solutions.ItoaBase, value, base) } for i := 0; i < 5; i++ { base := z01.RandIntBetween(2, 16) - z01.Challenge(t, student.ItoaBase, solutions.ItoaBase, z01.MaxInt, base) - z01.Challenge(t, student.ItoaBase, solutions.ItoaBase, z01.MinInt, base) + z01.Challenge("ItoaBase", student.ItoaBase, solutions.ItoaBase, z01.MaxInt, base) + z01.Challenge("ItoaBase", student.ItoaBase, solutions.ItoaBase, z01.MinInt, base) } } diff --git a/tests/go/join_test.go b/tests/go/join_test.go index daaa09532..6a2de6599 100644 --- a/tests/go/join_test.go +++ b/tests/go/join_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestJoin(t *testing.T) { +func main() { arg1 := []string{"hello", "how", "are", "you", "doing"} arg2 := []string{"fine", "and", "you"} arg3 := []string{"I'm", "O.K."} @@ -22,6 +20,6 @@ func TestJoin(t *testing.T) { //random position for the array of separators posS := z01.RandIntBetween(0, len(seps)-1) - z01.Challenge(t, student.Join, solutions.Join, args[posA], seps[posS]) + z01.Challenge("Join", student.Join, solutions.Join, args[posA], seps[posS]) } } diff --git a/tests/go/lastrune_test.go b/tests/go/lastrune_test.go index 52ab5d35f..963286a84 100644 --- a/tests/go/lastrune_test.go +++ b/tests/go/lastrune_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestLastRune(t *testing.T) { +func main() { table := z01.MultRandASCII() table = append(table, "Hello!", @@ -18,6 +16,6 @@ func TestLastRune(t *testing.T) { z01.RandStr(z01.RandIntBetween(1, 15), z01.RandAlnum()), ) for _, arg := range table { - z01.Challenge(t, student.LastRune, solutions.LastRune, arg) + z01.Challenge("LastRune", student.LastRune, solutions.LastRune, arg) } } diff --git a/tests/go/makerange_test.go b/tests/go/makerange_test.go index c97900855..4c1756292 100644 --- a/tests/go/makerange_test.go +++ b/tests/go/makerange_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestMakeRange(t *testing.T) { +func main() { type node struct { min int max int @@ -45,6 +43,6 @@ func TestMakeRange(t *testing.T) { node{min: 10, max: 5}, ) for _, arg := range table { - z01.Challenge(t, student.MakeRange, solutions.MakeRange, arg.min, arg.max) + z01.Challenge("MakeRange", student.MakeRange, solutions.MakeRange, arg.min, arg.max) } } diff --git a/tests/go/map_test.go b/tests/go/map_test.go index 54129974c..dfbc9ec77 100644 --- a/tests/go/map_test.go +++ b/tests/go/map_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestMap(t *testing.T) { +func main() { functionsArray := []func(int) bool{solutions.IsPositive, solutions.IsNegative0, solutions.IsPrime} type node struct { @@ -34,6 +32,6 @@ func TestMap(t *testing.T) { }) for _, arg := range table { - z01.Challenge(t, student.Map, solutions.Map, arg.f, arg.arr) + z01.Challenge("Map", student.Map, solutions.Map, arg.f, arg.arr) } } diff --git a/tests/go/max_test.go b/tests/go/max_test.go index ebaa3adc6..77ef9b837 100644 --- a/tests/go/max_test.go +++ b/tests/go/max_test.go @@ -1,19 +1,17 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestMax(t *testing.T) { +func main() { args := []int{z01.RandInt()} limit := z01.RandIntBetween(20, 50) for i := 0; i < limit; i++ { args = append(args, z01.RandInt()) } - z01.Challenge(t, student.Max, solutions.Max, args) + z01.Challenge("Max", student.Max, solutions.Max, args) } diff --git a/tests/go/nrune_test.go b/tests/go/nrune_test.go index caa4d87ed..7b438e491 100644 --- a/tests/go/nrune_test.go +++ b/tests/go/nrune_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "math/rand" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestNRune(t *testing.T) { +func main() { type node struct { word string n int @@ -40,6 +39,6 @@ func TestNRune(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.NRune, solutions.NRune, arg.word, arg.n) + z01.Challenge("NRune", student.NRune, solutions.NRune, arg.word, arg.n) } } diff --git a/tests/go/printcomb2_test.go b/tests/go/printcomb2_test.go index e14cf427b..2174e4406 100644 --- a/tests/go/printcomb2_test.go +++ b/tests/go/printcomb2_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestPrintComb2(t *testing.T) { - z01.Challenge(t, student.PrintComb2, solutions.PrintComb2) +func main() { + z01.Challenge("PrintComb2", student.PrintComb2, solutions.PrintComb2) } diff --git a/tests/go/printcomb_test.go b/tests/go/printcomb_test.go index 0d0c5c6a0..4f850c171 100644 --- a/tests/go/printcomb_test.go +++ b/tests/go/printcomb_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestPrintComb(t *testing.T) { - z01.Challenge(t, student.PrintComb, solutions.PrintComb) +func main() { + z01.Challenge("PrintComb", student.PrintComb, solutions.PrintComb) } diff --git a/tests/go/printcombn_test.go b/tests/go/printcombn_test.go index 1cea9adde..158a62648 100644 --- a/tests/go/printcombn_test.go +++ b/tests/go/printcombn_test.go @@ -1,17 +1,15 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestPrintCombN(t *testing.T) { +func main() { table := []int{1, 2, 3, 4, 5, 6, 7, 8, 9} for _, arg := range table { - z01.Challenge(t, student.PrintCombN, solutions.PrintCombN, arg) + z01.Challenge("PrintCombN", student.PrintCombN, solutions.PrintCombN, arg) } } diff --git a/tests/go/printnbr_test.go b/tests/go/printnbr_test.go index 4d97e8976..0b35e176b 100644 --- a/tests/go/printnbr_test.go +++ b/tests/go/printnbr_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestPrintNbr(t *testing.T) { +func main() { table := append( z01.MultRandInt(), z01.MinInt, @@ -17,6 +15,6 @@ func TestPrintNbr(t *testing.T) { 0, ) for _, arg := range table { - z01.Challenge(t, student.PrintNbr, solutions.PrintNbr, arg) + z01.Challenge("PrintNbr", student.PrintNbr, solutions.PrintNbr, arg) } } diff --git a/tests/go/printnbrbase_test.go b/tests/go/printnbrbase_test.go index 32715d345..333180cdc 100644 --- a/tests/go/printnbrbase_test.go +++ b/tests/go/printnbrbase_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestPrintNbrBase(t *testing.T) { +func main() { type node struct { n int base string @@ -46,6 +44,6 @@ func TestPrintNbrBase(t *testing.T) { node{n: z01.MinInt, base: "0123456789"}, ) for _, arg := range table { - z01.Challenge(t, student.PrintNbrBase, solutions.PrintNbrBase, arg.n, arg.base) + z01.Challenge("PrintNbrBase", student.PrintNbrBase, solutions.PrintNbrBase, arg.n, arg.base) } } diff --git a/tests/go/printnbrinorder_test.go b/tests/go/printnbrinorder_test.go index e0f46a852..4fd8ef864 100644 --- a/tests/go/printnbrinorder_test.go +++ b/tests/go/printnbrinorder_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestPrintNbrInOrder(t *testing.T) { +func main() { table := append( z01.MultRandIntBetween(0, z01.MaxInt), z01.MaxInt, @@ -17,6 +15,6 @@ func TestPrintNbrInOrder(t *testing.T) { 0, ) for _, arg := range table { - z01.Challenge(t, student.PrintNbrInOrder, solutions.PrintNbrInOrder, arg) + z01.Challenge("PrintNbrInOrder", student.PrintNbrInOrder, solutions.PrintNbrInOrder, arg) } } diff --git a/tests/go/printstr_test.go b/tests/go/printstr_test.go index f4e253cd9..5e9ccc808 100644 --- a/tests/go/printstr_test.go +++ b/tests/go/printstr_test.go @@ -1,18 +1,16 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestPrintStr(t *testing.T) { +func main() { table := z01.MultRandASCII() table = append(table, "Hello World!") for _, arg := range table { - z01.Challenge(t, student.PrintStr, solutions.PrintStr, arg) + z01.Challenge("PrintStr", student.PrintStr, solutions.PrintStr, arg) } } diff --git a/tests/go/printwordstables_test.go b/tests/go/printwordstables_test.go index d87653373..30c6d55e9 100644 --- a/tests/go/printwordstables_test.go +++ b/tests/go/printwordstables_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "strings" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestPrintWordsTables(t *testing.T) { +func main() { table := [][]string{} //30 random slice of slice of strings @@ -23,6 +22,6 @@ func TestPrintWordsTables(t *testing.T) { []string{"Hello", "how", "are", "you?"}) for _, arg := range table { - z01.Challenge(t, student.PrintWordsTables, solutions.PrintWordsTables, arg) + z01.Challenge("PrintWordsTables", student.PrintWordsTables, solutions.PrintWordsTables, arg) } } diff --git a/tests/go/raid1a_test.go b/tests/go/raid1a_test.go index b202a9ea8..7a41ab016 100644 --- a/tests/go/raid1a_test.go +++ b/tests/go/raid1a_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestRaid1a(t *testing.T) { +func main() { // testing examples of subjects table := []int{ 5, 3, @@ -28,7 +26,7 @@ func TestRaid1a(t *testing.T) { //Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i = i + 2 { if i != len(table)-1 { - z01.Challenge(t, solutions.Raid1a, student.Raid1a, table[i], table[i+1]) + z01.Challenge("Raid1a", solutions.Raid1a, student.Raid1a, table[i], table[i+1]) } } } diff --git a/tests/go/raid1b_test.go b/tests/go/raid1b_test.go index 17915075b..a832c215c 100644 --- a/tests/go/raid1b_test.go +++ b/tests/go/raid1b_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestRaid1b(t *testing.T) { +func main() { // testing examples of subjects table := []int{ 5, 3, @@ -28,7 +26,7 @@ func TestRaid1b(t *testing.T) { //Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i = i + 2 { if i != len(table)-1 { - z01.Challenge(t, solutions.Raid1b, student.Raid1b, table[i], table[i+1]) + z01.Challenge("Raid1b", solutions.Raid1b, student.Raid1b, table[i], table[i+1]) } } } diff --git a/tests/go/raid1c_test.go b/tests/go/raid1c_test.go index c55fcd987..1e864814c 100644 --- a/tests/go/raid1c_test.go +++ b/tests/go/raid1c_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestRaid1c(t *testing.T) { +func main() { // testing examples of subjects table := []int{ 5, 3, @@ -28,7 +26,7 @@ func TestRaid1c(t *testing.T) { //Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i = i + 2 { if i != len(table)-1 { - z01.Challenge(t, solutions.Raid1c, student.Raid1c, table[i], table[i+1]) + z01.Challenge("Raid1c", solutions.Raid1c, student.Raid1c, table[i], table[i+1]) } } } diff --git a/tests/go/raid1d_test.go b/tests/go/raid1d_test.go index 4b3d60fd1..12bb7db53 100644 --- a/tests/go/raid1d_test.go +++ b/tests/go/raid1d_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestRaid1d(t *testing.T) { +func main() { // testing examples of subjects table := []int{ 5, 3, @@ -28,7 +26,7 @@ func TestRaid1d(t *testing.T) { //Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i = i + 2 { if i != len(table)-1 { - z01.Challenge(t, solutions.Raid1d, student.Raid1d, table[i], table[i+1]) + z01.Challenge("Raid1d", solutions.Raid1d, student.Raid1d, table[i], table[i+1]) } } } diff --git a/tests/go/raid1e_test.go b/tests/go/raid1e_test.go index 4cc6ae3a0..299df5b1c 100644 --- a/tests/go/raid1e_test.go +++ b/tests/go/raid1e_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestRaid1e(t *testing.T) { +func main() { // testing examples of subjects table := []int{ 5, 3, @@ -28,7 +26,7 @@ func TestRaid1e(t *testing.T) { //Tests all possibilities including 0 0, -x y, x -y for i := 0; i < len(table); i = i + 2 { if i != len(table)-1 { - z01.Challenge(t, solutions.Raid1e, student.Raid1e, table[i], table[i+1]) + z01.Challenge("Raid1e", solutions.Raid1e, student.Raid1e, table[i], table[i+1]) } } } diff --git a/tests/go/recursivefactorial_test.go b/tests/go/recursivefactorial_test.go index d3cfbc0b0..029a5e105 100644 --- a/tests/go/recursivefactorial_test.go +++ b/tests/go/recursivefactorial_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "math/bits" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestRecursiveFactorial(t *testing.T) { +func main() { table := append( z01.MultRandInt(), z01.IntRange(0, 12)..., @@ -19,6 +18,6 @@ func TestRecursiveFactorial(t *testing.T) { table = append(table, z01.IntRange(13, 20)...) } for _, arg := range table { - z01.Challenge(t, student.RecursiveFactorial, solutions.RecursiveFactorial, arg) + z01.Challenge("RecursiveFactorial", student.RecursiveFactorial, solutions.RecursiveFactorial, arg) } } diff --git a/tests/go/recursivepower_test.go b/tests/go/recursivepower_test.go index 151e47b32..83adb31e1 100644 --- a/tests/go/recursivepower_test.go +++ b/tests/go/recursivepower_test.go @@ -1,22 +1,20 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestRecursivePower(t *testing.T) { +func main() { i := 0 for i < 30 { nb := z01.RandIntBetween(-8, 8) power := z01.RandIntBetween(-10, 10) - z01.Challenge(t, student.RecursivePower, solutions.RecursivePower, nb, power) + z01.Challenge("RecursivePower", student.RecursivePower, solutions.RecursivePower, nb, power) i++ } - z01.Challenge(t, student.RecursivePower, solutions.RecursivePower, 0, 0) - z01.Challenge(t, student.RecursivePower, solutions.RecursivePower, 0, 1) + z01.Challenge("RecursivePower", student.RecursivePower, solutions.RecursivePower, 0, 0) + z01.Challenge("RecursivePower", student.RecursivePower, solutions.RecursivePower, 0, 1) } diff --git a/tests/go/rot14_test.go b/tests/go/rot14_test.go index 004099374..e85dbdf5f 100644 --- a/tests/go/rot14_test.go +++ b/tests/go/rot14_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solution "./solutions" student "./student" ) -func TestRot14(t *testing.T) { +func main() { type nodeTest struct { data []string } @@ -24,7 +22,7 @@ func TestRot14(t *testing.T) { for _, arg := range table { for _, s := range arg.data { - z01.Challenge(t, solution.Rot14, student.Rot14, s) + z01.Challenge("Rot14", solution.Rot14, student.Rot14, s) } } } diff --git a/tests/go/solutions/atoibaseprog/atoibaseprog_test.go b/tests/go/solutions/atoibaseprog/atoibaseprog_test.go index d728da319..9a67e7603 100644 --- a/tests/go/solutions/atoibaseprog/atoibaseprog_test.go +++ b/tests/go/solutions/atoibaseprog/atoibaseprog_test.go @@ -1,15 +1,13 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) // this is the function that creates the TESTS -func TestAtoiBaseProg(t *testing.T) { +func main() { type node struct { s string base string @@ -43,6 +41,6 @@ func TestAtoiBaseProg(t *testing.T) { node{s: "bbbbbab", base: "-ab"}, ) for _, arg := range table { - z01.Challenge(t, AtoiBase, solutions.AtoiBase, arg.s, arg.base) + z01.Challenge("AtoiBaseProg", AtoiBase, solutions.AtoiBase, arg.s, arg.base) } } diff --git a/tests/go/solutions/atoiprog/atoiprog_test.go b/tests/go/solutions/atoiprog/atoiprog_test.go index 2cb7d3f1e..8c15e5f56 100644 --- a/tests/go/solutions/atoiprog/atoiprog_test.go +++ b/tests/go/solutions/atoiprog/atoiprog_test.go @@ -2,14 +2,13 @@ package main import ( "strconv" - "testing" "github.com/01-edu/z01" solutions "../../solutions" ) -func TestAtoiProg(t *testing.T) { +func main() { table := make([]string, 30) for i := range table { table[i] = strconv.Itoa(z01.RandInt()) @@ -33,6 +32,6 @@ func TestAtoiProg(t *testing.T) { "123a45", ) for _, arg := range table { - z01.Challenge(t, Atoi, solutions.Atoi, arg) + z01.Challenge("AtoiProg", Atoi, solutions.Atoi, arg) } } diff --git a/tests/go/solutions/chunk/chunk_test.go b/tests/go/solutions/chunk/chunk_test.go index 4bfa9914a..c86da8d84 100644 --- a/tests/go/solutions/chunk/chunk_test.go +++ b/tests/go/solutions/chunk/chunk_test.go @@ -1,8 +1,6 @@ package main import ( - "testing" - solutions "../../solutions" "github.com/01-edu/z01" ) @@ -15,7 +13,7 @@ func randomSize() []int { return randSlice } -func TestChunk(t *testing.T) { +func main() { type node struct { slice []int ch int @@ -37,6 +35,6 @@ func TestChunk(t *testing.T) { ch: 0, }) for _, args := range table { - z01.Challenge(t, Chunk, solutions.Chunk, args.slice, args.ch) + z01.Challenge("Chunk", Chunk, solutions.Chunk, args.slice, args.ch) } } diff --git a/tests/go/solutions/doppelgangerprog/doppelgangerprog_test.go b/tests/go/solutions/doppelgangerprog/doppelgangerprog_test.go index 86c0740bc..dbb9e1e3b 100644 --- a/tests/go/solutions/doppelgangerprog/doppelgangerprog_test.go +++ b/tests/go/solutions/doppelgangerprog/doppelgangerprog_test.go @@ -1,8 +1,6 @@ package main import ( - "testing" - solutions "../../solutions" "github.com/01-edu/z01" ) @@ -11,7 +9,7 @@ type node struct { big, little string } -func TestDoppelGangerProg(t *testing.T) { +func main() { table := []node{} table = append(table, @@ -48,6 +46,6 @@ func TestDoppelGangerProg(t *testing.T) { } for _, arg := range table { - z01.Challenge(t, DoppelGanger, solutions.DoppelGanger, arg.big, arg.little) + z01.Challenge("DoppelGangerProg", DoppelGanger, solutions.DoppelGanger, arg.big, arg.little) } } diff --git a/tests/go/solutions/fib/fib_test.go b/tests/go/solutions/fib/fib_test.go index aacfe69df..d0705bfbb 100644 --- a/tests/go/solutions/fib/fib_test.go +++ b/tests/go/solutions/fib/fib_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestFib(t *testing.T) { +func main() { // Declaration of the node that is going to take the group of arguments that are going to // inputed during each iteration of a Challenge between the student and the staff solution. // (note: a node is not always necessary but in this case it makes the writing of the test easier) @@ -54,7 +52,7 @@ func TestFib(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Fib, solutions.Fib, arg.n) + z01.Challenge("Fib", Fib, solutions.Fib, arg.n) } // the z01.Challenge function is here applied to each argument of the table. It musts contains: diff --git a/tests/go/solutions/findprevprimeprog/findprevprimeprog_test.go b/tests/go/solutions/findprevprimeprog/findprevprimeprog_test.go index 30882218b..a79ae3e7a 100644 --- a/tests/go/solutions/findprevprimeprog/findprevprimeprog_test.go +++ b/tests/go/solutions/findprevprimeprog/findprevprimeprog_test.go @@ -1,19 +1,17 @@ package main import ( - "testing" - solutions "../../solutions" "github.com/01-edu/z01" ) -func TestFindPrevPrimeProg(t *testing.T) { +func main() { array := []int{5, 4, 1} for i := 0; i < 7; i++ { array = append(array, z01.RandIntBetween(0, 99999)) } for i := 0; i < len(array); i++ { - z01.Challenge(t, FindPrevPrime, solutions.FindPrevPrime, array[i]) + z01.Challenge("FindPrevPrimeProg", FindPrevPrime, solutions.FindPrevPrime, array[i]) } } diff --git a/tests/go/solutions/firstruneprog/firstruneprog_test.go b/tests/go/solutions/firstruneprog/firstruneprog_test.go index 422314821..b7a94fa44 100644 --- a/tests/go/solutions/firstruneprog/firstruneprog_test.go +++ b/tests/go/solutions/firstruneprog/firstruneprog_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestFirstRuneProg(t *testing.T) { +func main() { table := append( z01.MultRandASCII(), "Hello!", @@ -17,6 +15,6 @@ func TestFirstRuneProg(t *testing.T) { "♥01", ) for _, arg := range table { - z01.Challenge(t, FirstRune, solutions.FirstRune, arg) + z01.Challenge("FirstRuneProg", FirstRune, solutions.FirstRune, arg) } } diff --git a/tests/go/solutions/foldint/foldint_test.go b/tests/go/solutions/foldint/foldint_test.go index 91f69b7d8..a88006091 100644 --- a/tests/go/solutions/foldint/foldint_test.go +++ b/tests/go/solutions/foldint/foldint_test.go @@ -1,13 +1,11 @@ package main import ( - "testing" - solutions "../../solutions" "github.com/01-edu/z01" ) -func TestFoldInt(t *testing.T) { +func main() { f := []func(int, int) int{Add, Sub, Mul} type node struct { @@ -42,7 +40,7 @@ func TestFoldInt(t *testing.T) { for _, v := range table { for _, f := range v.functions { - z01.Challenge(t, FoldInt, solutions.FoldInt, f, v.arr, v.n) + z01.Challenge("FoldInt", FoldInt, solutions.FoldInt, f, v.arr, v.n) } } } diff --git a/tests/go/solutions/foreachprog/foreachprog_test.go b/tests/go/solutions/foreachprog/foreachprog_test.go index 80a171032..fe2d6577c 100644 --- a/tests/go/solutions/foreachprog/foreachprog_test.go +++ b/tests/go/solutions/foreachprog/foreachprog_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestForEachProg(t *testing.T) { +func main() { functionsArray := []func(int){solutions.Add0, solutions.Add1, solutions.Add2, solutions.Add3} type node struct { @@ -35,6 +33,6 @@ func TestForEachProg(t *testing.T) { }) for _, arg := range table { - z01.Challenge(t, ForEach, solutions.ForEach, arg.f, arg.arr) + z01.Challenge("ForEachProg", ForEach, solutions.ForEach, arg.f, arg.arr) } } diff --git a/tests/go/solutions/game23/game23_test.go b/tests/go/solutions/game23/game23_test.go index 8eedb6063..cd2a1e519 100644 --- a/tests/go/solutions/game23/game23_test.go +++ b/tests/go/solutions/game23/game23_test.go @@ -1,8 +1,6 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program @@ -25,7 +23,7 @@ func nd(a, b int) int { return -1 } -func TestGame23(t *testing.T) { +func main() { // Declaration of the node that is going to take the group of arguments that are going to // inputed during each iteration of a Challenge between the student and the staff solution. // (note: a node is not always necessary but in this case it makes the writing of the test easier) @@ -94,7 +92,7 @@ func TestGame23(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Game23, solutions.Game23, arg.init, arg.fin) + z01.Challenge("Game23", Game23, solutions.Game23, arg.init, arg.fin) } // the z01.Challenge function is here applied to each argument of the table. It musts contains: diff --git a/tests/go/solutions/halfcontestprog/halfcontestprog_test.go b/tests/go/solutions/halfcontestprog/halfcontestprog_test.go index 6edacd4e0..b4e6cc81c 100644 --- a/tests/go/solutions/halfcontestprog/halfcontestprog_test.go +++ b/tests/go/solutions/halfcontestprog/halfcontestprog_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestHalfContestProg(t *testing.T) { +func main() { type node struct { h1 int m1 int @@ -48,6 +46,6 @@ func TestHalfContestProg(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Halfcontest, solutions.Halfcontest, arg.h1, arg.m1, arg.h2, arg.m2) + z01.Challenge("HalfContestProg", Halfcontest, solutions.Halfcontest, arg.h1, arg.m1, arg.h2, arg.m2) } } diff --git a/tests/go/solutions/interestingnumber/interestingnumber_test.go b/tests/go/solutions/interestingnumber/interestingnumber_test.go index d7836034f..065234aca 100644 --- a/tests/go/solutions/interestingnumber/interestingnumber_test.go +++ b/tests/go/solutions/interestingnumber/interestingnumber_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestInterestingNumber(t *testing.T) { +func main() { type node struct { n int } @@ -37,6 +35,6 @@ func TestInterestingNumber(t *testing.T) { } for _, arg := range table { - z01.Challenge(t, InterestingNumber, solutions.InterestingNumber, arg.n) + z01.Challenge("InterestingNumber", InterestingNumber, solutions.InterestingNumber, arg.n) } } diff --git a/tests/go/solutions/isanagram/isanagram_test.go b/tests/go/solutions/isanagram/isanagram_test.go index 8425d775b..a3991e180 100644 --- a/tests/go/solutions/isanagram/isanagram_test.go +++ b/tests/go/solutions/isanagram/isanagram_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestAnagram(t *testing.T) { +func main() { type node struct { s string t string @@ -45,6 +43,6 @@ func TestAnagram(t *testing.T) { } for _, arg := range table { - z01.Challenge(t, IsAnagram, solutions.IsAnagram, arg.s, arg.t) + z01.Challenge("IsAnagram", IsAnagram, solutions.IsAnagram, arg.s, arg.t) } } diff --git a/tests/go/solutions/itoabaseprog/itoabaseprog_test.go b/tests/go/solutions/itoabaseprog/itoabaseprog_test.go index 45a73e7cf..ae7ae92d0 100644 --- a/tests/go/solutions/itoabaseprog/itoabaseprog_test.go +++ b/tests/go/solutions/itoabaseprog/itoabaseprog_test.go @@ -1,22 +1,20 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestItoaBaseProg(t *testing.T) { +func main() { for i := 0; i < 30; i++ { value := z01.RandIntBetween(-1000000, 1000000) base := z01.RandIntBetween(2, 16) - z01.Challenge(t, ItoaBase, solutions.ItoaBase, value, base) + z01.Challenge("ItoaBaseProg", ItoaBase, solutions.ItoaBase, value, base) } for i := 0; i < 5; i++ { base := z01.RandIntBetween(2, 16) - z01.Challenge(t, ItoaBase, solutions.ItoaBase, z01.MaxInt, base) - z01.Challenge(t, ItoaBase, solutions.ItoaBase, z01.MinInt, base) + z01.Challenge("ItoaBaseProg", ItoaBase, solutions.ItoaBase, z01.MaxInt, base) + z01.Challenge("ItoaBaseProg", ItoaBase, solutions.ItoaBase, z01.MinInt, base) } } diff --git a/tests/go/solutions/itoaprog/itoaprog_test.go b/tests/go/solutions/itoaprog/itoaprog_test.go index 74566c0e7..b0ec75727 100644 --- a/tests/go/solutions/itoaprog/itoaprog_test.go +++ b/tests/go/solutions/itoaprog/itoaprog_test.go @@ -1,16 +1,14 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestItoaProg(t *testing.T) { +func main() { for i := 0; i < 50; i++ { arg := z01.RandIntBetween(-2000000000, 2000000000) - z01.Challenge(t, Itoa, solutions.Itoa, arg) + z01.Challenge("ItoaProg", Itoa, solutions.Itoa, arg) } } diff --git a/tests/go/solutions/lastruneprog/lastruneprog_test.go b/tests/go/solutions/lastruneprog/lastruneprog_test.go index bc0d1eff5..4b8d1b0b4 100644 --- a/tests/go/solutions/lastruneprog/lastruneprog_test.go +++ b/tests/go/solutions/lastruneprog/lastruneprog_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestLastRuneProg(t *testing.T) { +func main() { table := z01.MultRandASCII() table = append(table, "Hello!", @@ -17,6 +15,6 @@ func TestLastRuneProg(t *testing.T) { z01.RandStr(z01.RandIntBetween(1, 15), z01.RandAlnum()), ) for _, arg := range table { - z01.Challenge(t, LastRune, solutions.LastRune, arg) + z01.Challenge("LastRuneProg", LastRune, solutions.LastRune, arg) } } diff --git a/tests/go/solutions/lcm/lcm_test.go b/tests/go/solutions/lcm/lcm_test.go index 23a56edb5..7d4ebaa66 100644 --- a/tests/go/solutions/lcm/lcm_test.go +++ b/tests/go/solutions/lcm/lcm_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestLcm(t *testing.T) { +func main() { type node struct { first int second int @@ -36,6 +34,6 @@ func TestLcm(t *testing.T) { } for _, arg := range table { - z01.Challenge(t, Lcm, solutions.Lcm, arg.first, arg.second) + z01.Challenge("Lcm", Lcm, solutions.Lcm, arg.first, arg.second) } } diff --git a/tests/go/solutions/maxprog/maxprog_test.go b/tests/go/solutions/maxprog/maxprog_test.go index 9b2d2ef48..f8c7070ea 100644 --- a/tests/go/solutions/maxprog/maxprog_test.go +++ b/tests/go/solutions/maxprog/maxprog_test.go @@ -1,19 +1,17 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestMaxProg(t *testing.T) { +func main() { args := []int{z01.RandInt()} limit := z01.RandIntBetween(20, 50) for i := 0; i < limit; i++ { args = append(args, z01.RandInt()) } - z01.Challenge(t, Max, solutions.Max, args) + z01.Challenge("MaxProg", Max, solutions.Max, args) } diff --git a/tests/go/solutions/nauuo/nauuo_test.go b/tests/go/solutions/nauuo/nauuo_test.go index b9b3c319b..651837ec7 100644 --- a/tests/go/solutions/nauuo/nauuo_test.go +++ b/tests/go/solutions/nauuo/nauuo_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestNauuo(t *testing.T) { +func main() { // Declaration of the node that is going to take the group of arguments that are going to // inputed during each iteration of a Challenge between the student and the staff solution. // (note: a node is not always necessary but in this case it makes the writing of the test easier) @@ -58,7 +56,7 @@ func TestNauuo(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Nauuo, solutions.Nauuo, arg.plus, arg.minus, arg.rand) + z01.Challenge("Nauuo", Nauuo, solutions.Nauuo, arg.plus, arg.minus, arg.rand) } // the z01.Challenge function is here applied to each argument of the table. It musts contains: diff --git a/tests/go/solutions/nruneprog/nruneprog_test.go b/tests/go/solutions/nruneprog/nruneprog_test.go index 6b777dfaf..060c680b3 100644 --- a/tests/go/solutions/nruneprog/nruneprog_test.go +++ b/tests/go/solutions/nruneprog/nruneprog_test.go @@ -2,14 +2,13 @@ package main import ( "math/rand" - "testing" "github.com/01-edu/z01" solutions "../../solutions" ) -func TestNRuneProg(t *testing.T) { +func main() { type node struct { word string n int @@ -39,6 +38,6 @@ func TestNRuneProg(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, NRune, solutions.NRune, arg.word, arg.n) + z01.Challenge("NRuneProg", NRune, solutions.NRune, arg.word, arg.n) } } diff --git a/tests/go/solutions/printmemory/printmemory_test.go b/tests/go/solutions/printmemory/printmemory_test.go index ea10ca7b5..b0071bfc6 100644 --- a/tests/go/solutions/printmemory/printmemory_test.go +++ b/tests/go/solutions/printmemory/printmemory_test.go @@ -1,22 +1,20 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestPrintMemory(t *testing.T) { +func main() { var table [10]int for j := 0; j < 5; j++ { for i := 0; i < 10; i++ { table[i] = z01.RandIntBetween(0, 1000) } - z01.Challenge(t, PrintMemory, solutions.PrintMemory, table) + z01.Challenge("PrintMemory", PrintMemory, solutions.PrintMemory, table) } table2 := [10]int{104, 101, 108, 108, 111, 16, 21, 42} - z01.Challenge(t, PrintMemory, solutions.PrintMemory, table2) + z01.Challenge("PrintMemory", PrintMemory, solutions.PrintMemory, table2) } diff --git a/tests/go/solutions/priorprime/priorprime_test.go b/tests/go/solutions/priorprime/priorprime_test.go index bf10ae1e2..fb8eacb77 100644 --- a/tests/go/solutions/priorprime/priorprime_test.go +++ b/tests/go/solutions/priorprime/priorprime_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestPriorprime(t *testing.T) { +func main() { // Declaration of the node that is going to take the group of arguments that are going to // inputed during each iteration of a Challenge between the student and the staff solution. // (note: a node is not always necessary but in this case it makes the writing of the test easier) @@ -56,7 +54,7 @@ func TestPriorprime(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Priorprime, solutions.Priorprime, arg.first) + z01.Challenge("Priorprime", Priorprime, solutions.Priorprime, arg.first) } // the z01.Challenge function is here applied to each argument of the table. It musts contains: diff --git a/tests/go/solutions/reachablenumberprog/reachablenumber_test.go b/tests/go/solutions/reachablenumberprog/reachablenumber_test.go index 1eda1d486..0a497763f 100644 --- a/tests/go/solutions/reachablenumberprog/reachablenumber_test.go +++ b/tests/go/solutions/reachablenumberprog/reachablenumber_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestReachableNumber(t *testing.T) { +func main() { type node struct { n int } @@ -41,6 +39,6 @@ func TestReachableNumber(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Reachablenumber, solutions.Reachablenumber, arg.n) + z01.Challenge("ReachableNumber", Reachablenumber, solutions.Reachablenumber, arg.n) } } diff --git a/tests/go/solutions/reduceint/reduceint_test.go b/tests/go/solutions/reduceint/reduceint_test.go index 1120a4295..46d243aaf 100644 --- a/tests/go/solutions/reduceint/reduceint_test.go +++ b/tests/go/solutions/reduceint/reduceint_test.go @@ -1,13 +1,11 @@ package main import ( - "testing" - solutions "../../solutions" "github.com/01-edu/z01" ) -func TestReduceInt(t *testing.T) { +func main() { f := []func(int, int) int{Add, Sub, Mul} argInt := []int{} @@ -28,7 +26,7 @@ func TestReduceInt(t *testing.T) { for _, v := range table { for _, f := range v.functions { - z01.Challenge(t, ReduceInt, solutions.ReduceInt, f, v.arr) + z01.Challenge("ReduceInt", ReduceInt, solutions.ReduceInt, f, v.arr) } } } diff --git a/tests/go/solutions/revivethreenums/revivethreenums_test.go b/tests/go/solutions/revivethreenums/revivethreenums_test.go index db266dd4e..9d8dd216a 100644 --- a/tests/go/solutions/revivethreenums/revivethreenums_test.go +++ b/tests/go/solutions/revivethreenums/revivethreenums_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestRevivethreenums(t *testing.T) { +func main() { type node struct { a int b int @@ -48,6 +46,6 @@ func TestRevivethreenums(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Revive_three_nums, solutions.Revive_three_nums, arg.a, arg.b, arg.c, arg.d) + z01.Challenge("Revivethreenums", Revive_three_nums, solutions.Revive_three_nums, arg.a, arg.b, arg.c, arg.d) } } diff --git a/tests/go/solutions/sliceprog/sliceprog_test.go b/tests/go/solutions/sliceprog/sliceprog_test.go index f09b85212..e3b984c30 100644 --- a/tests/go/solutions/sliceprog/sliceprog_test.go +++ b/tests/go/solutions/sliceprog/sliceprog_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" ) -func TestSliceProg(t *testing.T) { +func main() { arr := [][]interface{}{ { []string{"coding", "algorithm", "ascii", "package", "golang"}, @@ -42,6 +40,6 @@ func TestSliceProg(t *testing.T) { } for _, a := range arr { - z01.Challenge(t, Slice, solutions.Slice, a...) + z01.Challenge("SliceProg", Slice, solutions.Slice, a...) } } diff --git a/tests/go/solutions/splitprog/splitprog_test.go b/tests/go/solutions/splitprog/splitprog_test.go index 9ec1b9340..a7bbb5ad0 100644 --- a/tests/go/solutions/splitprog/splitprog_test.go +++ b/tests/go/solutions/splitprog/splitprog_test.go @@ -3,14 +3,13 @@ package main import ( "math/rand" "strings" - "testing" "github.com/01-edu/z01" solutions "../../solutions" ) -func TestSplitProg(t *testing.T) { +func main() { separators := []string{"!=HA=!", "!==!", " ", @@ -40,6 +39,6 @@ func TestSplitProg(t *testing.T) { node{str: "HelloHAhowHAareHAyou?", sep: "HA"}) for _, arg := range table { - z01.Challenge(t, Split, solutions.Split, arg.str, arg.sep) + z01.Challenge("SplitProg", Split, solutions.Split, arg.str, arg.sep) } } diff --git a/tests/go/solutions/strlenprog/strlenprog_test.go b/tests/go/solutions/strlenprog/strlenprog_test.go index 84588a357..c7f76aff8 100644 --- a/tests/go/solutions/strlenprog/strlenprog_test.go +++ b/tests/go/solutions/strlenprog/strlenprog_test.go @@ -1,13 +1,11 @@ package main import ( - "testing" - solutions "../../solutions" "github.com/01-edu/z01" ) -func TestStrLenProg(t *testing.T) { +func main() { randomStringCharset := "a b c d e f g h ijklmnopqrstuvwxyz A B C D E FGHIJKLMNOPRSTUVWXYZ" table := []string{} @@ -20,6 +18,6 @@ func TestStrLenProg(t *testing.T) { table = append(table, randomStringCharset) for _, s := range table { - z01.Challenge(t, StrLen, solutions.StrLen, s) + z01.Challenge("StrLenProg", StrLen, solutions.StrLen, s) } } diff --git a/tests/go/solutions/sweetproblem/sweetproblem_test.go b/tests/go/solutions/sweetproblem/sweetproblem_test.go index 248aa51fa..089ee7ed8 100644 --- a/tests/go/solutions/sweetproblem/sweetproblem_test.go +++ b/tests/go/solutions/sweetproblem/sweetproblem_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestSweetProblem(t *testing.T) { +func main() { type node struct { red int green int @@ -54,6 +52,6 @@ func TestSweetProblem(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Sweetproblem, solutions.Sweetproblem, arg.red, arg.green, arg.blue) + z01.Challenge("SweetProblem", Sweetproblem, solutions.Sweetproblem, arg.red, arg.green, arg.blue) } } diff --git a/tests/go/solutions/twosum/twosum_test.go b/tests/go/solutions/twosum/twosum_test.go index 2439577cd..80fa1eb50 100644 --- a/tests/go/solutions/twosum/twosum_test.go +++ b/tests/go/solutions/twosum/twosum_test.go @@ -2,16 +2,15 @@ package main import ( "math/rand" - "testing" solutions "../../solutions" "github.com/01-edu/z01" ) -func TestTwoSum(t *testing.T) { +func main() { for i := 0; i < 20; i++ { token := rand.Perm(20) target := rand.Intn(30) - z01.Challenge(t, TwoSum, solutions.TwoSum, token, target) + z01.Challenge("TwoSum", TwoSum, solutions.TwoSum, token, target) } } diff --git a/tests/go/solutions/volumechanger/volumechanger_test.go b/tests/go/solutions/volumechanger/volumechanger_test.go index d5ac33cb9..72645da43 100644 --- a/tests/go/solutions/volumechanger/volumechanger_test.go +++ b/tests/go/solutions/volumechanger/volumechanger_test.go @@ -1,14 +1,12 @@ package main import ( - "testing" - "github.com/01-edu/z01" solutions "../../solutions" // This line is not necessary when testing an exercise with a program ) -func TestVolumechanger(t *testing.T) { +func main() { type node struct { init int fin int @@ -42,6 +40,6 @@ func TestVolumechanger(t *testing.T) { // be the ChallengeMainExam function) for _, arg := range table { - z01.Challenge(t, Volumechanger, solutions.Volumechanger, arg.init, arg.fin) + z01.Challenge("Volumechanger", Volumechanger, solutions.Volumechanger, arg.init, arg.fin) } } diff --git a/tests/go/split_test.go b/tests/go/split_test.go index 0c8e68472..5a039b8e7 100644 --- a/tests/go/split_test.go +++ b/tests/go/split_test.go @@ -1,9 +1,8 @@ -package student_test +package main import ( "math/rand" "strings" - "testing" "github.com/01-edu/z01" @@ -11,7 +10,7 @@ import ( student "./student" ) -func TestSplit(t *testing.T) { +func main() { separators := []string{"!=HA=!", "!==!", " ", @@ -41,6 +40,6 @@ func TestSplit(t *testing.T) { node{str: "HelloHAhowHAareHAyou?", sep: "HA"}) for _, arg := range table { - z01.Challenge(t, student.Split, solutions.Split, arg.str, arg.sep) + z01.Challenge("Split", student.Split, solutions.Split, arg.str, arg.sep) } } diff --git a/tests/go/splitwhitespaces_test.go b/tests/go/splitwhitespaces_test.go index 5a317d5f7..d10fefa73 100644 --- a/tests/go/splitwhitespaces_test.go +++ b/tests/go/splitwhitespaces_test.go @@ -1,8 +1,7 @@ -package student_test +package main import ( "strings" - "testing" "github.com/01-edu/z01" @@ -10,7 +9,7 @@ import ( student "./student" ) -func TestSplitWhiteSpaces(t *testing.T) { +func main() { table := []string{} //30 random slice of strings @@ -23,6 +22,6 @@ func TestSplitWhiteSpaces(t *testing.T) { "Hello how are you?") for _, arg := range table { - z01.Challenge(t, student.SplitWhiteSpaces, solutions.SplitWhiteSpaces, arg) + z01.Challenge("SplitWhiteSpaces", student.SplitWhiteSpaces, solutions.SplitWhiteSpaces, arg) } } diff --git a/tests/go/sqrt_test.go b/tests/go/sqrt_test.go index 90cc46d18..2e5c62da7 100644 --- a/tests/go/sqrt_test.go +++ b/tests/go/sqrt_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestSqrt(t *testing.T) { +func main() { table := append( z01.MultRandIntBetween(-1000000, 1000000), 0, @@ -28,6 +26,6 @@ func TestSqrt(t *testing.T) { 100, ) for _, arg := range table { - z01.Challenge(t, student.Sqrt, solutions.Sqrt, arg) + z01.Challenge("Sqrt", student.Sqrt, solutions.Sqrt, arg) } } diff --git a/tests/go/strlen_test.go b/tests/go/strlen_test.go index d9569b580..675ef725e 100644 --- a/tests/go/strlen_test.go +++ b/tests/go/strlen_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestStrLen(t *testing.T) { +func main() { randomStringCharset := "a b c d e f g h ijklmnopqrstuvwxyz A B C D E FGHIJKLMNOPRSTUVWXYZ" table := []string{} @@ -21,6 +19,6 @@ func TestStrLen(t *testing.T) { table = append(table, randomStringCharset) for _, s := range table { - z01.Challenge(t, solutions.StrLen, student.StrLen, s) + z01.Challenge("StrLen", solutions.StrLen, student.StrLen, s) } } diff --git a/tests/go/strrev_test.go b/tests/go/strrev_test.go index e41feb9be..63fd2245b 100644 --- a/tests/go/strrev_test.go +++ b/tests/go/strrev_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestStrRev(t *testing.T) { +func main() { table := append( z01.MultRandASCII(), "Hello!", @@ -17,6 +15,6 @@ func TestStrRev(t *testing.T) { "Hola!", ) for _, arg := range table { - z01.Challenge(t, student.StrRev, solutions.StrRev, arg) + z01.Challenge("StrRev", student.StrRev, solutions.StrRev, arg) } } diff --git a/tests/go/tolower_test.go b/tests/go/tolower_test.go index 1c3646172..2d9e7fd43 100644 --- a/tests/go/tolower_test.go +++ b/tests/go/tolower_test.go @@ -1,20 +1,18 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestToLower(t *testing.T) { +func main() { table := append( z01.MultRandASCII(), "Hello! How are you?", ) for _, arg := range table { - z01.Challenge(t, student.ToLower, solutions.ToLower, arg) + z01.Challenge("ToLower", student.ToLower, solutions.ToLower, arg) } } diff --git a/tests/go/toupper_test.go b/tests/go/toupper_test.go index 5f940482f..d9f12bba8 100644 --- a/tests/go/toupper_test.go +++ b/tests/go/toupper_test.go @@ -1,15 +1,13 @@ -package student_test +package main import ( - "testing" - "github.com/01-edu/z01" solutions "./solutions" student "./student" ) -func TestToUpper(t *testing.T) { +func main() { table := z01.MultRandASCII() table = append(table, @@ -17,6 +15,6 @@ func TestToUpper(t *testing.T) { ) for _, arg := range table { - z01.Challenge(t, student.ToUpper, solutions.ToUpper, arg) + z01.Challenge("ToUpper", student.ToUpper, solutions.ToUpper, arg) } } diff --git a/tests/go/trimatoi_test.go b/tests/go/trimatoi_test.go index 5f4575fef..6ea40cdc5 100644 --- a/tests/go/trimatoi_test.go +++ b/tests/go/trimatoi_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestTrimAtoi(t *testing.T) { +func main() { array := []string{"", "12345", "str123ing45", @@ -20,7 +18,7 @@ func TestTrimAtoi(t *testing.T) { z01.RandAlnum()} array = stringsToTrimAtoi(array) for i := range array { - z01.Challenge(t, student.TrimAtoi, solutions.TrimAtoi, array[i]) + z01.Challenge("TrimAtoi", student.TrimAtoi, solutions.TrimAtoi, array[i]) } } diff --git a/tests/go/unmatch_test.go b/tests/go/unmatch_test.go index e3436312e..1254ccbb5 100644 --- a/tests/go/unmatch_test.go +++ b/tests/go/unmatch_test.go @@ -1,14 +1,12 @@ -package student_test +package main import ( - "testing" - solutions "./solutions" student "./student" "github.com/01-edu/z01" ) -func TestUnmatch(t *testing.T) { +func main() { arg1 := []int{1, 1, 2, 3, 4, 3, 4} arg2 := []int{1, 1, 2, 4, 3, 4, 2, 3, 4} arg3 := []int{1, 2, 1, 1, 4, 5, 5, 4, 1, 7} @@ -26,6 +24,6 @@ func TestUnmatch(t *testing.T) { args := [][]int{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8} for _, v := range args { - z01.Challenge(t, student.Unmatch, solutions.Unmatch, v) + z01.Challenge("Unmatch", student.Unmatch, solutions.Unmatch, v) } }