From 2d3ec80c73214975eb5a0a7f72072a008cec2e17 Mon Sep 17 00:00:00 2001 From: Xavier Petit <32063953+xpetit@users.noreply.github.com> Date: Sun, 26 Apr 2020 13:07:53 +0200 Subject: [PATCH] Intermediate commit --- tests/go/solutions/abort.go | 2 +- tests/go/solutions/activebits.go | 2 +- tests/go/solutions/addlinkednumbers.go | 2 +- .../addlinkednumbers/test_addlinkednumbers.go | 6 +- tests/go/solutions/advancedsortwordarr.go | 2 +- tests/go/solutions/alphacount.go | 2 +- tests/go/solutions/any.go | 2 +- tests/go/solutions/appendrange.go | 2 +- tests/go/solutions/atoi.go | 2 +- tests/go/solutions/atoibase.go | 2 +- .../atoibaseprog/test_atoibaseprog.go | 4 +- tests/go/solutions/atoiprog/test_atoiprog.go | 4 +- tests/go/solutions/basicatoi.go | 2 +- tests/go/solutions/basicatoi2.go | 2 +- tests/go/solutions/basicjoin.go | 2 +- tests/go/solutions/btree.go | 2 +- tests/go/solutions/capitalize.go | 2 +- tests/go/solutions/challenge.go | 2 +- tests/go/solutions/changeorder.go | 2 +- .../solutions/changeorder/test_changeorder.go | 6 +- tests/go/solutions/chunk.go | 2 +- tests/go/solutions/chunk/test_chunk.go | 4 +- tests/go/solutions/collatzcountdown.go | 2 +- tests/go/solutions/compact.go | 2 +- tests/go/solutions/compare.go | 2 +- tests/go/solutions/concat.go | 2 +- tests/go/solutions/concatparams.go | 2 +- tests/go/solutions/convertbase.go | 2 +- tests/go/solutions/countif.go | 2 +- tests/go/solutions/createelem.go | 2 +- tests/go/solutions/divmod.go | 2 +- tests/go/solutions/doppelganger.go | 2 +- .../doppelgangerprog/test_doppelgangerprog.go | 4 +- tests/go/solutions/eightqueens.go | 2 +- tests/go/solutions/enigma.go | 2 +- tests/go/solutions/fib.go | 2 +- tests/go/solutions/fib/test_fib.go | 4 +- tests/go/solutions/fibonacci.go | 2 +- tests/go/solutions/findnextprime.go | 2 +- tests/go/solutions/findprevprime.go | 2 +- .../test_findprevprimeprog.go | 4 +- tests/go/solutions/firstrune.go | 2 +- .../firstruneprog/test_firstruneprog.go | 4 +- tests/go/solutions/foldint.go | 2 +- tests/go/solutions/foldint/test_foldint.go | 4 +- tests/go/solutions/foreach.go | 2 +- .../solutions/foreachprog/test_foreachprog.go | 4 +- tests/go/solutions/game23.go | 2 +- tests/go/solutions/game23/test_game23.go | 4 +- tests/go/solutions/halfcontest.go | 2 +- .../halfcontestprog/test_halfcontestprog.go | 4 +- tests/go/solutions/index.go | 2 +- tests/go/solutions/interestingnumber.go | 2 +- .../test_interestingnumber.go | 4 +- tests/go/solutions/inverttree.go | 2 +- .../solutions/inverttree/test_inverttree.go | 6 +- tests/go/solutions/isalpha.go | 2 +- tests/go/solutions/isanagram.go | 2 +- .../go/solutions/isanagram/test_isanagram.go | 4 +- tests/go/solutions/islower.go | 2 +- tests/go/solutions/isnegative.go | 2 +- tests/go/solutions/isnumeric.go | 2 +- tests/go/solutions/isprime.go | 2 +- tests/go/solutions/isprintable.go | 2 +- tests/go/solutions/issorted.go | 2 +- tests/go/solutions/isupper.go | 2 +- tests/go/solutions/iterativefactorial.go | 2 +- tests/go/solutions/iterativepower.go | 2 +- tests/go/solutions/itoa.go | 2 +- tests/go/solutions/itoabase.go | 2 +- tests/go/solutions/itoabaseprog/main.go | 3 +- .../itoabaseprog/test_itoabaseprog.go | 8 +-- tests/go/solutions/itoaprog/test_itoaprog.go | 4 +- tests/go/solutions/join.go | 2 +- tests/go/solutions/lastrune.go | 2 +- .../lastruneprog/test_lastruneprog.go | 4 +- tests/go/solutions/lcm.go | 2 +- tests/go/solutions/lcm/test_lcm.go | 4 +- tests/go/solutions/listat.go | 2 +- tests/go/solutions/listclear.go | 2 +- tests/go/solutions/listfind.go | 2 +- tests/go/solutions/listforeach.go | 2 +- tests/go/solutions/listforeachif.go | 2 +- tests/go/solutions/listlast.go | 2 +- tests/go/solutions/listmerge.go | 2 +- tests/go/solutions/listpushback.go | 2 +- tests/go/solutions/listpushfront.go | 2 +- tests/go/solutions/listremoveif.go | 2 +- .../listremoveifprog/test_listremoveifprog.go | 20 +++---- tests/go/solutions/listreverse.go | 2 +- tests/go/solutions/listsize.go | 2 +- .../listsizeprog/test_listsizeprog.go | 17 +++--- tests/go/solutions/listsort.go | 2 +- tests/go/solutions/makerange.go | 2 +- tests/go/solutions/map.go | 2 +- tests/go/solutions/max.go | 2 +- tests/go/solutions/maxprog/test_maxprog.go | 4 +- tests/go/solutions/merge.go | 2 +- tests/go/solutions/merge/test_merge.go | 6 +- tests/go/solutions/nauuo.go | 2 +- tests/go/solutions/nauuo/test_nauuo.go | 4 +- tests/go/solutions/nrune.go | 2 +- tests/go/solutions/nruneprog/main.go | 4 +- .../go/solutions/nruneprog/test_nruneprog.go | 4 +- tests/go/solutions/pilot.go | 2 +- tests/go/solutions/pointone.go | 2 +- tests/go/solutions/printchessboard.go | 2 +- tests/go/solutions/printcomb.go | 2 +- tests/go/solutions/printcomb2.go | 2 +- tests/go/solutions/printcombn.go | 2 +- tests/go/solutions/printmemory.go | 2 +- .../solutions/printmemory/test_printmemory.go | 6 +- tests/go/solutions/printnbr.go | 2 +- tests/go/solutions/printnbrbase.go | 2 +- tests/go/solutions/printnbrinorder.go | 2 +- tests/go/solutions/printstr.go | 2 +- tests/go/solutions/printwordstables.go | 2 +- tests/go/solutions/priorprime.go | 2 +- .../solutions/priorprime/test_priorprime.go | 4 +- tests/go/solutions/raid1a.go | 2 +- tests/go/solutions/raid1b.go | 2 +- tests/go/solutions/raid1c.go | 2 +- tests/go/solutions/raid1d.go | 2 +- tests/go/solutions/raid1e.go | 2 +- tests/go/solutions/raid3/raid1aProg/raid1a.go | 4 +- tests/go/solutions/raid3/raid1bProg/raid1b.go | 4 +- tests/go/solutions/raid3/raid1cProg/raid1c.go | 4 +- tests/go/solutions/raid3/raid1dProg/raid1d.go | 4 +- tests/go/solutions/raid3/raid1eProg/raid1e.go | 4 +- tests/go/solutions/reachablenumber.go | 2 +- .../test_reachablenumber.go | 4 +- tests/go/solutions/recursivefactorial.go | 2 +- tests/go/solutions/recursivepower.go | 2 +- tests/go/solutions/reduceint.go | 2 +- .../go/solutions/reduceint/test_reduceint.go | 4 +- tests/go/solutions/reverse.go | 2 +- tests/go/solutions/reverse/test_reverse.go | 6 +- tests/go/solutions/reversebits.go | 2 +- .../solutions/reversebits/test_reversebits.go | 4 +- tests/go/solutions/revivethreenums.go | 2 +- .../revivethreenums/test_revivethreenums.go | 4 +- tests/go/solutions/rot14.go | 2 +- tests/go/solutions/sametree.go | 2 +- tests/go/solutions/sametree/test_sametree.go | 8 +-- tests/go/solutions/slice.go | 2 +- .../go/solutions/sliceprog/test_sliceprog.go | 4 +- tests/go/solutions/sortedlistmerge.go | 2 +- tests/go/solutions/sortintegertable.go | 2 +- tests/go/solutions/sortlist.go | 2 +- tests/go/solutions/sortlistinsert.go | 2 +- tests/go/solutions/sortll.go | 2 +- tests/go/solutions/sortll/test_sortll.go | 6 +- tests/go/solutions/sortwordarr.go | 2 +- .../sortwordarrprog/test_sortwordarrprog.go | 4 +- tests/go/solutions/split.go | 2 +- .../go/solutions/splitprog/test_splitprog.go | 4 +- tests/go/solutions/splitwhitespaces.go | 2 +- tests/go/solutions/sqrt.go | 2 +- tests/go/solutions/strlen.go | 2 +- .../solutions/strlenprog/test_strlenprog.go | 4 +- tests/go/solutions/strrev.go | 2 +- tests/go/solutions/strrevprog/main.go | 4 +- tests/go/solutions/swap.go | 2 +- tests/go/solutions/swapbits.go | 2 +- tests/go/solutions/swapbits/test_swapbits.go | 4 +- tests/go/solutions/sweetproblem.go | 2 +- .../sweetproblem/test_sweetproblem.go | 4 +- tests/go/solutions/testConvertBase/main.go | 4 +- tests/go/solutions/tolower.go | 2 +- tests/go/solutions/toupper.go | 2 +- tests/go/solutions/trimatoi.go | 2 +- tests/go/solutions/twosum.go | 2 +- tests/go/solutions/twosum/test_twosum.go | 4 +- tests/go/solutions/ultimatedivmod.go | 2 +- tests/go/solutions/ultimatepointone.go | 2 +- tests/go/solutions/unmatch.go | 4 +- tests/go/solutions/volumechanger.go | 2 +- .../volumechanger/test_volumechanger.go | 4 +- tests/go/test_abort.go | 4 +- tests/go/test_activebits.go | 4 +- tests/go/test_advancedsortwordarr.go | 4 +- tests/go/test_alphacount.go | 6 +- tests/go/test_any.go | 56 +++++++++---------- tests/go/test_appendrange.go | 4 +- tests/go/test_atoi.go | 4 +- tests/go/test_atoibase.go | 4 +- tests/go/test_basicatoi.go | 4 +- tests/go/test_basicatoi2.go | 4 +- tests/go/test_basicjoin.go | 4 +- tests/go/test_btreeapplybylevel.go | 8 +-- tests/go/test_btreeapplyinorder.go | 8 +-- tests/go/test_btreeapplypostorder.go | 8 +-- tests/go/test_btreeapplypreorder.go | 8 +-- tests/go/test_btreedeletenode.go | 24 ++++---- tests/go/test_btreeinsertdata.go | 18 +++--- tests/go/test_btreeisbinary.go | 30 +++++----- tests/go/test_btreelevelcount.go | 20 +++---- tests/go/test_btreemax.go | 20 +++---- tests/go/test_btreemin.go | 18 +++--- tests/go/test_btreesearchitem.go | 16 +++--- tests/go/test_btreetransplant.go | 36 ++++++------ tests/go/test_capitalize.go | 4 +- tests/go/test_collatzcountdown.go | 4 +- tests/go/test_compact.go | 4 +- tests/go/test_compare.go | 4 +- tests/go/test_concat.go | 4 +- tests/go/test_concatparams.go | 4 +- tests/go/test_convertbase.go | 4 +- tests/go/test_countif.go | 20 +++---- tests/go/test_createelem.go | 6 +- tests/go/test_eightqueens.go | 4 +- tests/go/test_enigma.go | 4 +- tests/go/test_fibonacci.go | 4 +- tests/go/test_findnextprime.go | 4 +- tests/go/test_firstrune.go | 4 +- tests/go/test_foreach.go | 4 +- tests/go/test_index.go | 4 +- tests/go/test_isalpha.go | 4 +- tests/go/test_islower.go | 4 +- tests/go/test_isnegative.go | 4 +- tests/go/test_isnumeric.go | 4 +- tests/go/test_isprime.go | 4 +- tests/go/test_isprintable.go | 4 +- tests/go/test_issorted.go | 24 ++++---- tests/go/test_isupper.go | 4 +- tests/go/test_iterativefactorial.go | 4 +- tests/go/test_iterativepower.go | 8 +-- tests/go/test_itoa.go | 4 +- tests/go/test_itoabase.go | 8 +-- tests/go/test_join.go | 4 +- tests/go/test_lastrune.go | 4 +- tests/go/test_listat.go | 16 +++--- tests/go/test_listclear.go | 18 +++--- tests/go/test_listfind.go | 16 +++--- tests/go/test_listforeach.go | 24 ++++---- tests/go/test_listforeachif.go | 34 +++++------ tests/go/test_listlast.go | 16 +++--- tests/go/test_listmerge.go | 22 ++++---- tests/go/test_listpushback.go | 16 +++--- tests/go/test_listpushfront.go | 16 +++--- tests/go/test_listremoveif.go | 20 +++---- tests/go/test_listreverse.go | 16 +++--- tests/go/test_listsize.go | 16 +++--- tests/go/test_listsort.go | 10 ++-- tests/go/test_makerange.go | 4 +- tests/go/test_map.go | 12 ++-- tests/go/test_max.go | 4 +- tests/go/test_nrune.go | 4 +- tests/go/test_printcomb.go | 4 +- tests/go/test_printcomb2.go | 4 +- tests/go/test_printcombn.go | 4 +- tests/go/test_printnbr.go | 4 +- tests/go/test_printnbrbase.go | 4 +- tests/go/test_printnbrinorder.go | 4 +- tests/go/test_printstr.go | 4 +- tests/go/test_printwordstables.go | 6 +- tests/go/test_raid1a.go | 4 +- tests/go/test_raid1b.go | 4 +- tests/go/test_raid1c.go | 4 +- tests/go/test_raid1d.go | 4 +- tests/go/test_raid1e.go | 4 +- tests/go/test_raid3.go | 2 + tests/go/test_recursivefactorial.go | 4 +- tests/go/test_recursivepower.go | 8 +-- tests/go/test_rot14.go | 4 +- tests/go/test_sortedlistmerge.go | 17 +++--- tests/go/test_sortintegertable.go | 4 +- tests/go/test_sortlist.go | 18 +++--- tests/go/test_sortlistinsert.go | 12 ++-- tests/go/test_sortwordarr.go | 4 +- tests/go/test_split.go | 4 +- tests/go/test_splitwhitespaces.go | 4 +- tests/go/test_sqrt.go | 4 +- tests/go/test_strlen.go | 4 +- tests/go/test_strrev.go | 4 +- tests/go/test_swapbits.go | 4 +- tests/go/test_tetrisoptimizer.go | 1 + tests/go/test_tolower.go | 4 +- tests/go/test_toupper.go | 4 +- tests/go/test_trimatoi.go | 4 +- tests/go/test_unmatch.go | 4 +- 281 files changed, 709 insertions(+), 713 deletions(-) diff --git a/tests/go/solutions/abort.go b/tests/go/solutions/abort.go index 5e20cc1b3..248f5b8f2 100644 --- a/tests/go/solutions/abort.go +++ b/tests/go/solutions/abort.go @@ -1,4 +1,4 @@ -package solutions +package correct import "sort" diff --git a/tests/go/solutions/activebits.go b/tests/go/solutions/activebits.go index 26ee55d10..f909c5367 100644 --- a/tests/go/solutions/activebits.go +++ b/tests/go/solutions/activebits.go @@ -1,4 +1,4 @@ -package solutions +package correct // Function that return the number of active bits in the number passed as the argument func ActiveBits(n int) (total int) { diff --git a/tests/go/solutions/addlinkednumbers.go b/tests/go/solutions/addlinkednumbers.go index 22a8c3d50..4c29279ed 100644 --- a/tests/go/solutions/addlinkednumbers.go +++ b/tests/go/solutions/addlinkednumbers.go @@ -1,4 +1,4 @@ -package solutions +package correct type NodeAddL struct { Next *NodeAddL diff --git a/tests/go/solutions/addlinkednumbers/test_addlinkednumbers.go b/tests/go/solutions/addlinkednumbers/test_addlinkednumbers.go index 9a87dc302..e5387e181 100644 --- a/tests/go/solutions/addlinkednumbers/test_addlinkednumbers.go +++ b/tests/go/solutions/addlinkednumbers/test_addlinkednumbers.go @@ -5,11 +5,11 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type stuNode = NodeAddL -type solNode = solutions.NodeAddL +type solNode = correct.NodeAddL func stuPushFront(node *stuNode, num int) *stuNode { tmp := &stuNode{Num: num} @@ -112,7 +112,7 @@ func main() { for _, arg := range args { stuResult := AddLinkedNumbers(stuNumToList(arg[0]), stuNumToList(arg[1])) - solResult := solutions.AddLinkedNumbers(solNumToList(arg[0]), solNumToList(arg[1])) + solResult := correct.AddLinkedNumbers(solNumToList(arg[0]), solNumToList(arg[1])) compareNodes(stuResult, solResult, arg[0], arg[1]) } diff --git a/tests/go/solutions/advancedsortwordarr.go b/tests/go/solutions/advancedsortwordarr.go index 6cf16fc78..bfdbf39cc 100644 --- a/tests/go/solutions/advancedsortwordarr.go +++ b/tests/go/solutions/advancedsortwordarr.go @@ -1,4 +1,4 @@ -package solutions +package correct import "sort" diff --git a/tests/go/solutions/alphacount.go b/tests/go/solutions/alphacount.go index 807346bd3..84d942cdd 100644 --- a/tests/go/solutions/alphacount.go +++ b/tests/go/solutions/alphacount.go @@ -1,4 +1,4 @@ -package solutions +package correct import "unicode" diff --git a/tests/go/solutions/any.go b/tests/go/solutions/any.go index a2384b217..b108de721 100644 --- a/tests/go/solutions/any.go +++ b/tests/go/solutions/any.go @@ -1,4 +1,4 @@ -package solutions +package correct func Any(f func(string) bool, arr []string) bool { for _, el := range arr { diff --git a/tests/go/solutions/appendrange.go b/tests/go/solutions/appendrange.go index 07cd3f149..af43bbcc0 100644 --- a/tests/go/solutions/appendrange.go +++ b/tests/go/solutions/appendrange.go @@ -1,4 +1,4 @@ -package solutions +package correct func AppendRange(min, max int) []int { size := max - min diff --git a/tests/go/solutions/atoi.go b/tests/go/solutions/atoi.go index e56bd80d5..038747246 100644 --- a/tests/go/solutions/atoi.go +++ b/tests/go/solutions/atoi.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strconv" diff --git a/tests/go/solutions/atoibase.go b/tests/go/solutions/atoibase.go index 510c97f9f..ddc3f7c9f 100644 --- a/tests/go/solutions/atoibase.go +++ b/tests/go/solutions/atoibase.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/atoibaseprog/test_atoibaseprog.go b/tests/go/solutions/atoibaseprog/test_atoibaseprog.go index 040d9a328..2846ab171 100644 --- a/tests/go/solutions/atoibaseprog/test_atoibaseprog.go +++ b/tests/go/solutions/atoibaseprog/test_atoibaseprog.go @@ -5,7 +5,7 @@ import ( "./base" - solutions "../../solutions" + correct "./correct" ) // this is the function that creates the TESTS @@ -43,7 +43,7 @@ func main() { node{s: "bbbbbab", base: "-ab"}, ) for _, arg := range table { - z01.Challenge("AtoiBaseProg", AtoiBase, solutions.AtoiBase, arg.s, arg.base) + z01.Challenge("AtoiBaseProg", AtoiBase, correct.AtoiBase, arg.s, arg.base) } } diff --git a/tests/go/solutions/atoiprog/test_atoiprog.go b/tests/go/solutions/atoiprog/test_atoiprog.go index 8c15e5f56..1e8037fd7 100644 --- a/tests/go/solutions/atoiprog/test_atoiprog.go +++ b/tests/go/solutions/atoiprog/test_atoiprog.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -32,6 +32,6 @@ func main() { "123a45", ) for _, arg := range table { - z01.Challenge("AtoiProg", Atoi, solutions.Atoi, arg) + z01.Challenge("AtoiProg", Atoi, correct.Atoi, arg) } } diff --git a/tests/go/solutions/basicatoi.go b/tests/go/solutions/basicatoi.go index 837004bde..a91f89479 100644 --- a/tests/go/solutions/basicatoi.go +++ b/tests/go/solutions/basicatoi.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strconv" diff --git a/tests/go/solutions/basicatoi2.go b/tests/go/solutions/basicatoi2.go index cc585d8dd..b45995df5 100644 --- a/tests/go/solutions/basicatoi2.go +++ b/tests/go/solutions/basicatoi2.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strconv" diff --git a/tests/go/solutions/basicjoin.go b/tests/go/solutions/basicjoin.go index 5f17d8139..eec0d95fc 100644 --- a/tests/go/solutions/basicjoin.go +++ b/tests/go/solutions/basicjoin.go @@ -1,4 +1,4 @@ -package solutions +package correct func BasicJoin(a []string) (b string) { for _, s := range a { diff --git a/tests/go/solutions/btree.go b/tests/go/solutions/btree.go index 1ed44c865..ae9895085 100644 --- a/tests/go/solutions/btree.go +++ b/tests/go/solutions/btree.go @@ -1,4 +1,4 @@ -package solutions +package correct type TreeNode struct { Left, Right, Parent *TreeNode diff --git a/tests/go/solutions/capitalize.go b/tests/go/solutions/capitalize.go index 09bb621c5..26091b17c 100644 --- a/tests/go/solutions/capitalize.go +++ b/tests/go/solutions/capitalize.go @@ -1,4 +1,4 @@ -package solutions +package correct import ( "strings" diff --git a/tests/go/solutions/challenge.go b/tests/go/solutions/challenge.go index f4167c325..f1d6594d1 100644 --- a/tests/go/solutions/challenge.go +++ b/tests/go/solutions/challenge.go @@ -1,4 +1,4 @@ -package solutions +package correct import ( "reflect" diff --git a/tests/go/solutions/changeorder.go b/tests/go/solutions/changeorder.go index d6f3d84fb..f41ed1be5 100644 --- a/tests/go/solutions/changeorder.go +++ b/tests/go/solutions/changeorder.go @@ -1,4 +1,4 @@ -package solutions +package correct func pushBack(node *NodeAddL, num int) *NodeAddL { nw := &NodeAddL{Num: num} diff --git a/tests/go/solutions/changeorder/test_changeorder.go b/tests/go/solutions/changeorder/test_changeorder.go index 26ae91702..52fa454ec 100644 --- a/tests/go/solutions/changeorder/test_changeorder.go +++ b/tests/go/solutions/changeorder/test_changeorder.go @@ -5,11 +5,11 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type stuNode = NodeAddL -type solNode = solutions.NodeAddL +type solNode = correct.NodeAddL func stuPushFront(node *stuNode, num int) *stuNode { tmp := &stuNode{Num: num} @@ -99,7 +99,7 @@ func main() { for _, arg := range table { stuResult := Changeorder(stuNumToList(arg)) - solResult := solutions.Changeorder(solNumToList(arg)) + solResult := correct.Changeorder(solNumToList(arg)) compareNodes(stuResult, solResult, arg) } diff --git a/tests/go/solutions/chunk.go b/tests/go/solutions/chunk.go index feb4101ae..ded670225 100644 --- a/tests/go/solutions/chunk.go +++ b/tests/go/solutions/chunk.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/chunk/test_chunk.go b/tests/go/solutions/chunk/test_chunk.go index 156564ff8..309d6474e 100644 --- a/tests/go/solutions/chunk/test_chunk.go +++ b/tests/go/solutions/chunk/test_chunk.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func randomSize() []int { @@ -36,6 +36,6 @@ func main() { ch: 0, }) for _, args := range table { - z01.Challenge("Chunk", Chunk, solutions.Chunk, args.slice, args.ch) + z01.Challenge("Chunk", Chunk, correct.Chunk, args.slice, args.ch) } } diff --git a/tests/go/solutions/collatzcountdown.go b/tests/go/solutions/collatzcountdown.go index a0e8b490c..ec538bc1f 100644 --- a/tests/go/solutions/collatzcountdown.go +++ b/tests/go/solutions/collatzcountdown.go @@ -1,4 +1,4 @@ -package solutions +package correct func CollatzCountdown(start int) int { if start <= 0 { diff --git a/tests/go/solutions/compact.go b/tests/go/solutions/compact.go index dd61f3b3c..caaea44f5 100644 --- a/tests/go/solutions/compact.go +++ b/tests/go/solutions/compact.go @@ -1,4 +1,4 @@ -package solutions +package correct func Compact(slice *[]string) int { count := 0 diff --git a/tests/go/solutions/compare.go b/tests/go/solutions/compare.go index e381b4e5d..3767df434 100644 --- a/tests/go/solutions/compare.go +++ b/tests/go/solutions/compare.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/concat.go b/tests/go/solutions/concat.go index 1dd882dc1..dc47e9b8e 100644 --- a/tests/go/solutions/concat.go +++ b/tests/go/solutions/concat.go @@ -1,4 +1,4 @@ -package solutions +package correct func Concat(a, b string) string { return a + b diff --git a/tests/go/solutions/concatparams.go b/tests/go/solutions/concatparams.go index e84db826b..b2aadd6df 100644 --- a/tests/go/solutions/concatparams.go +++ b/tests/go/solutions/concatparams.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/convertbase.go b/tests/go/solutions/convertbase.go index 0e9636b69..fdf7405c3 100644 --- a/tests/go/solutions/convertbase.go +++ b/tests/go/solutions/convertbase.go @@ -1,4 +1,4 @@ -package solutions +package correct func ConvertNbrBase(n int, base string) string { var result string diff --git a/tests/go/solutions/countif.go b/tests/go/solutions/countif.go index 0734edd2b..d756aed6c 100644 --- a/tests/go/solutions/countif.go +++ b/tests/go/solutions/countif.go @@ -1,4 +1,4 @@ -package solutions +package correct func CountIf(f func(string) bool, arr []string) int { counter := 0 diff --git a/tests/go/solutions/createelem.go b/tests/go/solutions/createelem.go index abddb9bf5..64cb0d6fc 100644 --- a/tests/go/solutions/createelem.go +++ b/tests/go/solutions/createelem.go @@ -1,4 +1,4 @@ -package solutions +package correct type Node struct { Data int diff --git a/tests/go/solutions/divmod.go b/tests/go/solutions/divmod.go index 90e805d6e..7ccf7b1bf 100644 --- a/tests/go/solutions/divmod.go +++ b/tests/go/solutions/divmod.go @@ -1,4 +1,4 @@ -package solutions +package correct func DivMod(a, b int, div, mod *int) { *div = a / b diff --git a/tests/go/solutions/doppelganger.go b/tests/go/solutions/doppelganger.go index 5f471cd76..8711186eb 100644 --- a/tests/go/solutions/doppelganger.go +++ b/tests/go/solutions/doppelganger.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/doppelgangerprog/test_doppelgangerprog.go b/tests/go/solutions/doppelgangerprog/test_doppelgangerprog.go index 2e6e88518..ba959e2d9 100644 --- a/tests/go/solutions/doppelgangerprog/test_doppelgangerprog.go +++ b/tests/go/solutions/doppelgangerprog/test_doppelgangerprog.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type node struct { @@ -47,6 +47,6 @@ func main() { } for _, arg := range table { - z01.Challenge("DoppelGangerProg", DoppelGanger, solutions.DoppelGanger, arg.big, arg.little) + z01.Challenge("DoppelGangerProg", DoppelGanger, correct.DoppelGanger, arg.big, arg.little) } } diff --git a/tests/go/solutions/eightqueens.go b/tests/go/solutions/eightqueens.go index a46afcfee..c5a286702 100644 --- a/tests/go/solutions/eightqueens.go +++ b/tests/go/solutions/eightqueens.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/enigma.go b/tests/go/solutions/enigma.go index 3bdc29ae9..648274854 100644 --- a/tests/go/solutions/enigma.go +++ b/tests/go/solutions/enigma.go @@ -1,4 +1,4 @@ -package solutions +package correct // this function will put a in c; c in d; d in b and b in a func Enigma(a ***int, b *int, c *******int, d ****int) { diff --git a/tests/go/solutions/fib.go b/tests/go/solutions/fib.go index 67cb21f1b..c05fd9b89 100644 --- a/tests/go/solutions/fib.go +++ b/tests/go/solutions/fib.go @@ -1,4 +1,4 @@ -package solutions +package correct func rec(a, b, cnt int) int { if a > b { diff --git a/tests/go/solutions/fib/test_fib.go b/tests/go/solutions/fib/test_fib.go index 0c2e9b0af..60c3f0ec8 100644 --- a/tests/go/solutions/fib/test_fib.go +++ b/tests/go/solutions/fib/test_fib.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -15,6 +15,6 @@ func main() { } table = append(table, z01.MultRandIntBetween(-100, 150)...) for _, arg := range table { - z01.Challenge("Fib", Fib, solutions.Fib, arg) + z01.Challenge("Fib", Fib, correct.Fib, arg) } } diff --git a/tests/go/solutions/fibonacci.go b/tests/go/solutions/fibonacci.go index 4eccf8ca8..9dd6bc23a 100644 --- a/tests/go/solutions/fibonacci.go +++ b/tests/go/solutions/fibonacci.go @@ -1,4 +1,4 @@ -package solutions +package correct func Fibonacci(value int) int { if value < 0 { diff --git a/tests/go/solutions/findnextprime.go b/tests/go/solutions/findnextprime.go index a898ac550..6dc02d677 100644 --- a/tests/go/solutions/findnextprime.go +++ b/tests/go/solutions/findnextprime.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math" diff --git a/tests/go/solutions/findprevprime.go b/tests/go/solutions/findprevprime.go index 461480e00..d04cdc032 100644 --- a/tests/go/solutions/findprevprime.go +++ b/tests/go/solutions/findprevprime.go @@ -1,4 +1,4 @@ -package solutions +package correct func FindPrevPrime(nbr int) int { if nbr < 2 { diff --git a/tests/go/solutions/findprevprimeprog/test_findprevprimeprog.go b/tests/go/solutions/findprevprimeprog/test_findprevprimeprog.go index f5b0cff4e..db2546f83 100644 --- a/tests/go/solutions/findprevprimeprog/test_findprevprimeprog.go +++ b/tests/go/solutions/findprevprimeprog/test_findprevprimeprog.go @@ -3,12 +3,12 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { a := append(z01.MultRandIntBetween(0, 99999), 5, 4, 1) for _, elem := range a { - z01.Challenge("FindPrevPrimeProg", FindPrevPrime, solutions.FindPrevPrime, elem) + z01.Challenge("FindPrevPrimeProg", FindPrevPrime, correct.FindPrevPrime, elem) } } diff --git a/tests/go/solutions/firstrune.go b/tests/go/solutions/firstrune.go index 093287d56..1125939dc 100644 --- a/tests/go/solutions/firstrune.go +++ b/tests/go/solutions/firstrune.go @@ -1,4 +1,4 @@ -package solutions +package correct func FirstRune(s string) rune { runes := []rune(s) diff --git a/tests/go/solutions/firstruneprog/test_firstruneprog.go b/tests/go/solutions/firstruneprog/test_firstruneprog.go index b7a94fa44..cbf9e6ff2 100644 --- a/tests/go/solutions/firstruneprog/test_firstruneprog.go +++ b/tests/go/solutions/firstruneprog/test_firstruneprog.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -15,6 +15,6 @@ func main() { "♥01", ) for _, arg := range table { - z01.Challenge("FirstRuneProg", FirstRune, solutions.FirstRune, arg) + z01.Challenge("FirstRuneProg", FirstRune, correct.FirstRune, arg) } } diff --git a/tests/go/solutions/foldint.go b/tests/go/solutions/foldint.go index 008d98047..a9d424181 100644 --- a/tests/go/solutions/foldint.go +++ b/tests/go/solutions/foldint.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/foldint/test_foldint.go b/tests/go/solutions/foldint/test_foldint.go index 0bf3d36b4..3979646e6 100644 --- a/tests/go/solutions/foldint/test_foldint.go +++ b/tests/go/solutions/foldint/test_foldint.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -41,7 +41,7 @@ func main() { for _, v := range table { for _, f := range v.functions { - z01.Challenge("FoldInt", FoldInt, solutions.FoldInt, f, v.arr, v.n) + z01.Challenge("FoldInt", FoldInt, correct.FoldInt, f, v.arr, v.n) } } } diff --git a/tests/go/solutions/foreach.go b/tests/go/solutions/foreach.go index 616d7c967..89465cc11 100644 --- a/tests/go/solutions/foreach.go +++ b/tests/go/solutions/foreach.go @@ -1,4 +1,4 @@ -package solutions +package correct func ForEach(f func(int), a []int) { for _, el := range a { diff --git a/tests/go/solutions/foreachprog/test_foreachprog.go b/tests/go/solutions/foreachprog/test_foreachprog.go index 9920ca4a6..eaea6bef7 100644 --- a/tests/go/solutions/foreachprog/test_foreachprog.go +++ b/tests/go/solutions/foreachprog/test_foreachprog.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func add0(i int) { @@ -46,6 +46,6 @@ func main() { }) for _, arg := range table { - z01.Challenge("ForEachProg", ForEach, solutions.ForEach, arg.f, arg.a) + z01.Challenge("ForEachProg", ForEach, correct.ForEach, arg.f, arg.a) } } diff --git a/tests/go/solutions/game23.go b/tests/go/solutions/game23.go index 9832485ab..2a383c751 100644 --- a/tests/go/solutions/game23.go +++ b/tests/go/solutions/game23.go @@ -1,4 +1,4 @@ -package solutions +package correct func Game23(a, b int) int { if a > b { diff --git a/tests/go/solutions/game23/test_game23.go b/tests/go/solutions/game23/test_game23.go index c226fbebd..7846289f3 100644 --- a/tests/go/solutions/game23/test_game23.go +++ b/tests/go/solutions/game23/test_game23.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func nd(a, b int) int { @@ -55,6 +55,6 @@ func main() { table = append(table, value) } for _, arg := range table { - z01.Challenge("Game23", Game23, solutions.Game23, arg.init, arg.fin) + z01.Challenge("Game23", Game23, correct.Game23, arg.init, arg.fin) } } diff --git a/tests/go/solutions/halfcontest.go b/tests/go/solutions/halfcontest.go index 33adb669b..2448ddeec 100644 --- a/tests/go/solutions/halfcontest.go +++ b/tests/go/solutions/halfcontest.go @@ -1,4 +1,4 @@ -package solutions +package correct func Halfcontest(h1, m1, h2, m2 int) int { t1 := h1*60 + m1 diff --git a/tests/go/solutions/halfcontestprog/test_halfcontestprog.go b/tests/go/solutions/halfcontestprog/test_halfcontestprog.go index 05d0f1d85..9e881275c 100644 --- a/tests/go/solutions/halfcontestprog/test_halfcontestprog.go +++ b/tests/go/solutions/halfcontestprog/test_halfcontestprog.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -28,6 +28,6 @@ func main() { } for _, arg := range table { - z01.Challenge("HalfContestProg", Halfcontest, solutions.Halfcontest, arg.h1, arg.m1, arg.h2, arg.m2) + z01.Challenge("HalfContestProg", Halfcontest, correct.Halfcontest, arg.h1, arg.m1, arg.h2, arg.m2) } } diff --git a/tests/go/solutions/index.go b/tests/go/solutions/index.go index 66e0158e1..baa47ebb1 100644 --- a/tests/go/solutions/index.go +++ b/tests/go/solutions/index.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/interestingnumber.go b/tests/go/solutions/interestingnumber.go index 3da9d9119..179b83bc8 100644 --- a/tests/go/solutions/interestingnumber.go +++ b/tests/go/solutions/interestingnumber.go @@ -1,4 +1,4 @@ -package solutions +package correct func isInteresting(n int) bool { s := 0 diff --git a/tests/go/solutions/interestingnumber/test_interestingnumber.go b/tests/go/solutions/interestingnumber/test_interestingnumber.go index 4e03df4db..e290d7fea 100644 --- a/tests/go/solutions/interestingnumber/test_interestingnumber.go +++ b/tests/go/solutions/interestingnumber/test_interestingnumber.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -16,6 +16,6 @@ func main() { table = append(table, z01.MultRandIntBetween(1, 1500)...) for _, arg := range table { - z01.Challenge("InterestingNumber", InterestingNumber, solutions.InterestingNumber, arg) + z01.Challenge("InterestingNumber", InterestingNumber, correct.InterestingNumber, arg) } } diff --git a/tests/go/solutions/inverttree.go b/tests/go/solutions/inverttree.go index 5f7673ab5..3a36460d8 100644 --- a/tests/go/solutions/inverttree.go +++ b/tests/go/solutions/inverttree.go @@ -1,4 +1,4 @@ -package solutions +package correct type TNode struct { Val int diff --git a/tests/go/solutions/inverttree/test_inverttree.go b/tests/go/solutions/inverttree/test_inverttree.go index dd8364d0b..b391c862c 100644 --- a/tests/go/solutions/inverttree/test_inverttree.go +++ b/tests/go/solutions/inverttree/test_inverttree.go @@ -8,11 +8,11 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type stuNode = TNode -type solNode = solutions.TNode +type solNode = correct.TNode func solInsert(N *solNode, newVal int) { if N == nil { @@ -140,7 +140,7 @@ func main() { solInsert(tree, val3) solInsert(tree, val4) // solPrint(os.Stdout, tree, 0, 'M') - solutions.InvertTree(tree) + correct.InvertTree(tree) // solPrint(os.Stdout, tree, 0, 'M') TestTree = &stuNode{Val: root, Left: nil, Right: nil} diff --git a/tests/go/solutions/isalpha.go b/tests/go/solutions/isalpha.go index d82180e51..a7c521703 100644 --- a/tests/go/solutions/isalpha.go +++ b/tests/go/solutions/isalpha.go @@ -1,4 +1,4 @@ -package solutions +package correct import "unicode" diff --git a/tests/go/solutions/isanagram.go b/tests/go/solutions/isanagram.go index 8585cb55d..6e11fb998 100644 --- a/tests/go/solutions/isanagram.go +++ b/tests/go/solutions/isanagram.go @@ -1,4 +1,4 @@ -package solutions +package correct func IsAnagram(s, t string) bool { alph := make([]int, 26) diff --git a/tests/go/solutions/isanagram/test_isanagram.go b/tests/go/solutions/isanagram/test_isanagram.go index 35ab38244..385a113ad 100644 --- a/tests/go/solutions/isanagram/test_isanagram.go +++ b/tests/go/solutions/isanagram/test_isanagram.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -33,6 +33,6 @@ func main() { } for _, arg := range table { - z01.Challenge("IsAnagram", IsAnagram, solutions.IsAnagram, arg[0], arg[1]) + z01.Challenge("IsAnagram", IsAnagram, correct.IsAnagram, arg[0], arg[1]) } } diff --git a/tests/go/solutions/islower.go b/tests/go/solutions/islower.go index 7389a9769..e351ac8c8 100644 --- a/tests/go/solutions/islower.go +++ b/tests/go/solutions/islower.go @@ -1,4 +1,4 @@ -package solutions +package correct import "unicode" diff --git a/tests/go/solutions/isnegative.go b/tests/go/solutions/isnegative.go index 87676ed9a..ba8db97d3 100644 --- a/tests/go/solutions/isnegative.go +++ b/tests/go/solutions/isnegative.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/isnumeric.go b/tests/go/solutions/isnumeric.go index 5161adaaf..6adb267b5 100644 --- a/tests/go/solutions/isnumeric.go +++ b/tests/go/solutions/isnumeric.go @@ -1,4 +1,4 @@ -package solutions +package correct import "unicode" diff --git a/tests/go/solutions/isprime.go b/tests/go/solutions/isprime.go index 67f627a4e..aadae4cd2 100644 --- a/tests/go/solutions/isprime.go +++ b/tests/go/solutions/isprime.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math" diff --git a/tests/go/solutions/isprintable.go b/tests/go/solutions/isprintable.go index 350924df9..c92e209ab 100644 --- a/tests/go/solutions/isprintable.go +++ b/tests/go/solutions/isprintable.go @@ -1,4 +1,4 @@ -package solutions +package correct import "unicode" diff --git a/tests/go/solutions/issorted.go b/tests/go/solutions/issorted.go index 94d8d3651..a10c0d6cc 100644 --- a/tests/go/solutions/issorted.go +++ b/tests/go/solutions/issorted.go @@ -1,4 +1,4 @@ -package solutions +package correct func IsSorted(f func(int, int) int, arr []int) bool { ascendingOrdered := true diff --git a/tests/go/solutions/isupper.go b/tests/go/solutions/isupper.go index c4d6d1c1e..b686c5b30 100644 --- a/tests/go/solutions/isupper.go +++ b/tests/go/solutions/isupper.go @@ -1,4 +1,4 @@ -package solutions +package correct func IsUpper(s string) bool { for _, r := range s { diff --git a/tests/go/solutions/iterativefactorial.go b/tests/go/solutions/iterativefactorial.go index 2f67a6504..4c90b6b23 100644 --- a/tests/go/solutions/iterativefactorial.go +++ b/tests/go/solutions/iterativefactorial.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math/bits" diff --git a/tests/go/solutions/iterativepower.go b/tests/go/solutions/iterativepower.go index 56ee08215..09749bdc6 100644 --- a/tests/go/solutions/iterativepower.go +++ b/tests/go/solutions/iterativepower.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math" diff --git a/tests/go/solutions/itoa.go b/tests/go/solutions/itoa.go index 32904a81e..c2abbf6bc 100644 --- a/tests/go/solutions/itoa.go +++ b/tests/go/solutions/itoa.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strconv" diff --git a/tests/go/solutions/itoabase.go b/tests/go/solutions/itoabase.go index 548711838..d595a2b1f 100644 --- a/tests/go/solutions/itoabase.go +++ b/tests/go/solutions/itoabase.go @@ -1,4 +1,4 @@ -package solutions +package correct import ( "strconv" diff --git a/tests/go/solutions/itoabaseprog/main.go b/tests/go/solutions/itoabaseprog/main.go index 8a352d39d..6a17b7e2f 100644 --- a/tests/go/solutions/itoabaseprog/main.go +++ b/tests/go/solutions/itoabaseprog/main.go @@ -3,11 +3,10 @@ package main import ( "fmt" "strconv" + "strings" "github.com/01-edu/z01" - "strings" - student "../../student" ) diff --git a/tests/go/solutions/itoabaseprog/test_itoabaseprog.go b/tests/go/solutions/itoabaseprog/test_itoabaseprog.go index ae7ae92d0..08a550c6f 100644 --- a/tests/go/solutions/itoabaseprog/test_itoabaseprog.go +++ b/tests/go/solutions/itoabaseprog/test_itoabaseprog.go @@ -3,18 +3,18 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { for i := 0; i < 30; i++ { value := z01.RandIntBetween(-1000000, 1000000) base := z01.RandIntBetween(2, 16) - z01.Challenge("ItoaBaseProg", ItoaBase, solutions.ItoaBase, value, base) + z01.Challenge("ItoaBaseProg", ItoaBase, correct.ItoaBase, value, base) } for i := 0; i < 5; i++ { base := z01.RandIntBetween(2, 16) - z01.Challenge("ItoaBaseProg", ItoaBase, solutions.ItoaBase, z01.MaxInt, base) - z01.Challenge("ItoaBaseProg", ItoaBase, solutions.ItoaBase, z01.MinInt, base) + z01.Challenge("ItoaBaseProg", ItoaBase, correct.ItoaBase, z01.MaxInt, base) + z01.Challenge("ItoaBaseProg", ItoaBase, correct.ItoaBase, z01.MinInt, base) } } diff --git a/tests/go/solutions/itoaprog/test_itoaprog.go b/tests/go/solutions/itoaprog/test_itoaprog.go index b0ec75727..cf68959ec 100644 --- a/tests/go/solutions/itoaprog/test_itoaprog.go +++ b/tests/go/solutions/itoaprog/test_itoaprog.go @@ -3,12 +3,12 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { for i := 0; i < 50; i++ { arg := z01.RandIntBetween(-2000000000, 2000000000) - z01.Challenge("ItoaProg", Itoa, solutions.Itoa, arg) + z01.Challenge("ItoaProg", Itoa, correct.Itoa, arg) } } diff --git a/tests/go/solutions/join.go b/tests/go/solutions/join.go index 7a16a1aae..7504c1a0d 100644 --- a/tests/go/solutions/join.go +++ b/tests/go/solutions/join.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/lastrune.go b/tests/go/solutions/lastrune.go index cc599088a..00b0824bd 100644 --- a/tests/go/solutions/lastrune.go +++ b/tests/go/solutions/lastrune.go @@ -1,4 +1,4 @@ -package solutions +package correct func LastRune(s string) rune { runes := []rune(s) diff --git a/tests/go/solutions/lastruneprog/test_lastruneprog.go b/tests/go/solutions/lastruneprog/test_lastruneprog.go index 4b8d1b0b4..c98ffa19f 100644 --- a/tests/go/solutions/lastruneprog/test_lastruneprog.go +++ b/tests/go/solutions/lastruneprog/test_lastruneprog.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -15,6 +15,6 @@ func main() { z01.RandStr(z01.RandIntBetween(1, 15), z01.RandAlnum()), ) for _, arg := range table { - z01.Challenge("LastRuneProg", LastRune, solutions.LastRune, arg) + z01.Challenge("LastRuneProg", LastRune, correct.LastRune, arg) } } diff --git a/tests/go/solutions/lcm.go b/tests/go/solutions/lcm.go index 0e19248ca..e84b62e5d 100644 --- a/tests/go/solutions/lcm.go +++ b/tests/go/solutions/lcm.go @@ -1,4 +1,4 @@ -package solutions +package correct func gcd(first, second int) int { if second == 0 { diff --git a/tests/go/solutions/lcm/test_lcm.go b/tests/go/solutions/lcm/test_lcm.go index 2f58c9893..9c1614af1 100644 --- a/tests/go/solutions/lcm/test_lcm.go +++ b/tests/go/solutions/lcm/test_lcm.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -23,6 +23,6 @@ func main() { } for _, arg := range table { - z01.Challenge("Lcm", Lcm, solutions.Lcm, arg[0], arg[1]) + z01.Challenge("Lcm", Lcm, correct.Lcm, arg[0], arg[1]) } } diff --git a/tests/go/solutions/listat.go b/tests/go/solutions/listat.go index 0070a413f..a82da2830 100644 --- a/tests/go/solutions/listat.go +++ b/tests/go/solutions/listat.go @@ -1,4 +1,4 @@ -package solutions +package correct // returs the node in a given position func ListAt(l *NodeL, nbr int) *NodeL { diff --git a/tests/go/solutions/listclear.go b/tests/go/solutions/listclear.go index fc7997997..b797e00d4 100644 --- a/tests/go/solutions/listclear.go +++ b/tests/go/solutions/listclear.go @@ -1,4 +1,4 @@ -package solutions +package correct func ListClear(l *List) { temp := l.Head diff --git a/tests/go/solutions/listfind.go b/tests/go/solutions/listfind.go index 6c392d208..51a2df90f 100644 --- a/tests/go/solutions/listfind.go +++ b/tests/go/solutions/listfind.go @@ -1,4 +1,4 @@ -package solutions +package correct // finds the element and returns the first data from the node that is a string func ListFind(l *List, ref interface{}, comp func(a, b interface{}) bool) *interface{} { diff --git a/tests/go/solutions/listforeach.go b/tests/go/solutions/listforeach.go index dd69bc787..55cd67ad3 100644 --- a/tests/go/solutions/listforeach.go +++ b/tests/go/solutions/listforeach.go @@ -1,4 +1,4 @@ -package solutions +package correct // applies a function in argument to each element of the linked list func ListForEach(l *List, f func(*NodeL)) { diff --git a/tests/go/solutions/listforeachif.go b/tests/go/solutions/listforeachif.go index 6aaea655b..81e4bbbea 100644 --- a/tests/go/solutions/listforeachif.go +++ b/tests/go/solutions/listforeachif.go @@ -1,4 +1,4 @@ -package solutions +package correct // compare each element of the linked list to see if it is a String func IsPositive_node(node *NodeL) bool { diff --git a/tests/go/solutions/listlast.go b/tests/go/solutions/listlast.go index ea12ae040..688afd77c 100644 --- a/tests/go/solutions/listlast.go +++ b/tests/go/solutions/listlast.go @@ -1,4 +1,4 @@ -package solutions +package correct // gives the last element of the list func ListLast(l *List) interface{} { diff --git a/tests/go/solutions/listmerge.go b/tests/go/solutions/listmerge.go index f85862d15..b6d5fb48b 100644 --- a/tests/go/solutions/listmerge.go +++ b/tests/go/solutions/listmerge.go @@ -1,4 +1,4 @@ -package solutions +package correct // merges the 2 lists in one (in the end of the first list) func ListMerge(l1 *List, l2 *List) { diff --git a/tests/go/solutions/listpushback.go b/tests/go/solutions/listpushback.go index e45ecf406..3d8858f21 100644 --- a/tests/go/solutions/listpushback.go +++ b/tests/go/solutions/listpushback.go @@ -1,4 +1,4 @@ -package solutions +package correct type NodeL struct { Data interface{} diff --git a/tests/go/solutions/listpushfront.go b/tests/go/solutions/listpushfront.go index 6ae0c5c6c..2ba3db199 100644 --- a/tests/go/solutions/listpushfront.go +++ b/tests/go/solutions/listpushfront.go @@ -1,4 +1,4 @@ -package solutions +package correct // inserts node on the first position of the list func ListPushFront(l *List, data interface{}) { diff --git a/tests/go/solutions/listremoveif.go b/tests/go/solutions/listremoveif.go index cd464d647..a7be6789b 100644 --- a/tests/go/solutions/listremoveif.go +++ b/tests/go/solutions/listremoveif.go @@ -1,4 +1,4 @@ -package solutions +package correct // removes all elements that are equal to the data_ref func ListRemoveIf(l *List, data_ref interface{}) { diff --git a/tests/go/solutions/listremoveifprog/test_listremoveifprog.go b/tests/go/solutions/listremoveifprog/test_listremoveifprog.go index c0f236254..68e2c3bd8 100644 --- a/tests/go/solutions/listremoveifprog/test_listremoveifprog.go +++ b/tests/go/solutions/listremoveifprog/test_listremoveifprog.go @@ -5,12 +5,12 @@ import ( "github.com/01-edu/z01" - solution "../../solutions" + correct "./correct" ) type Node10 = NodeL -type List10 = solution.List -type NodeS10 = solution.NodeL +type List10 = correct.List +type NodeS10 = correct.NodeL type ListS10 = List func listToStringStu12(l *ListS10) string { @@ -56,11 +56,11 @@ func comparFuncList10(l1 *List10, l2 *ListS10, data interface{}) { for l1.Head != nil || l2.Head != nil { if (l1.Head == nil && l2.Head != nil) || (l1.Head != nil && l2.Head == nil) { z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", - data, listToStringStu12(l2), solution.ListToString(l1.Head), l2.Head, l1.Head) + data, listToStringStu12(l2), correct.ListToString(l1.Head), l2.Head, l1.Head) } if l1.Head.Data != l2.Head.Data { z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", - data, listToStringStu12(l2), solution.ListToString(l1.Head), l2.Head.Data, l1.Head.Data) + data, listToStringStu12(l2), correct.ListToString(l1.Head), l2.Head.Data, l1.Head.Data) } l1.Head = l1.Head.Next l2.Head = l2.Head.Next @@ -71,12 +71,12 @@ func comparFuncList10(l1 *List10, l2 *ListS10, data interface{}) { func main() { link1 := &List10{} link2 := &ListS10{} - table := []solution.NodeTest{} + table := []correct.NodeTest{} - table = solution.ElementsToTest(table) + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"hello", "hello1", "hello2", "hello3"}, }, ) @@ -91,11 +91,11 @@ func main() { if link1.Head != nil && link2.Head != nil { cho := arg.Data[index] ListRemoveIf(link2, cho) - solution.ListRemoveIf(link1, cho) + correct.ListRemoveIf(link1, cho) comparFuncList10(link1, link2, cho) } else { ListRemoveIf(link2, 1) - solution.ListRemoveIf(link1, 1) + correct.ListRemoveIf(link1, 1) comparFuncList10(link1, link2, 1) } diff --git a/tests/go/solutions/listreverse.go b/tests/go/solutions/listreverse.go index aee535c7c..27f70ae36 100644 --- a/tests/go/solutions/listreverse.go +++ b/tests/go/solutions/listreverse.go @@ -1,4 +1,4 @@ -package solutions +package correct func ListReverse(l *List) { current := l.Head diff --git a/tests/go/solutions/listsize.go b/tests/go/solutions/listsize.go index 7b1f497f4..6d122f92d 100644 --- a/tests/go/solutions/listsize.go +++ b/tests/go/solutions/listsize.go @@ -1,4 +1,4 @@ -package solutions +package correct func ListSize(l *List) int { count := 0 diff --git a/tests/go/solutions/listsizeprog/test_listsizeprog.go b/tests/go/solutions/listsizeprog/test_listsizeprog.go index aaee2f615..81f5c545e 100644 --- a/tests/go/solutions/listsizeprog/test_listsizeprog.go +++ b/tests/go/solutions/listsizeprog/test_listsizeprog.go @@ -1,13 +1,14 @@ package main import ( - solution "../../solutions" "github.com/01-edu/z01" + + correct "./correct" ) type Node2 = NodeL -type List2 = solution.List -type NodeS2 = solution.NodeL +type List2 = correct.List +type NodeS2 = correct.NodeL type ListS2 = List func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { @@ -37,10 +38,10 @@ func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { func main() { link := &List2{} link2 := &ListS2{} - table := []solution.NodeTest{} - table = solution.ElementsToTest(table) + table := []correct.NodeTest{} + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"Hello", "man", "how are you"}, }, ) @@ -48,10 +49,10 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest2(link2, link, arg.Data[i]) } - aux := solution.ListSize(link) + aux := correct.ListSize(link) aux2 := ListSize(link2) if aux != aux2 { - z01.Fatalf("ListSize(%v) == %d instead of %d\n", solution.ListToString(link.Head), aux2, aux) + z01.Fatalf("ListSize(%v) == %d instead of %d\n", correct.ListToString(link.Head), aux2, aux) } link = &List2{} link2 = &ListS2{} diff --git a/tests/go/solutions/listsort.go b/tests/go/solutions/listsort.go index abd893b2f..34a96417b 100644 --- a/tests/go/solutions/listsort.go +++ b/tests/go/solutions/listsort.go @@ -1,4 +1,4 @@ -package solutions +package correct func ListSort(l *NodeI) *NodeI { head := l diff --git a/tests/go/solutions/makerange.go b/tests/go/solutions/makerange.go index 93c27d9ef..9d10ec801 100644 --- a/tests/go/solutions/makerange.go +++ b/tests/go/solutions/makerange.go @@ -1,4 +1,4 @@ -package solutions +package correct func MakeRange(min, max int) []int { size := max - min diff --git a/tests/go/solutions/map.go b/tests/go/solutions/map.go index 5649d4db2..05004a4e9 100644 --- a/tests/go/solutions/map.go +++ b/tests/go/solutions/map.go @@ -1,4 +1,4 @@ -package solutions +package correct func IsPositive(value int) bool { return value > 0 diff --git a/tests/go/solutions/max.go b/tests/go/solutions/max.go index 11c42ad3f..c5d44518b 100644 --- a/tests/go/solutions/max.go +++ b/tests/go/solutions/max.go @@ -1,4 +1,4 @@ -package solutions +package correct import "sort" diff --git a/tests/go/solutions/maxprog/test_maxprog.go b/tests/go/solutions/maxprog/test_maxprog.go index f8c7070ea..7f247ef14 100644 --- a/tests/go/solutions/maxprog/test_maxprog.go +++ b/tests/go/solutions/maxprog/test_maxprog.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -13,5 +13,5 @@ func main() { args = append(args, z01.RandInt()) } - z01.Challenge("MaxProg", Max, solutions.Max, args) + z01.Challenge("MaxProg", Max, correct.Max, args) } diff --git a/tests/go/solutions/merge.go b/tests/go/solutions/merge.go index 89681fe15..9dcb69dcc 100644 --- a/tests/go/solutions/merge.go +++ b/tests/go/solutions/merge.go @@ -1,4 +1,4 @@ -package solutions +package correct type TreeNodeM struct { Left *TreeNodeM diff --git a/tests/go/solutions/merge/test_merge.go b/tests/go/solutions/merge/test_merge.go index 91c9025e4..9b044bbd9 100644 --- a/tests/go/solutions/merge/test_merge.go +++ b/tests/go/solutions/merge/test_merge.go @@ -6,11 +6,11 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type stuTreeNode = TreeNodeM -type solTreeNode = solutions.TreeNodeM +type solTreeNode = correct.TreeNodeM func New(n, k int) (*solTreeNode, *stuTreeNode, *solTreeNode) { var cop *solTreeNode @@ -166,7 +166,7 @@ func main() { cop1, stuTree1, solTree1 := New(arg.n, arg.k) cop2, stuTree2, solTree2 := New(arg.n, arg.k) stuResult := MergeTrees(stuTree1, stuTree2) - solResult := solutions.MergeTrees(solTree1, solTree2) + solResult := correct.MergeTrees(solTree1, solTree2) compareTrees(stuResult, solResult, cop1, cop2) } diff --git a/tests/go/solutions/nauuo.go b/tests/go/solutions/nauuo.go index 0d94e21a4..1e38c59bd 100644 --- a/tests/go/solutions/nauuo.go +++ b/tests/go/solutions/nauuo.go @@ -1,4 +1,4 @@ -package solutions +package correct func Nauuo(plus, minus, rand int) string { if rand == 0 { diff --git a/tests/go/solutions/nauuo/test_nauuo.go b/tests/go/solutions/nauuo/test_nauuo.go index 81ad9ed13..1eeec78c9 100644 --- a/tests/go/solutions/nauuo/test_nauuo.go +++ b/tests/go/solutions/nauuo/test_nauuo.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -27,6 +27,6 @@ func main() { }) } for _, arg := range table { - z01.Challenge("Nauuo", Nauuo, solutions.Nauuo, arg.plus, arg.minus, arg.rand) + z01.Challenge("Nauuo", Nauuo, correct.Nauuo, arg.plus, arg.minus, arg.rand) } } diff --git a/tests/go/solutions/nrune.go b/tests/go/solutions/nrune.go index ccf845ba1..40662d0a1 100644 --- a/tests/go/solutions/nrune.go +++ b/tests/go/solutions/nrune.go @@ -1,4 +1,4 @@ -package solutions +package correct func NRune(s string, n int) rune { if n > len(s) || n < 1 { diff --git a/tests/go/solutions/nruneprog/main.go b/tests/go/solutions/nruneprog/main.go index be94ee66d..3b217118c 100644 --- a/tests/go/solutions/nruneprog/main.go +++ b/tests/go/solutions/nruneprog/main.go @@ -5,7 +5,7 @@ import ( "os" "strconv" - solutions ".." + correct ".." ) func NRune(s string, n int) rune { @@ -27,7 +27,7 @@ func main() { return } - rune := solutions.NRune(os.Args[1], val) + rune := correct.NRune(os.Args[1], val) if rune == 0 { fmt.Printf("Invalid position: \"%d\" in \"%s\"\n", val, os.Args[1]) diff --git a/tests/go/solutions/nruneprog/test_nruneprog.go b/tests/go/solutions/nruneprog/test_nruneprog.go index 060c680b3..377dec48b 100644 --- a/tests/go/solutions/nruneprog/test_nruneprog.go +++ b/tests/go/solutions/nruneprog/test_nruneprog.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -38,6 +38,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("NRuneProg", NRune, solutions.NRune, arg.word, arg.n) + z01.Challenge("NRuneProg", NRune, correct.NRune, arg.word, arg.n) } } diff --git a/tests/go/solutions/pilot.go b/tests/go/solutions/pilot.go index 226946ca7..c2e064103 100644 --- a/tests/go/solutions/pilot.go +++ b/tests/go/solutions/pilot.go @@ -1,4 +1,4 @@ -package solutions +package correct type Pilot struct { Name string diff --git a/tests/go/solutions/pointone.go b/tests/go/solutions/pointone.go index 10556e969..906de4187 100644 --- a/tests/go/solutions/pointone.go +++ b/tests/go/solutions/pointone.go @@ -1,4 +1,4 @@ -package solutions +package correct func PointOne(n *int) { *n = 1 diff --git a/tests/go/solutions/printchessboard.go b/tests/go/solutions/printchessboard.go index 2bd97df83..0a24e296d 100644 --- a/tests/go/solutions/printchessboard.go +++ b/tests/go/solutions/printchessboard.go @@ -1,4 +1,4 @@ -package solutions +package correct import ( "os" diff --git a/tests/go/solutions/printcomb.go b/tests/go/solutions/printcomb.go index cfcae0a16..c5e98d486 100644 --- a/tests/go/solutions/printcomb.go +++ b/tests/go/solutions/printcomb.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/printcomb2.go b/tests/go/solutions/printcomb2.go index f047ee140..72296ed61 100644 --- a/tests/go/solutions/printcomb2.go +++ b/tests/go/solutions/printcomb2.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/printcombn.go b/tests/go/solutions/printcombn.go index 3f2238af3..ea354588a 100644 --- a/tests/go/solutions/printcombn.go +++ b/tests/go/solutions/printcombn.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/printmemory.go b/tests/go/solutions/printmemory.go index 6e2f3fb62..739b30cf4 100644 --- a/tests/go/solutions/printmemory.go +++ b/tests/go/solutions/printmemory.go @@ -1,4 +1,4 @@ -package solutions +package correct import ( "unicode" diff --git a/tests/go/solutions/printmemory/test_printmemory.go b/tests/go/solutions/printmemory/test_printmemory.go index b0071bfc6..3f452f732 100644 --- a/tests/go/solutions/printmemory/test_printmemory.go +++ b/tests/go/solutions/printmemory/test_printmemory.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -13,8 +13,8 @@ func main() { for i := 0; i < 10; i++ { table[i] = z01.RandIntBetween(0, 1000) } - z01.Challenge("PrintMemory", PrintMemory, solutions.PrintMemory, table) + z01.Challenge("PrintMemory", PrintMemory, correct.PrintMemory, table) } table2 := [10]int{104, 101, 108, 108, 111, 16, 21, 42} - z01.Challenge("PrintMemory", PrintMemory, solutions.PrintMemory, table2) + z01.Challenge("PrintMemory", PrintMemory, correct.PrintMemory, table2) } diff --git a/tests/go/solutions/printnbr.go b/tests/go/solutions/printnbr.go index 75a3476bc..6d332a996 100644 --- a/tests/go/solutions/printnbr.go +++ b/tests/go/solutions/printnbr.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/printnbrbase.go b/tests/go/solutions/printnbrbase.go index 2d06e3627..1ab703072 100644 --- a/tests/go/solutions/printnbrbase.go +++ b/tests/go/solutions/printnbrbase.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/printnbrinorder.go b/tests/go/solutions/printnbrinorder.go index 987b47d99..ff436b8f2 100644 --- a/tests/go/solutions/printnbrinorder.go +++ b/tests/go/solutions/printnbrinorder.go @@ -1,4 +1,4 @@ -package solutions +package correct import ( "sort" diff --git a/tests/go/solutions/printstr.go b/tests/go/solutions/printstr.go index 2ae5cff92..7c56225e0 100644 --- a/tests/go/solutions/printstr.go +++ b/tests/go/solutions/printstr.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/printwordstables.go b/tests/go/solutions/printwordstables.go index c3d779629..3993568df 100644 --- a/tests/go/solutions/printwordstables.go +++ b/tests/go/solutions/printwordstables.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/priorprime.go b/tests/go/solutions/priorprime.go index e0724d9db..210833e0f 100644 --- a/tests/go/solutions/priorprime.go +++ b/tests/go/solutions/priorprime.go @@ -1,4 +1,4 @@ -package solutions +package correct func PriorPrime(x int) int { ans := 0 diff --git a/tests/go/solutions/priorprime/test_priorprime.go b/tests/go/solutions/priorprime/test_priorprime.go index 4d24c9783..deb8060ba 100644 --- a/tests/go/solutions/priorprime/test_priorprime.go +++ b/tests/go/solutions/priorprime/test_priorprime.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -17,6 +17,6 @@ func main() { } table = append(table, z01.MultRandIntBetween(0, 1000)) for _, arg := range table { - z01.Challenge("PriorPrime", PriorPrime, solutions.PriorPrime, arg) + z01.Challenge("PriorPrime", PriorPrime, correct.PriorPrime, arg) } } diff --git a/tests/go/solutions/raid1a.go b/tests/go/solutions/raid1a.go index ede874255..288d99a5d 100644 --- a/tests/go/solutions/raid1a.go +++ b/tests/go/solutions/raid1a.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/raid1b.go b/tests/go/solutions/raid1b.go index 720427078..dbe96fae1 100644 --- a/tests/go/solutions/raid1b.go +++ b/tests/go/solutions/raid1b.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/raid1c.go b/tests/go/solutions/raid1c.go index cabc10fd4..fb4e55151 100644 --- a/tests/go/solutions/raid1c.go +++ b/tests/go/solutions/raid1c.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/raid1d.go b/tests/go/solutions/raid1d.go index 52eb7c497..a18b38148 100644 --- a/tests/go/solutions/raid1d.go +++ b/tests/go/solutions/raid1d.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/raid1e.go b/tests/go/solutions/raid1e.go index a1b738a84..a2190d651 100644 --- a/tests/go/solutions/raid1e.go +++ b/tests/go/solutions/raid1e.go @@ -1,4 +1,4 @@ -package solutions +package correct import "github.com/01-edu/z01" diff --git a/tests/go/solutions/raid3/raid1aProg/raid1a.go b/tests/go/solutions/raid3/raid1aProg/raid1a.go index 96585dd22..029e4fbd4 100644 --- a/tests/go/solutions/raid3/raid1aProg/raid1a.go +++ b/tests/go/solutions/raid3/raid1aProg/raid1a.go @@ -5,7 +5,7 @@ import ( "os" "strconv" - solutions "../.." + correct "../.." ) func main() { @@ -16,7 +16,7 @@ func main() { if err != nil || err2 != nil { fmt.Println(err) } - solutions.Raid1a(firstArg, secondArg) + correct.Raid1a(firstArg, secondArg) } else { fmt.Println("too much arguments") } diff --git a/tests/go/solutions/raid3/raid1bProg/raid1b.go b/tests/go/solutions/raid3/raid1bProg/raid1b.go index 8d74977f7..62cc3850e 100644 --- a/tests/go/solutions/raid3/raid1bProg/raid1b.go +++ b/tests/go/solutions/raid3/raid1bProg/raid1b.go @@ -5,7 +5,7 @@ import ( "os" "strconv" - solutions "../.." + correct "../.." ) func main() { @@ -16,7 +16,7 @@ func main() { if err != nil || err2 != nil { fmt.Println(err) } - solutions.Raid1b(firstArg, secondArg) + correct.Raid1b(firstArg, secondArg) } else { fmt.Println("too much arguments") } diff --git a/tests/go/solutions/raid3/raid1cProg/raid1c.go b/tests/go/solutions/raid3/raid1cProg/raid1c.go index 51a6161ad..e9b3c56d6 100644 --- a/tests/go/solutions/raid3/raid1cProg/raid1c.go +++ b/tests/go/solutions/raid3/raid1cProg/raid1c.go @@ -5,7 +5,7 @@ import ( "os" "strconv" - solutions "../.." + correct "../.." ) func main() { @@ -16,7 +16,7 @@ func main() { if err != nil || err2 != nil { fmt.Println(err) } - solutions.Raid1c(firstArg, secondArg) + correct.Raid1c(firstArg, secondArg) } else { fmt.Println("too much arguments") } diff --git a/tests/go/solutions/raid3/raid1dProg/raid1d.go b/tests/go/solutions/raid3/raid1dProg/raid1d.go index 28c806eb0..1836bc4af 100644 --- a/tests/go/solutions/raid3/raid1dProg/raid1d.go +++ b/tests/go/solutions/raid3/raid1dProg/raid1d.go @@ -5,7 +5,7 @@ import ( "os" "strconv" - solutions "../.." + correct "../.." ) func main() { @@ -16,7 +16,7 @@ func main() { if err != nil || err2 != nil { fmt.Println(err) } - solutions.Raid1d(firstArg, secondArg) + correct.Raid1d(firstArg, secondArg) } else { fmt.Println("too much arguments") } diff --git a/tests/go/solutions/raid3/raid1eProg/raid1e.go b/tests/go/solutions/raid3/raid1eProg/raid1e.go index 09984ce1e..4096d5440 100644 --- a/tests/go/solutions/raid3/raid1eProg/raid1e.go +++ b/tests/go/solutions/raid3/raid1eProg/raid1e.go @@ -5,7 +5,7 @@ import ( "os" "strconv" - solutions "../.." + correct "../.." ) func main() { @@ -16,7 +16,7 @@ func main() { if err != nil || err2 != nil { fmt.Println(err) } - solutions.Raid1e(firstArg, secondArg) + correct.Raid1e(firstArg, secondArg) } else { fmt.Println("too much arguments") } diff --git a/tests/go/solutions/reachablenumber.go b/tests/go/solutions/reachablenumber.go index 2885a1ba3..589843b31 100644 --- a/tests/go/solutions/reachablenumber.go +++ b/tests/go/solutions/reachablenumber.go @@ -1,4 +1,4 @@ -package solutions +package correct func ReachableNumber(n int) int { cnt := 0 diff --git a/tests/go/solutions/reachablenumberprog/test_reachablenumber.go b/tests/go/solutions/reachablenumberprog/test_reachablenumber.go index d2964cfec..790b38269 100644 --- a/tests/go/solutions/reachablenumberprog/test_reachablenumber.go +++ b/tests/go/solutions/reachablenumberprog/test_reachablenumber.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -17,6 +17,6 @@ func main() { table = append(table, z01.MultRandIntBetween(1, 877)) } for _, arg := range table { - z01.Challenge("ReachableNumber", ReachableNumber, solutions.ReachableNumber, arg) + z01.Challenge("ReachableNumber", ReachableNumber, correct.ReachableNumber, arg) } } diff --git a/tests/go/solutions/recursivefactorial.go b/tests/go/solutions/recursivefactorial.go index fb32c9197..bcabf7825 100644 --- a/tests/go/solutions/recursivefactorial.go +++ b/tests/go/solutions/recursivefactorial.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math/bits" diff --git a/tests/go/solutions/recursivepower.go b/tests/go/solutions/recursivepower.go index 658c78c17..f3762203a 100644 --- a/tests/go/solutions/recursivepower.go +++ b/tests/go/solutions/recursivepower.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math" diff --git a/tests/go/solutions/reduceint.go b/tests/go/solutions/reduceint.go index e0c78b142..a62a06dcb 100644 --- a/tests/go/solutions/reduceint.go +++ b/tests/go/solutions/reduceint.go @@ -1,4 +1,4 @@ -package solutions +package correct import "fmt" diff --git a/tests/go/solutions/reduceint/test_reduceint.go b/tests/go/solutions/reduceint/test_reduceint.go index b266eaf5c..247d6c0f0 100644 --- a/tests/go/solutions/reduceint/test_reduceint.go +++ b/tests/go/solutions/reduceint/test_reduceint.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -27,7 +27,7 @@ func main() { for _, v := range table { for _, f := range v.functions { - z01.Challenge("ReduceInt", ReduceInt, solutions.ReduceInt, f, v.arr) + z01.Challenge("ReduceInt", ReduceInt, correct.ReduceInt, f, v.arr) } } } diff --git a/tests/go/solutions/reverse.go b/tests/go/solutions/reverse.go index 6a946b00d..fb4ed096d 100644 --- a/tests/go/solutions/reverse.go +++ b/tests/go/solutions/reverse.go @@ -1,4 +1,4 @@ -package solutions +package correct func Reverse(node *NodeAddL) *NodeAddL { if node == nil { diff --git a/tests/go/solutions/reverse/test_reverse.go b/tests/go/solutions/reverse/test_reverse.go index 8e758c0a0..1f7099648 100644 --- a/tests/go/solutions/reverse/test_reverse.go +++ b/tests/go/solutions/reverse/test_reverse.go @@ -3,11 +3,11 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type stuNode = NodeAddL -type solNode = solutions.NodeAddL +type solNode = correct.NodeAddL func stuPushFront(node *stuNode, num int) *stuNode { tmp := &stuNode{Num: num} @@ -82,7 +82,7 @@ func main() { table = append(table, z01.MultRandIntBetween(0, 1000000000)...) for _, arg := range table { stuResult := Reverse(stuNumToList(arg)) - solResult := solutions.Reverse(solNumToList(arg)) + solResult := correct.Reverse(solNumToList(arg)) compareNodes(stuResult, solResult, arg) } diff --git a/tests/go/solutions/reversebits.go b/tests/go/solutions/reversebits.go index cc79d59f6..e7250b1a7 100644 --- a/tests/go/solutions/reversebits.go +++ b/tests/go/solutions/reversebits.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math/bits" diff --git a/tests/go/solutions/reversebits/test_reversebits.go b/tests/go/solutions/reversebits/test_reversebits.go index 757bc69cf..a01fdca4e 100644 --- a/tests/go/solutions/reversebits/test_reversebits.go +++ b/tests/go/solutions/reversebits/test_reversebits.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func challengeBytes(fn1, fn2 interface{}, args ...interface{}) { @@ -30,6 +30,6 @@ func main() { } for _, v := range args { - challengeBytes(ReverseBits, solutions.ReverseBits, v) + challengeBytes(ReverseBits, correct.ReverseBits, v) } } diff --git a/tests/go/solutions/revivethreenums.go b/tests/go/solutions/revivethreenums.go index d1e77a8cb..1fd492ded 100644 --- a/tests/go/solutions/revivethreenums.go +++ b/tests/go/solutions/revivethreenums.go @@ -1,4 +1,4 @@ -package solutions +package correct func more(a, b int) int { if a < b { diff --git a/tests/go/solutions/revivethreenums/test_revivethreenums.go b/tests/go/solutions/revivethreenums/test_revivethreenums.go index 3cd769833..2d4d82cc5 100644 --- a/tests/go/solutions/revivethreenums/test_revivethreenums.go +++ b/tests/go/solutions/revivethreenums/test_revivethreenums.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -25,6 +25,6 @@ func main() { }) } for _, arg := range table { - z01.Challenge("Revivethreenums", ReviveThreeNums, solutions.ReviveThreeNums, arg[0], arg[1], arg[2], arg[3]) + z01.Challenge("Revivethreenums", ReviveThreeNums, correct.ReviveThreeNums, arg[0], arg[1], arg[2], arg[3]) } } diff --git a/tests/go/solutions/rot14.go b/tests/go/solutions/rot14.go index 37204dd6d..c32c5ed38 100644 --- a/tests/go/solutions/rot14.go +++ b/tests/go/solutions/rot14.go @@ -1,4 +1,4 @@ -package solutions +package correct func Rot14(s string) (result string) { for _, r := range s { diff --git a/tests/go/solutions/sametree.go b/tests/go/solutions/sametree.go index 5d049031a..9d6bd33c0 100644 --- a/tests/go/solutions/sametree.go +++ b/tests/go/solutions/sametree.go @@ -1,4 +1,4 @@ -package solutions +package correct type TreeNodeL struct { Left *TreeNodeL diff --git a/tests/go/solutions/sametree/test_sametree.go b/tests/go/solutions/sametree/test_sametree.go index 42d5f6d84..fdd3518d9 100644 --- a/tests/go/solutions/sametree/test_sametree.go +++ b/tests/go/solutions/sametree/test_sametree.go @@ -6,11 +6,11 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type stuTreeNode = TreeNodeL -type solTreeNode = solutions.TreeNodeL +type solTreeNode = correct.TreeNodeL func insertStu(t *stuTreeNode, v int) *stuTreeNode { if t == nil { @@ -107,7 +107,7 @@ func main() { cop1, stuTree1, solTree1 := New(arg.n, arg.k) cop2, stuTree2, solTree2 := New(arg.n, arg.k) stuResult := IsSameTree(stuTree1, stuTree2) - solResult := solutions.IsSameTree(solTree1, solTree2) + solResult := correct.IsSameTree(solTree1, solTree2) compareResults(stuResult, solResult, cop1, cop2) } @@ -116,7 +116,7 @@ func main() { for _, arg := range table { cop1, stuTree1, solTree1 := New(arg.n, arg.k) stuResult := IsSameTree(stuTree1, stuTree1) - solResult := solutions.IsSameTree(solTree1, solTree1) + solResult := correct.IsSameTree(solTree1, solTree1) compareResults(stuResult, solResult, cop1, cop1) } diff --git a/tests/go/solutions/slice.go b/tests/go/solutions/slice.go index 3aca3b23b..443654802 100644 --- a/tests/go/solutions/slice.go +++ b/tests/go/solutions/slice.go @@ -1,4 +1,4 @@ -package solutions +package correct func ifNegative(a []string, n int) int { if n < 0 { diff --git a/tests/go/solutions/sliceprog/test_sliceprog.go b/tests/go/solutions/sliceprog/test_sliceprog.go index e3b984c30..e84775660 100644 --- a/tests/go/solutions/sliceprog/test_sliceprog.go +++ b/tests/go/solutions/sliceprog/test_sliceprog.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -40,6 +40,6 @@ func main() { } for _, a := range arr { - z01.Challenge("SliceProg", Slice, solutions.Slice, a...) + z01.Challenge("SliceProg", Slice, correct.Slice, a...) } } diff --git a/tests/go/solutions/sortedlistmerge.go b/tests/go/solutions/sortedlistmerge.go index c9f65823a..d8c424884 100644 --- a/tests/go/solutions/sortedlistmerge.go +++ b/tests/go/solutions/sortedlistmerge.go @@ -1,4 +1,4 @@ -package solutions +package correct func SortedListMerge(l1 *NodeI, l2 *NodeI) *NodeI { if l1 == nil { diff --git a/tests/go/solutions/sortintegertable.go b/tests/go/solutions/sortintegertable.go index d4e8076bf..69d865512 100644 --- a/tests/go/solutions/sortintegertable.go +++ b/tests/go/solutions/sortintegertable.go @@ -1,4 +1,4 @@ -package solutions +package correct import "sort" diff --git a/tests/go/solutions/sortlist.go b/tests/go/solutions/sortlist.go index f94ab5445..c4d08cf25 100644 --- a/tests/go/solutions/sortlist.go +++ b/tests/go/solutions/sortlist.go @@ -1,4 +1,4 @@ -package solutions +package correct type Nodelist struct { Data int diff --git a/tests/go/solutions/sortlistinsert.go b/tests/go/solutions/sortlistinsert.go index 1342a7ed6..fb65031bf 100644 --- a/tests/go/solutions/sortlistinsert.go +++ b/tests/go/solutions/sortlistinsert.go @@ -1,4 +1,4 @@ -package solutions +package correct // structures for the linked lists type NodeI struct { diff --git a/tests/go/solutions/sortll.go b/tests/go/solutions/sortll.go index 090a0bff4..16f6f5787 100644 --- a/tests/go/solutions/sortll.go +++ b/tests/go/solutions/sortll.go @@ -1,4 +1,4 @@ -package solutions +package correct func Sortll(node *NodeAddL) *NodeAddL { if node == nil { diff --git a/tests/go/solutions/sortll/test_sortll.go b/tests/go/solutions/sortll/test_sortll.go index a8ac4f2ad..7c6c45ebb 100644 --- a/tests/go/solutions/sortll/test_sortll.go +++ b/tests/go/solutions/sortll/test_sortll.go @@ -3,11 +3,11 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) type stuNode = NodeAddL -type solNode = solutions.NodeAddL +type solNode = correct.NodeAddL func stuPushFront(node *stuNode, num int) *stuNode { tmp := &stuNode{Num: num} @@ -84,7 +84,7 @@ func main() { table = append(table, z01.MultRandIntBetween(0, 1000000000)...) for _, arg := range table { stuResult := Sortll(stuNumToList(arg)) - solResult := solutions.Sortll(solNumToList(arg)) + solResult := correct.Sortll(solNumToList(arg)) compareNodes(stuResult, solResult, arg) } diff --git a/tests/go/solutions/sortwordarr.go b/tests/go/solutions/sortwordarr.go index 304209093..31d070e24 100644 --- a/tests/go/solutions/sortwordarr.go +++ b/tests/go/solutions/sortwordarr.go @@ -1,4 +1,4 @@ -package solutions +package correct import "sort" diff --git a/tests/go/solutions/sortwordarrprog/test_sortwordarrprog.go b/tests/go/solutions/sortwordarrprog/test_sortwordarrprog.go index e7bde16d6..2f642cff1 100644 --- a/tests/go/solutions/sortwordarrprog/test_sortwordarrprog.go +++ b/tests/go/solutions/sortwordarrprog/test_sortwordarrprog.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -24,7 +24,7 @@ func main() { copy(cp_sol, org) copy(cp_stu, org) - solutions.SortWordArr(cp_sol) + correct.SortWordArr(cp_sol) SortWordArr(cp_stu) if !reflect.DeepEqual(cp_stu, cp_sol) { diff --git a/tests/go/solutions/split.go b/tests/go/solutions/split.go index f98fe2f39..c8001eea7 100644 --- a/tests/go/solutions/split.go +++ b/tests/go/solutions/split.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/splitprog/test_splitprog.go b/tests/go/solutions/splitprog/test_splitprog.go index 1993401e8..65c247ca5 100644 --- a/tests/go/solutions/splitprog/test_splitprog.go +++ b/tests/go/solutions/splitprog/test_splitprog.go @@ -6,7 +6,7 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -41,6 +41,6 @@ func main() { node{str: "HelloHAhowHAareHAyou?", sep: "HA"}) for _, arg := range table { - z01.Challenge("SplitProg", Split, solutions.Split, arg.str, arg.sep) + z01.Challenge("SplitProg", Split, correct.Split, arg.str, arg.sep) } } diff --git a/tests/go/solutions/splitwhitespaces.go b/tests/go/solutions/splitwhitespaces.go index f2b1728df..f42dc1e0f 100644 --- a/tests/go/solutions/splitwhitespaces.go +++ b/tests/go/solutions/splitwhitespaces.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/sqrt.go b/tests/go/solutions/sqrt.go index 615e5b6d6..822d31a85 100644 --- a/tests/go/solutions/sqrt.go +++ b/tests/go/solutions/sqrt.go @@ -1,4 +1,4 @@ -package solutions +package correct import "math" diff --git a/tests/go/solutions/strlen.go b/tests/go/solutions/strlen.go index e82401388..e5281d5dc 100644 --- a/tests/go/solutions/strlen.go +++ b/tests/go/solutions/strlen.go @@ -1,4 +1,4 @@ -package solutions +package correct func StrLen(str string) int { len := 0 diff --git a/tests/go/solutions/strlenprog/test_strlenprog.go b/tests/go/solutions/strlenprog/test_strlenprog.go index 07d366a87..ebda581f8 100644 --- a/tests/go/solutions/strlenprog/test_strlenprog.go +++ b/tests/go/solutions/strlenprog/test_strlenprog.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -19,6 +19,6 @@ func main() { table = append(table, randomStringCharset) for _, s := range table { - z01.Challenge("StrLenProg", StrLen, solutions.StrLen, s) + z01.Challenge("StrLenProg", StrLen, correct.StrLen, s) } } diff --git a/tests/go/solutions/strrev.go b/tests/go/solutions/strrev.go index 977cfd409..8dd5f13c6 100644 --- a/tests/go/solutions/strrev.go +++ b/tests/go/solutions/strrev.go @@ -1,4 +1,4 @@ -package solutions +package correct func StrRev(s string) string { runes := []rune(s) diff --git a/tests/go/solutions/strrevprog/main.go b/tests/go/solutions/strrevprog/main.go index f0731d69a..9276bc3b9 100644 --- a/tests/go/solutions/strrevprog/main.go +++ b/tests/go/solutions/strrevprog/main.go @@ -3,8 +3,6 @@ package main import ( "fmt" "os" - - solutions ".." ) func main() { @@ -12,5 +10,5 @@ func main() { return } - fmt.Println(solutions.StrRev(os.Args[1])) + fmt.Println(correct.StrRev(os.Args[1])) } diff --git a/tests/go/solutions/swap.go b/tests/go/solutions/swap.go index 00bda0ce2..58c5dcddc 100644 --- a/tests/go/solutions/swap.go +++ b/tests/go/solutions/swap.go @@ -1,4 +1,4 @@ -package solutions +package correct func Swap(a, b *int) { *a, *b = *b, *a diff --git a/tests/go/solutions/swapbits.go b/tests/go/solutions/swapbits.go index 3e7dd9df2..df24d925b 100644 --- a/tests/go/solutions/swapbits.go +++ b/tests/go/solutions/swapbits.go @@ -1,4 +1,4 @@ -package solutions +package correct func SwapBits(n byte) byte { return (n >> 4) | (n << 4) diff --git a/tests/go/solutions/swapbits/test_swapbits.go b/tests/go/solutions/swapbits/test_swapbits.go index 3fe248e4f..d85b27785 100644 --- a/tests/go/solutions/swapbits/test_swapbits.go +++ b/tests/go/solutions/swapbits/test_swapbits.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func challengeBytes(fn1, fn2 interface{}, args ...interface{}) { @@ -30,6 +30,6 @@ func main() { } for _, v := range args { - challengeBytes(SwapBits, solutions.SwapBits, v) + challengeBytes(SwapBits, correct.SwapBits, v) } } diff --git a/tests/go/solutions/sweetproblem.go b/tests/go/solutions/sweetproblem.go index 2b5402e62..f28e48ab0 100644 --- a/tests/go/solutions/sweetproblem.go +++ b/tests/go/solutions/sweetproblem.go @@ -1,4 +1,4 @@ -package solutions +package correct func min3(a, b, c int) int { if a <= b && a <= c { diff --git a/tests/go/solutions/sweetproblem/test_sweetproblem.go b/tests/go/solutions/sweetproblem/test_sweetproblem.go index 5a3b70762..f3389e223 100644 --- a/tests/go/solutions/sweetproblem/test_sweetproblem.go +++ b/tests/go/solutions/sweetproblem/test_sweetproblem.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -40,6 +40,6 @@ func main() { table = append(table, value) } for _, arg := range table { - z01.Challenge("SweetProblem", Sweetproblem, solutions.Sweetproblem, arg.red, arg.green, arg.blue) + z01.Challenge("SweetProblem", Sweetproblem, correct.Sweetproblem, arg.red, arg.green, arg.blue) } } diff --git a/tests/go/solutions/testConvertBase/main.go b/tests/go/solutions/testConvertBase/main.go index 044a835be..fb724c8dd 100644 --- a/tests/go/solutions/testConvertBase/main.go +++ b/tests/go/solutions/testConvertBase/main.go @@ -3,9 +3,9 @@ package main import ( "fmt" - solutions "../../solutions" + correct "./correct" ) func main() { - fmt.Println(solutions.AtoiBase("111", "01")) + fmt.Println(correct.AtoiBase("111", "01")) } diff --git a/tests/go/solutions/tolower.go b/tests/go/solutions/tolower.go index c447f8265..61813e32e 100644 --- a/tests/go/solutions/tolower.go +++ b/tests/go/solutions/tolower.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/toupper.go b/tests/go/solutions/toupper.go index 7f0de7d31..48181da75 100644 --- a/tests/go/solutions/toupper.go +++ b/tests/go/solutions/toupper.go @@ -1,4 +1,4 @@ -package solutions +package correct import "strings" diff --git a/tests/go/solutions/trimatoi.go b/tests/go/solutions/trimatoi.go index 8798aee2e..5ced41943 100644 --- a/tests/go/solutions/trimatoi.go +++ b/tests/go/solutions/trimatoi.go @@ -1,4 +1,4 @@ -package solutions +package correct func TrimAtoi(str string) int { chars := []rune(str) diff --git a/tests/go/solutions/twosum.go b/tests/go/solutions/twosum.go index 667cd2309..e83d8af2a 100644 --- a/tests/go/solutions/twosum.go +++ b/tests/go/solutions/twosum.go @@ -1,4 +1,4 @@ -package solutions +package correct func TwoSum(nums []int, target int) []int { for i := 0; i < len(nums); i++ { diff --git a/tests/go/solutions/twosum/test_twosum.go b/tests/go/solutions/twosum/test_twosum.go index 98e1a1bb5..124c0af0d 100644 --- a/tests/go/solutions/twosum/test_twosum.go +++ b/tests/go/solutions/twosum/test_twosum.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { for i := 0; i < 20; i++ { token := rand.Perm(20) target := rand.Intn(30) - z01.Challenge("TwoSum", TwoSum, solutions.TwoSum, token, target) + z01.Challenge("TwoSum", TwoSum, correct.TwoSum, token, target) } } diff --git a/tests/go/solutions/ultimatedivmod.go b/tests/go/solutions/ultimatedivmod.go index 0fa40355e..3d068804d 100644 --- a/tests/go/solutions/ultimatedivmod.go +++ b/tests/go/solutions/ultimatedivmod.go @@ -1,4 +1,4 @@ -package solutions +package correct func UltimateDivMod(a, b *int) { temp := *a diff --git a/tests/go/solutions/ultimatepointone.go b/tests/go/solutions/ultimatepointone.go index 71a9e9ec5..392e14938 100644 --- a/tests/go/solutions/ultimatepointone.go +++ b/tests/go/solutions/ultimatepointone.go @@ -1,4 +1,4 @@ -package solutions +package correct func UltimatePointOne(n ***int) { ***n = 1 diff --git a/tests/go/solutions/unmatch.go b/tests/go/solutions/unmatch.go index 14a4fc851..87e8399bc 100644 --- a/tests/go/solutions/unmatch.go +++ b/tests/go/solutions/unmatch.go @@ -1,8 +1,7 @@ -package solutions +package correct // Returns the element of the slice that doesn't have a correspondant pair func Unmatch(arr []int) int { - // count the number of repetitions of each value var quant int for _, el := range arr { quant = 0 @@ -11,7 +10,6 @@ func Unmatch(arr []int) int { quant++ } } - // if the number of repetitions is odd return that element if quant%2 != 0 { return el } diff --git a/tests/go/solutions/volumechanger.go b/tests/go/solutions/volumechanger.go index 3fda9d2f0..1f45617d9 100644 --- a/tests/go/solutions/volumechanger.go +++ b/tests/go/solutions/volumechanger.go @@ -1,4 +1,4 @@ -package solutions +package correct func abs(a int) int { if a < 0 { diff --git a/tests/go/solutions/volumechanger/test_volumechanger.go b/tests/go/solutions/volumechanger/test_volumechanger.go index 42d09a124..8688b932d 100644 --- a/tests/go/solutions/volumechanger/test_volumechanger.go +++ b/tests/go/solutions/volumechanger/test_volumechanger.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "../../solutions" + correct "./correct" ) func main() { @@ -20,6 +20,6 @@ func main() { }) } for _, arg := range table { - z01.Challenge("Volumechanger", Volumechanger, solutions.Volumechanger, arg[0], arg[1]) + z01.Challenge("Volumechanger", Volumechanger, correct.Volumechanger, arg[0], arg[1]) } } diff --git a/tests/go/test_abort.go b/tests/go/test_abort.go index 02b4e0906..3a11c48c6 100644 --- a/tests/go/test_abort.go +++ b/tests/go/test_abort.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -11,7 +11,7 @@ func main() { arg := z01.MultRandInt() arg = append(arg, z01.RandInt()) for i := 0; i < 15; i++ { - z01.Challenge("Abort", student.Abort, solutions.Abort, arg[0], arg[1], arg[2], arg[3], arg[4]) + 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()) } diff --git a/tests/go/test_activebits.go b/tests/go/test_activebits.go index 65ba8d706..6bd082680 100644 --- a/tests/go/test_activebits.go +++ b/tests/go/test_activebits.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -13,6 +13,6 @@ func main() { args = append(args, z01.MultRandIntBetween(2, 20)...) for _, v := range args { - z01.Challenge("ActiveBits", student.ActiveBits, solutions.ActiveBits, v) + z01.Challenge("ActiveBits", student.ActiveBits, correct.ActiveBits, v) } } diff --git a/tests/go/test_advancedsortwordarr.go b/tests/go/test_advancedsortwordarr.go index c4600324d..328df637f 100644 --- a/tests/go/test_advancedsortwordarr.go +++ b/tests/go/test_advancedsortwordarr.go @@ -6,7 +6,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -24,7 +24,7 @@ func main() { copy(cp_sol, org) copy(cp_stu, org) - solutions.AdvancedSortWordArr(cp_sol, strings.Compare) + correct.AdvancedSortWordArr(cp_sol, strings.Compare) student.AdvancedSortWordArr(cp_stu, strings.Compare) if !reflect.DeepEqual(cp_stu, cp_sol) { diff --git a/tests/go/test_alphacount.go b/tests/go/test_alphacount.go index 7ca84653f..3628c2bef 100644 --- a/tests/go/test_alphacount.go +++ b/tests/go/test_alphacount.go @@ -1,10 +1,10 @@ package main import ( - solutions "./solutions" + "github.com/01-edu/z01" + correct "./correct" student "./student" - "github.com/01-edu/z01" ) func main() { @@ -19,6 +19,6 @@ func main() { } for _, arg := range table { - z01.Challenge("AlphaCount", student.AlphaCount, solutions.AlphaCount, arg) + z01.Challenge("AlphaCount", student.AlphaCount, correct.AlphaCount, arg) } } diff --git a/tests/go/test_any.go b/tests/go/test_any.go index 12a66ed37..64203cac2 100644 --- a/tests/go/test_any.go +++ b/tests/go/test_any.go @@ -3,63 +3,59 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - functionsArray := []func(string) bool{solutions.IsNumeric, solutions.IsLower, solutions.IsUpper} + functions := []func(string) bool{correct.IsNumeric, correct.IsLower, correct.IsUpper} type node struct { - f func(string) bool - arr []string + f func(string) bool + a []string } table := []node{} for i := 0; i < 5; i++ { - functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)] - val := node{ - f: functionSelected, - arr: z01.MultRandWords(), - } - table = append(table, val) + function := functions[z01.RandIntBetween(0, len(functions)-1)] + table = append(table, node{ + f: function, + a: z01.MultRandWords(), + }) } for i := 0; i < 5; i++ { - val := node{ - f: solutions.IsNumeric, - arr: z01.MultRandDigit(), - } - table = append(table, val) + table = append(table, node{ + f: correct.IsNumeric, + a: z01.MultRandDigit(), + }) } for i := 0; i < 5; i++ { - val := node{ - f: solutions.IsLower, - arr: z01.MultRandLower(), - } - table = append(table, val) + table = append(table, node{ + f: correct.IsLower, + a: z01.MultRandLower(), + }) } for i := 0; i < 5; i++ { - val := node{ - f: solutions.IsUpper, - arr: z01.MultRandUpper(), - } - table = append(table, val) + table = append(table, node{ + f: correct.IsUpper, + a: z01.MultRandUpper(), + }) } table = append(table, node{ - f: solutions.IsNumeric, - arr: []string{"Hello", "how", "are", "you"}, + f: correct.IsNumeric, + a: []string{"Hello", "how", "are", "you"}, }, node{ - f: solutions.IsNumeric, - arr: []string{"This", "is", "4", "you"}, + f: correct.IsNumeric, + a: []string{"This", "is", "4", "you"}, }, ) for _, arg := range table { - z01.Challenge("Any", student.Any, solutions.Any, arg.f, arg.arr) + z01.Challenge("Any", student.Any, correct.Any, arg.f, arg.a) } } diff --git a/tests/go/test_appendrange.go b/tests/go/test_appendrange.go index 11479858e..35e19e7fc 100644 --- a/tests/go/test_appendrange.go +++ b/tests/go/test_appendrange.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -44,6 +44,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("AppendRange", student.AppendRange, solutions.AppendRange, arg.min, arg.max) + z01.Challenge("AppendRange", student.AppendRange, correct.AppendRange, arg.min, arg.max) } } diff --git a/tests/go/test_atoi.go b/tests/go/test_atoi.go index 1bf8ff95d..3aa8088de 100644 --- a/tests/go/test_atoi.go +++ b/tests/go/test_atoi.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -33,6 +33,6 @@ func main() { "123a45", ) for _, arg := range table { - z01.Challenge("Atoi", student.Atoi, solutions.Atoi, arg) + z01.Challenge("Atoi", student.Atoi, correct.Atoi, arg) } } diff --git a/tests/go/test_atoibase.go b/tests/go/test_atoibase.go index 4a618e0bd..8d8403c50 100644 --- a/tests/go/test_atoibase.go +++ b/tests/go/test_atoibase.go @@ -5,7 +5,7 @@ import ( "./base" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -44,7 +44,7 @@ func main() { node{s: "bbbbbab", base: "-ab"}, ) for _, arg := range table { - z01.Challenge("AtoiBase", student.AtoiBase, solutions.AtoiBase, arg.s, arg.base) + z01.Challenge("AtoiBase", student.AtoiBase, correct.AtoiBase, arg.s, arg.base) } } diff --git a/tests/go/test_basicatoi.go b/tests/go/test_basicatoi.go index 38a7a15b8..5e0979964 100644 --- a/tests/go/test_basicatoi.go +++ b/tests/go/test_basicatoi.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -23,6 +23,6 @@ func main() { "000000", ) for _, arg := range table { - z01.Challenge("BasicAtoi", student.BasicAtoi, solutions.BasicAtoi, arg) + z01.Challenge("BasicAtoi", student.BasicAtoi, correct.BasicAtoi, arg) } } diff --git a/tests/go/test_basicatoi2.go b/tests/go/test_basicatoi2.go index 5e2626db3..d71b8e16f 100644 --- a/tests/go/test_basicatoi2.go +++ b/tests/go/test_basicatoi2.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -27,6 +27,6 @@ func main() { "123.0", ) for _, arg := range table { - z01.Challenge("BasicAtoi2", student.BasicAtoi2, solutions.BasicAtoi2, arg) + z01.Challenge("BasicAtoi2", student.BasicAtoi2, correct.BasicAtoi2, arg) } } diff --git a/tests/go/test_basicjoin.go b/tests/go/test_basicjoin.go index 8d71bc7fb..cce45ea3b 100644 --- a/tests/go/test_basicjoin.go +++ b/tests/go/test_basicjoin.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -18,6 +18,6 @@ func main() { []string{"Hello!", " How are you?", "well and yourself?"}, ) for _, arg := range table { - z01.Challenge("BasicJoin", student.BasicJoin, solutions.BasicJoin, arg) + z01.Challenge("BasicJoin", student.BasicJoin, correct.BasicJoin, arg) } } diff --git a/tests/go/test_btreeapplybylevel.go b/tests/go/test_btreeapplybylevel.go index 294ce80a7..665ac0b69 100644 --- a/tests/go/test_btreeapplybylevel.go +++ b/tests/go/test_btreeapplybylevel.go @@ -3,20 +3,20 @@ package main import ( "fmt" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - solutions.ChallengeTree("BTreeApplyByLevel", solutions.BTreeApplyByLevel, student.BTreeApplyByLevel, root, rootS, fmt.Print) + correct.ChallengeTree("BTreeApplyByLevel", correct.BTreeApplyByLevel, student.BTreeApplyByLevel, root, rootS, fmt.Print) } diff --git a/tests/go/test_btreeapplyinorder.go b/tests/go/test_btreeapplyinorder.go index 62e69ee43..48fc61d39 100644 --- a/tests/go/test_btreeapplyinorder.go +++ b/tests/go/test_btreeapplyinorder.go @@ -3,12 +3,12 @@ package main import ( "fmt" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - root := &solutions.TreeNode{Data: "08"} + root := &correct.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} pos := []string{ "x", @@ -25,9 +25,9 @@ func main() { } for _, arg := range pos { - root = solutions.BTreeInsertData(root, arg) + root = correct.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) } - solutions.ChallengeTree("BTreeApplyInorder", solutions.BTreeApplyInorder, student.BTreeApplyInorder, root, rootS, fmt.Println) + correct.ChallengeTree("BTreeApplyInorder", correct.BTreeApplyInorder, student.BTreeApplyInorder, root, rootS, fmt.Println) } diff --git a/tests/go/test_btreeapplypostorder.go b/tests/go/test_btreeapplypostorder.go index 36770e110..42b48517d 100644 --- a/tests/go/test_btreeapplypostorder.go +++ b/tests/go/test_btreeapplypostorder.go @@ -3,12 +3,12 @@ package main import ( "fmt" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - root := &solutions.TreeNode{Data: "08"} + root := &correct.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} pos := []string{ "x", @@ -25,9 +25,9 @@ func main() { } for _, arg := range pos { - root = solutions.BTreeInsertData(root, arg) + root = correct.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) } - solutions.ChallengeTree("BTreeApplyPostorder", solutions.BTreeApplyPostorder, student.BTreeApplyPostorder, root, rootS, fmt.Println) + correct.ChallengeTree("BTreeApplyPostorder", correct.BTreeApplyPostorder, student.BTreeApplyPostorder, root, rootS, fmt.Println) } diff --git a/tests/go/test_btreeapplypreorder.go b/tests/go/test_btreeapplypreorder.go index ad9ac0543..25ffd1520 100644 --- a/tests/go/test_btreeapplypreorder.go +++ b/tests/go/test_btreeapplypreorder.go @@ -3,12 +3,12 @@ package main import ( "fmt" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - root := &solutions.TreeNode{Data: "08"} + root := &correct.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} pos := []string{ "x", @@ -25,9 +25,9 @@ func main() { } for _, arg := range pos { - root = solutions.BTreeInsertData(root, arg) + root = correct.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) } - solutions.ChallengeTree("BTreeApplyPreorder", solutions.BTreeApplyPreorder, student.BTreeApplyPreorder, root, rootS, fmt.Println) + correct.ChallengeTree("BTreeApplyPreorder", correct.BTreeApplyPreorder, student.BTreeApplyPreorder, root, rootS, fmt.Println) } diff --git a/tests/go/test_btreedeletenode.go b/tests/go/test_btreedeletenode.go index 5c3a391e4..141c21b6b 100644 --- a/tests/go/test_btreedeletenode.go +++ b/tests/go/test_btreedeletenode.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -79,17 +79,17 @@ func formatSubTree_delete(root *student.TreeNode, prefix string) string { return res } -func errorMessage_delete(fn interface{}, deleted string, rootOr, root *solutions.TreeNode, rootS *student.TreeNode) { +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", "BTreeDeleteNode", - solutions.FormatTree(rootOr), + correct.FormatTree(rootOr), deleted, FormatTree_delete(rootS), - solutions.FormatTree(root), + correct.FormatTree(root), ) } -func CompareTrees_delete(fn interface{}, deleted string, rootOr, root *solutions.TreeNode, rootS *student.TreeNode) { +func CompareTrees_delete(fn interface{}, deleted string, rootOr, root *correct.TreeNode, rootS *student.TreeNode) { sel := student.BTreeSearchItem(rootS, deleted) if !student.BTreeIsBinary(rootS) || sel != nil { @@ -98,23 +98,23 @@ func CompareTrees_delete(fn interface{}, deleted string, rootOr, root *solutions } func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} - rootOr := &solutions.TreeNode{Data: "04"} + rootOr := &correct.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) - rootOr = solutions.BTreeInsertData(rootOr, v) + rootOr = correct.BTreeInsertData(rootOr, v) } - selected := solutions.BTreeSearchItem(root, "04") + selected := correct.BTreeSearchItem(root, "04") selectedS := student.BTreeSearchItem(rootS, "04") - root = solutions.BTreeDeleteNode(root, selected) + root = correct.BTreeDeleteNode(root, selected) rootS = student.BTreeDeleteNode(rootS, selectedS) - fn := interface{}(solutions.BTreeDeleteNode) + fn := interface{}(correct.BTreeDeleteNode) CompareTrees_delete(fn, selected.Data, rootOr, root, rootS) } diff --git a/tests/go/test_btreeinsertdata.go b/tests/go/test_btreeinsertdata.go index bd5604e7d..998d2ea78 100644 --- a/tests/go/test_btreeinsertdata.go +++ b/tests/go/test_btreeinsertdata.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -79,18 +79,18 @@ func formatSubTree_insert(root *student.TreeNode, prefix string) string { return res } -func errorMessage_insert(fn interface{}, inserted string, root *solutions.TreeNode, rootS *student.TreeNode) { +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", "BTreeInsertData", - solutions.FormatTree(root), + correct.FormatTree(root), inserted, FormatTree_insert(rootS), - solutions.FormatTree(root), + correct.FormatTree(root), ) } -func CompareTrees_insert(fn interface{}, inserted string, root *solutions.TreeNode, rootS *student.TreeNode) { - solTree := solutions.FormatTree(root) +func CompareTrees_insert(fn interface{}, inserted string, root *correct.TreeNode, rootS *student.TreeNode) { + solTree := correct.FormatTree(root) stuTree := FormatTree_insert(rootS) if solTree != stuTree { @@ -99,7 +99,7 @@ func CompareTrees_insert(fn interface{}, inserted string, root *solutions.TreeNo } func main() { - root := &solutions.TreeNode{Data: "08"} + root := &correct.TreeNode{Data: "08"} rootS := &student.TreeNode{Data: "08"} var pos []string @@ -117,9 +117,9 @@ func main() { "a", "d", ) - fn := interface{}(solutions.BTreeInsertData) + fn := interface{}(correct.BTreeInsertData) for _, arg := range pos { - root = solutions.BTreeInsertData(root, arg) + root = correct.BTreeInsertData(root, arg) rootS = student.BTreeInsertData(rootS, arg) CompareTrees_insert(fn, arg, root, rootS) } diff --git a/tests/go/test_btreeisbinary.go b/tests/go/test_btreeisbinary.go index b7024692a..1d2177ea3 100644 --- a/tests/go/test_btreeisbinary.go +++ b/tests/go/test_btreeisbinary.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -16,16 +16,16 @@ func BTreeMinStu(root *student.TreeNode) *student.TreeNode { return BTreeMinStu(root.Left) } -func errorMessage_isbin(fn interface{}, root, a *solutions.TreeNode, b *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", "BTreeIsBinary", - solutions.FormatTree(root), + correct.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_isbin(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { +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) } @@ -55,7 +55,7 @@ func CompareNode_isbin(fn interface{}, arg1, a *solutions.TreeNode, b *student.T } } -func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 interface{}) { +func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interface{}) { arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} @@ -64,13 +64,13 @@ func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 in for i, v := range out1.Results { switch str := v.(type) { - case *solutions.TreeNode: + case *correct.TreeNode: 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", "BTreeIsBinary", - solutions.FormatTree(arg1), + correct.FormatTree(arg1), z01.Format(out2.Results...), z01.Format(out1.Results...), ) @@ -80,31 +80,31 @@ func CompareReturn_isbin(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 in } func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - CompareReturn_isbin(solutions.BTreeIsBinary, student.BTreeIsBinary, root, rootS) + CompareReturn_isbin(correct.BTreeIsBinary, student.BTreeIsBinary, root, rootS) - rootNB := &solutions.TreeNode{Data: "04"} + rootNB := &correct.TreeNode{Data: "04"} rootNB_stu := &student.TreeNode{Data: "04"} // Test a non-binarysearch tree for _, v := range ins { - rootNB = solutions.BTreeInsertData(rootNB, v) + rootNB = correct.BTreeInsertData(rootNB, v) rootNB_stu = student.BTreeInsertData(rootNB_stu, v) } - min := solutions.BTreeMin(rootNB) + min := correct.BTreeMin(rootNB) minStu := BTreeMinStu(rootNB_stu) - min.Left = &solutions.TreeNode{Data: "123"} + min.Left = &correct.TreeNode{Data: "123"} minStu.Left = &student.TreeNode{Data: "123"} - CompareReturn_isbin(solutions.BTreeIsBinary, student.BTreeIsBinary, rootNB, rootNB_stu) + CompareReturn_isbin(correct.BTreeIsBinary, student.BTreeIsBinary, rootNB, rootNB_stu) } diff --git a/tests/go/test_btreelevelcount.go b/tests/go/test_btreelevelcount.go index 8143ab21b..62426c4ef 100644 --- a/tests/go/test_btreelevelcount.go +++ b/tests/go/test_btreelevelcount.go @@ -3,22 +3,22 @@ package main import ( "reflect" - solutions "./solutions" + correct "./correct" student "./student" "github.com/01-edu/z01" ) -func errorMessage_level(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { +func errorMessage_level(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { z01.Fatalf("%s(\n%s\n) == %s instead of %s\n", "BTreeLevelCount", - solutions.FormatTree(root), + correct.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_level(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { +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) return @@ -56,7 +56,7 @@ func CompareNode_level(fn interface{}, arg1, a *solutions.TreeNode, b *student.T } } -func CompareReturn_level(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 interface{}) { +func CompareReturn_level(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interface{}) { arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} @@ -65,13 +65,13 @@ func CompareReturn_level(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 in for i, v := range out1.Results { switch str := v.(type) { - case *solutions.TreeNode: + case *correct.TreeNode: 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", "BTreeLevelCount", - solutions.FormatTree(arg1), + correct.FormatTree(arg1), z01.Format(out2.Results...), z01.Format(out1.Results...), ) @@ -81,14 +81,14 @@ func CompareReturn_level(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 in } func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) - CompareReturn_level(solutions.BTreeLevelCount, student.BTreeLevelCount, root, rootS) + CompareReturn_level(correct.BTreeLevelCount, student.BTreeLevelCount, root, rootS) } } diff --git a/tests/go/test_btreemax.go b/tests/go/test_btreemax.go index 4d010e301..69a204923 100644 --- a/tests/go/test_btreemax.go +++ b/tests/go/test_btreemax.go @@ -3,22 +3,22 @@ package main import ( "reflect" - solutions "./solutions" + correct "./correct" student "./student" "github.com/01-edu/z01" ) -func errorMessage_max(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { +func errorMessage_max(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { z01.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeMax", - solutions.FormatTree(root), + correct.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_max(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { +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) return @@ -56,7 +56,7 @@ func CompareNode_max(fn interface{}, arg1, a *solutions.TreeNode, b *student.Tre } } -func CompareReturn_max(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 interface{}) { +func CompareReturn_max(fn1, fn2 interface{}, arg1 *correct.TreeNode, arg2 interface{}) { arar1 := []interface{}{arg1} arar2 := []interface{}{arg2} @@ -65,13 +65,13 @@ func CompareReturn_max(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 inte for i, v := range out1.Results { switch str := v.(type) { - case *solutions.TreeNode: + case *correct.TreeNode: 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", "BTreeMax", - solutions.FormatTree(arg1), + correct.FormatTree(arg1), z01.Format(out2.Results...), z01.Format(out1.Results...), ) @@ -81,15 +81,15 @@ func CompareReturn_max(fn1, fn2 interface{}, arg1 *solutions.TreeNode, arg2 inte } func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - CompareReturn_max(solutions.BTreeMax, student.BTreeMax, root, rootS) + CompareReturn_max(correct.BTreeMax, student.BTreeMax, root, rootS) } diff --git a/tests/go/test_btreemin.go b/tests/go/test_btreemin.go index 16dbe0623..262c94b24 100644 --- a/tests/go/test_btreemin.go +++ b/tests/go/test_btreemin.go @@ -3,22 +3,22 @@ package main import ( "reflect" - solutions "./solutions" + correct "./correct" student "./student" "github.com/01-edu/z01" ) -func errorMessage_min(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { +func errorMessage_min(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) { z01.Fatalf("%s(\n%s) == %s instead of %s\n", "BTreeMin", - solutions.FormatTree(root), + correct.FormatTree(root), b.Data, a.Data, ) } -func CompareNode_min(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { +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) return @@ -65,8 +65,8 @@ func CompareReturn_min(fn1, fn2, arg1, arg2 interface{}) { for i, v := range out1.Results { switch str := v.(type) { - case *solutions.TreeNode: - CompareNode_min(fn1, arg1.(*solutions.TreeNode), str, out2.Results[i].(*student.TreeNode)) + case *correct.TreeNode: + 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", @@ -81,15 +81,15 @@ func CompareReturn_min(fn1, fn2, arg1, arg2 interface{}) { } func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"03", "02", "01", "07", "05", "12", "10"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - CompareReturn_min(solutions.BTreeMin, student.BTreeMin, root, rootS) + CompareReturn_min(correct.BTreeMin, student.BTreeMin, root, rootS) } diff --git a/tests/go/test_btreesearchitem.go b/tests/go/test_btreesearchitem.go index 9404b5edb..76cdbf934 100644 --- a/tests/go/test_btreesearchitem.go +++ b/tests/go/test_btreesearchitem.go @@ -5,22 +5,22 @@ import ( "fmt" - solutions "./solutions" + correct "./correct" student "./student" ) -func errorMessage_search(fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode, +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", "BTreeSearchItem", - solutions.FormatTree(root), + correct.FormatTree(root), seaVal, b.Data, a.Data, ) } -func CompareNode_search(fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode, +func CompareNode_search(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode, seaVal string) { if a == nil && b == nil { return @@ -67,20 +67,20 @@ func CompareNode_search(fn interface{}, arg1, a *solutions.TreeNode, b *student. } func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) } - fn := interface{}(solutions.BTreeSearchItem) + fn := interface{}(correct.BTreeSearchItem) ins = append(ins, "322") for _, v := range ins { - selectedSol := solutions.BTreeSearchItem(root, v) + selectedSol := correct.BTreeSearchItem(root, v) selectedStu := student.BTreeSearchItem(rootS, v) CompareNode_search(fn, root, selectedSol, selectedStu, v) } diff --git a/tests/go/test_btreetransplant.go b/tests/go/test_btreetransplant.go index aa31f11d9..32d9c0d71 100644 --- a/tests/go/test_btreetransplant.go +++ b/tests/go/test_btreetransplant.go @@ -5,7 +5,7 @@ import ( "fmt" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -81,25 +81,25 @@ func formatSubTree_transp(root *student.TreeNode, prefix string) string { return res } -func errorMessage_transp(fn interface{}, root, sel, repl *solutions.TreeNode, rootA *solutions.TreeNode, rootAS *student.TreeNode) { +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", "BTreeTransplant", - solutions.FormatTree(root), - solutions.FormatTree(sel), - solutions.FormatTree(repl), + correct.FormatTree(root), + correct.FormatTree(sel), + correct.FormatTree(repl), FormatTree_transp(rootAS), - solutions.FormatTree(rootA), + correct.FormatTree(rootA), ) } -func CompareTrees_transp(fn interface{}, root, sel, repl *solutions.TreeNode, rootA *solutions.TreeNode, rootAS *student.TreeNode) { - solTree := solutions.FormatTree(rootA) +func CompareTrees_transp(fn interface{}, root, sel, repl *correct.TreeNode, rootA *correct.TreeNode, rootAS *student.TreeNode) { + solTree := correct.FormatTree(rootA) stuTree := FormatTree_transp(rootAS) if solTree != stuTree { errorMessage_transp(fn, root, sel, repl, rootA, rootAS) } - parentSol := solutions.ParentList(rootA) + parentSol := correct.ParentList(rootA) parentStu := parentListTransp(rootAS) if parentSol != parentStu { @@ -109,11 +109,11 @@ func CompareTrees_transp(fn interface{}, root, sel, repl *solutions.TreeNode, ro } func main() { - root := &solutions.TreeNode{Data: "04"} + root := &correct.TreeNode{Data: "04"} rootS := &student.TreeNode{Data: "04"} - rootOr := &solutions.TreeNode{Data: "04"} + rootOr := &correct.TreeNode{Data: "04"} - replacement := &solutions.TreeNode{Data: "55"} + replacement := &correct.TreeNode{Data: "55"} replacementS := &student.TreeNode{Data: "55"} ins := []string{"01", "07", "05", "12", "02", "03", "10"} @@ -121,21 +121,21 @@ func main() { rep := []string{"33", "12", "15", "60"} for _, v := range ins { - root = solutions.BTreeInsertData(root, v) + root = correct.BTreeInsertData(root, v) rootS = student.BTreeInsertData(rootS, v) - rootOr = solutions.BTreeInsertData(rootOr, v) + rootOr = correct.BTreeInsertData(rootOr, v) } for _, v := range rep { - replacement = solutions.BTreeInsertData(replacement, v) + replacement = correct.BTreeInsertData(replacement, v) replacementS = student.BTreeInsertData(replacementS, v) } - selected := solutions.BTreeSearchItem(root, "07") + selected := correct.BTreeSearchItem(root, "07") selectedS := student.BTreeSearchItem(rootS, "07") - root = solutions.BTreeTransplant(root, selected, replacement) + root = correct.BTreeTransplant(root, selected, replacement) rootS = student.BTreeTransplant(rootS, selectedS, replacementS) - fn := interface{}(solutions.BTreeTransplant) + fn := interface{}(correct.BTreeTransplant) CompareTrees_transp(fn, rootOr, selected, replacement, root, rootS) } diff --git a/tests/go/test_capitalize.go b/tests/go/test_capitalize.go index d9d2d1340..dea389fe9 100644 --- a/tests/go/test_capitalize.go +++ b/tests/go/test_capitalize.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -19,6 +19,6 @@ func main() { "9a LALALA!", ) for _, arg := range table { - z01.Challenge("Capitalize", student.Capitalize, solutions.Capitalize, arg) + z01.Challenge("Capitalize", student.Capitalize, correct.Capitalize, arg) } } diff --git a/tests/go/test_collatzcountdown.go b/tests/go/test_collatzcountdown.go index 99e1adced..ea409e293 100644 --- a/tests/go/test_collatzcountdown.go +++ b/tests/go/test_collatzcountdown.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -15,6 +15,6 @@ func main() { } for _, v := range args { - z01.Challenge("CollatzCountdown", student.CollatzCountdown, solutions.CollatzCountdown, v) + z01.Challenge("CollatzCountdown", student.CollatzCountdown, correct.CollatzCountdown, v) } } diff --git a/tests/go/test_compact.go b/tests/go/test_compact.go index 10ad7ba9a..c5a2ee20f 100644 --- a/tests/go/test_compact.go +++ b/tests/go/test_compact.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -34,7 +34,7 @@ func main() { copy(sli_sol, v) copy(sli_stu, v) - sol_size := solutions.Compact(&sli_sol) + sol_size := correct.Compact(&sli_sol) stu_size := student.Compact(&sli_stu) if !reflect.DeepEqual(sli_stu, sli_sol) { diff --git a/tests/go/test_compare.go b/tests/go/test_compare.go index 5ac3ca5c2..d49b6e0b6 100644 --- a/tests/go/test_compare.go +++ b/tests/go/test_compare.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -45,6 +45,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("Compare", student.Compare, solutions.Compare, arg.s, arg.toCompare) + z01.Challenge("Compare", student.Compare, correct.Compare, arg.s, arg.toCompare) } } diff --git a/tests/go/test_concat.go b/tests/go/test_concat.go index 964d8971d..a9582a478 100644 --- a/tests/go/test_concat.go +++ b/tests/go/test_concat.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -19,6 +19,6 @@ func main() { []string{"Hello!", " How are you?"}, ) for _, arg := range table { - z01.Challenge("Concat", student.Concat, solutions.Concat, arg[0], arg[1]) + z01.Challenge("Concat", student.Concat, correct.Concat, arg[0], arg[1]) } } diff --git a/tests/go/test_concatparams.go b/tests/go/test_concatparams.go index 3186094ab..31c8ec5e3 100644 --- a/tests/go/test_concatparams.go +++ b/tests/go/test_concatparams.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -15,6 +15,6 @@ func main() { table = append(table, z01.MultRandASCII()) } for _, arg := range table { - z01.Challenge("ConcatParams", student.ConcatParams, solutions.ConcatParams, arg) + z01.Challenge("ConcatParams", student.ConcatParams, correct.ConcatParams, arg) } } diff --git a/tests/go/test_convertbase.go b/tests/go/test_convertbase.go index e997b136a..83713689b 100644 --- a/tests/go/test_convertbase.go +++ b/tests/go/test_convertbase.go @@ -5,7 +5,7 @@ import ( "./base" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -36,6 +36,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("ConvertBase", student.ConvertBase, solutions.ConvertBase, arg.nbr, arg.baseFrom, arg.baseTo) + z01.Challenge("ConvertBase", student.ConvertBase, correct.ConvertBase, arg.nbr, arg.baseFrom, arg.baseTo) } } diff --git a/tests/go/test_countif.go b/tests/go/test_countif.go index ff042f810..40e535077 100644 --- a/tests/go/test_countif.go +++ b/tests/go/test_countif.go @@ -3,12 +3,12 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - functionsArray := []func(string) bool{solutions.IsNumeric, solutions.IsLower, solutions.IsUpper} + functions := []func(string) bool{correct.IsNumeric, correct.IsLower, correct.IsUpper} type node struct { f func(string) bool @@ -18,16 +18,16 @@ func main() { table := []node{} for i := 0; i < 5; i++ { - functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)] + function := functions[z01.RandIntBetween(0, len(functions)-1)] val := node{ - f: functionSelected, + f: function, arr: z01.MultRandWords(), } table = append(table, val) } for i := 0; i < 5; i++ { val := node{ - f: solutions.IsNumeric, + f: correct.IsNumeric, arr: z01.MultRandDigit(), } table = append(table, val) @@ -35,14 +35,14 @@ func main() { for i := 0; i < 5; i++ { val := node{ - f: solutions.IsLower, + f: correct.IsLower, arr: z01.MultRandLower(), } table = append(table, val) } for i := 0; i < 5; i++ { val := node{ - f: solutions.IsUpper, + f: correct.IsUpper, arr: z01.MultRandUpper(), } table = append(table, val) @@ -50,16 +50,16 @@ func main() { table = append(table, node{ - f: solutions.IsNumeric, + f: correct.IsNumeric, arr: []string{"Hello", "how", "are", "you"}, }, node{ - f: solutions.IsNumeric, + f: correct.IsNumeric, arr: []string{"This", "is", "4", "you"}, }, ) for _, arg := range table { - z01.Challenge("CountIf", student.CountIf, solutions.CountIf, arg.f, arg.arr) + z01.Challenge("CountIf", student.CountIf, correct.CountIf, arg.f, arg.arr) } } diff --git a/tests/go/test_createelem.go b/tests/go/test_createelem.go index 79e624a3b..69ef7906a 100644 --- a/tests/go/test_createelem.go +++ b/tests/go/test_createelem.go @@ -3,14 +3,14 @@ package main import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) // the structs from the other packages // struct just for the first exercise type NodeF = student.Node -type NodeFS = solution.Node +type NodeFS = correct.Node // simple struct, just insert a element in the struct func main() { @@ -25,7 +25,7 @@ func main() { for _, items := range table { for _, item := range items { - solution.CreateElem(n1, item) + correct.CreateElem(n1, item) student.CreateElem(n2, item) } diff --git a/tests/go/test_eightqueens.go b/tests/go/test_eightqueens.go index 2e32e3372..ed5eaf605 100644 --- a/tests/go/test_eightqueens.go +++ b/tests/go/test_eightqueens.go @@ -3,10 +3,10 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - z01.Challenge("EightQueens", student.EightQueens, solutions.EightQueens) + z01.Challenge("EightQueens", student.EightQueens, correct.EightQueens) } diff --git a/tests/go/test_enigma.go b/tests/go/test_enigma.go index 3d58f6104..c4b2f6744 100644 --- a/tests/go/test_enigma.go +++ b/tests/go/test_enigma.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -38,7 +38,7 @@ func main() { d := &n student.Enigma(a, b, c, d) - solutions.Decript(a, b, c, d) + correct.Decript(a, b, c, d) if aval != ***a { z01.Fatalf("Expected ***a = %d instead of %d\n", diff --git a/tests/go/test_fibonacci.go b/tests/go/test_fibonacci.go index 9b612ec57..d153e34fc 100644 --- a/tests/go/test_fibonacci.go +++ b/tests/go/test_fibonacci.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -15,6 +15,6 @@ func main() { -5, ) for _, arg := range table { - z01.Challenge("Fibonacci", student.Fibonacci, solutions.Fibonacci, arg) + z01.Challenge("Fibonacci", student.Fibonacci, correct.Fibonacci, arg) } } diff --git a/tests/go/test_findnextprime.go b/tests/go/test_findnextprime.go index 4ae3d2ff2..19541ef2c 100644 --- a/tests/go/test_findnextprime.go +++ b/tests/go/test_findnextprime.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -29,6 +29,6 @@ func main() { 1000000088, ) for _, arg := range table { - z01.Challenge("FindNextPrime", student.FindNextPrime, solutions.FindNextPrime, arg) + z01.Challenge("FindNextPrime", student.FindNextPrime, correct.FindNextPrime, arg) } } diff --git a/tests/go/test_firstrune.go b/tests/go/test_firstrune.go index 9a99df91a..8bdf2afd9 100644 --- a/tests/go/test_firstrune.go +++ b/tests/go/test_firstrune.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -16,6 +16,6 @@ func main() { "♥01", ) for _, arg := range table { - z01.Challenge("FirstRune", student.FirstRune, solutions.FirstRune, arg) + z01.Challenge("FirstRune", student.FirstRune, correct.FirstRune, arg) } } diff --git a/tests/go/test_foreach.go b/tests/go/test_foreach.go index cfa277c2d..a5fc7eafe 100644 --- a/tests/go/test_foreach.go +++ b/tests/go/test_foreach.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -47,6 +47,6 @@ func main() { }) for _, arg := range table { - z01.Challenge("ForEach", student.ForEach, solutions.ForEach, arg.f, arg.a) + z01.Challenge("ForEach", student.ForEach, correct.ForEach, arg.f, arg.a) } } diff --git a/tests/go/test_index.go b/tests/go/test_index.go index 79c87d2d7..236fc20e4 100644 --- a/tests/go/test_index.go +++ b/tests/go/test_index.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -47,6 +47,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("Index", student.Index, solutions.Index, arg.s, arg.toFind) + z01.Challenge("Index", student.Index, correct.Index, arg.s, arg.toFind) } } diff --git a/tests/go/test_isalpha.go b/tests/go/test_isalpha.go index ed7717aa6..c5d78064a 100644 --- a/tests/go/test_isalpha.go +++ b/tests/go/test_isalpha.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -21,6 +21,6 @@ func main() { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!", ) for _, arg := range table { - z01.Challenge("IsAlpha", student.IsAlpha, solutions.IsAlpha, arg) + z01.Challenge("IsAlpha", student.IsAlpha, correct.IsAlpha, arg) } } diff --git a/tests/go/test_islower.go b/tests/go/test_islower.go index c7bf4a12d..dca79484f 100644 --- a/tests/go/test_islower.go +++ b/tests/go/test_islower.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -40,6 +40,6 @@ func main() { "hello!", ) for _, arg := range table { - z01.Challenge("IsLower", student.IsLower, solutions.IsLower, arg) + z01.Challenge("IsLower", student.IsLower, correct.IsLower, arg) } } diff --git a/tests/go/test_isnegative.go b/tests/go/test_isnegative.go index 503655d7b..18b419bee 100644 --- a/tests/go/test_isnegative.go +++ b/tests/go/test_isnegative.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -15,6 +15,6 @@ func main() { 0, ) for _, arg := range table { - z01.Challenge("IsNegative", student.IsNegative, solutions.IsNegative, arg) + z01.Challenge("IsNegative", student.IsNegative, correct.IsNegative, arg) } } diff --git a/tests/go/test_isnumeric.go b/tests/go/test_isnumeric.go index 38a95d41a..908f1ac3c 100644 --- a/tests/go/test_isnumeric.go +++ b/tests/go/test_isnumeric.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -34,6 +34,6 @@ func main() { "01,02,03", ) for _, arg := range table { - z01.Challenge("IsNumeric", student.IsNumeric, solutions.IsNumeric, arg) + z01.Challenge("IsNumeric", student.IsNumeric, correct.IsNumeric, arg) } } diff --git a/tests/go/test_isprime.go b/tests/go/test_isprime.go index aea1d3407..74e7140d3 100644 --- a/tests/go/test_isprime.go +++ b/tests/go/test_isprime.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -28,6 +28,6 @@ func main() { 1000000087, ) for _, arg := range table { - z01.Challenge("IsPrime", student.IsPrime, solutions.IsPrime, arg) + z01.Challenge("IsPrime", student.IsPrime, correct.IsPrime, arg) } } diff --git a/tests/go/test_isprintable.go b/tests/go/test_isprintable.go index aacc300a4..001d404a1 100644 --- a/tests/go/test_isprintable.go +++ b/tests/go/test_isprintable.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -44,6 +44,6 @@ func main() { "\n", ) for _, arg := range table { - z01.Challenge("IsPrintable", student.IsPrintable, solutions.IsPrintable, arg) + z01.Challenge("IsPrintable", student.IsPrintable, correct.IsPrintable, arg) } } diff --git a/tests/go/test_issorted.go b/tests/go/test_issorted.go index 99e5de931..ba407782d 100644 --- a/tests/go/test_issorted.go +++ b/tests/go/test_issorted.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -45,9 +45,9 @@ func main() { // 5 unordered slices for i := 0; i < 5; i++ { - functionSelected := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[z01.RandIntBetween(0, len(functions)-1)] val := node{ - f: functionSelected, + f: function, a: z01.MultRandIntBetween(-1000000, 1000000), } table = append(table, val) @@ -55,12 +55,12 @@ func main() { // 5 slices ordered in ascending order for i := 0; i < 5; i++ { - functionSelected := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[z01.RandIntBetween(0, len(functions)-1)] ordered := z01.MultRandIntBetween(-1000000, 1000000) sort.Ints(ordered) val := node{ - f: functionSelected, + f: function, a: ordered, } table = append(table, val) @@ -68,37 +68,37 @@ func main() { // 5 slices ordered in descending order for i := 0; i < 5; i++ { - functionSelected := functions[z01.RandIntBetween(0, len(functions)-1)] + function := functions[z01.RandIntBetween(0, len(functions)-1)] reversed := z01.MultRandIntBetween(-1000000, 1000000) sort.Sort(sort.Reverse(sort.IntSlice(reversed))) val := node{ - f: functionSelected, + f: function, a: reversed, } table = append(table, val) } table = append(table, node{ - f: solutions.IsSortedByDiff, + f: correct.IsSortedByDiff, a: []int{1, 2, 3, 4, 5, 6}, }) table = append(table, node{ - f: solutions.IsSortedByDiff, + f: correct.IsSortedByDiff, a: []int{6, 5, 4, 3, 2, 1}, }) table = append(table, node{ - f: solutions.IsSortedByDiff, + f: correct.IsSortedByDiff, a: []int{0, 0, 0, 0, 0, 0, 0}, }) table = append(table, node{ - f: solutions.IsSortedByDiff, + f: correct.IsSortedByDiff, a: []int{0}, }) for _, arg := range table { - z01.Challenge("IsSorted", student.IsSorted, solutions.IsSorted, arg.f, arg.a) + z01.Challenge("IsSorted", student.IsSorted, correct.IsSorted, arg.f, arg.a) } } diff --git a/tests/go/test_isupper.go b/tests/go/test_isupper.go index 3acae4dbb..c8df3ee12 100644 --- a/tests/go/test_isupper.go +++ b/tests/go/test_isupper.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -42,6 +42,6 @@ func main() { "HELLO!", ) for _, arg := range table { - z01.Challenge("IsUpper", student.IsUpper, solutions.IsUpper, arg) + z01.Challenge("IsUpper", student.IsUpper, correct.IsUpper, arg) } } diff --git a/tests/go/test_iterativefactorial.go b/tests/go/test_iterativefactorial.go index 3e9c986fe..5da0a55bf 100644 --- a/tests/go/test_iterativefactorial.go +++ b/tests/go/test_iterativefactorial.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -18,6 +18,6 @@ func main() { table = append(table, z01.IntRange(13, 20)...) } for _, arg := range table { - z01.Challenge("IterativeFactorial", student.IterativeFactorial, solutions.IterativeFactorial, arg) + z01.Challenge("IterativeFactorial", student.IterativeFactorial, correct.IterativeFactorial, arg) } } diff --git a/tests/go/test_iterativepower.go b/tests/go/test_iterativepower.go index 8f68e067f..378167f05 100644 --- a/tests/go/test_iterativepower.go +++ b/tests/go/test_iterativepower.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -12,9 +12,9 @@ func main() { for i < 30 { nb := z01.RandIntBetween(-8, 8) power := z01.RandIntBetween(-10, 10) - z01.Challenge("IterativePower", student.IterativePower, solutions.IterativePower, nb, power) + z01.Challenge("IterativePower", student.IterativePower, correct.IterativePower, nb, power) i++ } - z01.Challenge("IterativePower", student.IterativePower, solutions.IterativePower, 0, 0) - z01.Challenge("IterativePower", student.IterativePower, solutions.IterativePower, 0, 1) + z01.Challenge("IterativePower", student.IterativePower, correct.IterativePower, 0, 0) + z01.Challenge("IterativePower", student.IterativePower, correct.IterativePower, 0, 1) } diff --git a/tests/go/test_itoa.go b/tests/go/test_itoa.go index 5ae5442b1..02354271a 100644 --- a/tests/go/test_itoa.go +++ b/tests/go/test_itoa.go @@ -3,13 +3,13 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { for i := 0; i < 50; i++ { arg := z01.RandIntBetween(-2000000000, 2000000000) - z01.Challenge("Itoa", student.Itoa, solutions.Itoa, arg) + z01.Challenge("Itoa", student.Itoa, correct.Itoa, arg) } } diff --git a/tests/go/test_itoabase.go b/tests/go/test_itoabase.go index 62479e103..b08851524 100644 --- a/tests/go/test_itoabase.go +++ b/tests/go/test_itoabase.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -11,11 +11,11 @@ func main() { for i := 0; i < 30; i++ { value := z01.RandIntBetween(-1000000, 1000000) base := z01.RandIntBetween(2, 16) - z01.Challenge("ItoaBase", student.ItoaBase, solutions.ItoaBase, value, base) + z01.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, value, base) } for i := 0; i < 5; i++ { base := z01.RandIntBetween(2, 16) - z01.Challenge("ItoaBase", student.ItoaBase, solutions.ItoaBase, z01.MaxInt, base) - z01.Challenge("ItoaBase", student.ItoaBase, solutions.ItoaBase, z01.MinInt, base) + z01.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, z01.MaxInt, base) + z01.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, z01.MinInt, base) } } diff --git a/tests/go/test_join.go b/tests/go/test_join.go index 3c837063b..0873a5b1b 100644 --- a/tests/go/test_join.go +++ b/tests/go/test_join.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -22,6 +22,6 @@ func main() { // random position for the slice of separators posS := z01.RandIntBetween(0, len(seps)-1) - z01.Challenge("Join", student.Join, solutions.Join, args[posA], seps[posS]) + z01.Challenge("Join", student.Join, correct.Join, args[posA], seps[posS]) } } diff --git a/tests/go/test_lastrune.go b/tests/go/test_lastrune.go index 963286a84..deb4ca963 100644 --- a/tests/go/test_lastrune.go +++ b/tests/go/test_lastrune.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -16,6 +16,6 @@ func main() { z01.RandStr(z01.RandIntBetween(1, 15), z01.RandAlnum()), ) for _, arg := range table { - z01.Challenge("LastRune", student.LastRune, solutions.LastRune, arg) + z01.Challenge("LastRune", student.LastRune, correct.LastRune, arg) } } diff --git a/tests/go/test_listat.go b/tests/go/test_listat.go index a656ff53b..a21b9cddd 100644 --- a/tests/go/test_listat.go +++ b/tests/go/test_listat.go @@ -3,12 +3,12 @@ package main import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node5 = student.NodeL -type NodeS5 = solution.NodeL +type NodeS5 = correct.NodeL func nodePushBackList5(l1 *Node5, l2 *NodeS5, data interface{}) (*Node5, *NodeS5) { n1 := &Node5{Data: data} @@ -42,15 +42,15 @@ func comparFuncNode5(solutionList *NodeS5, l1 *Node5, l2 *NodeS5, arg int) { } if l1 != nil && l2 == nil { z01.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", - solution.ListToString(solutionList), arg, l1, l2) + correct.ListToString(solutionList), arg, l1, l2) } if l1.Data != l2.Data { z01.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", - solution.ListToString(solutionList), arg, l1.Data, l2.Data) + correct.ListToString(solutionList), arg, l1.Data, l2.Data) } } -// finds an element of a solution.ListS using a given position +// finds an element of a correct.ListS using a given position func main() { var link1 *Node5 var link2 *NodeS5 @@ -64,14 +64,14 @@ func main() { for i := 0; i < 4; i++ { table = append(table, nodeTest{ - data: solution.ConvertIntToInterface(z01.MultRandInt()), + data: correct.ConvertIntToInterface(z01.MultRandInt()), pos: z01.RandIntBetween(1, 12), }) } for i := 0; i < 4; i++ { table = append(table, nodeTest{ - data: solution.ConvertIntToStringface(z01.MultRandWords()), + data: correct.ConvertIntToStringface(z01.MultRandWords()), pos: z01.RandIntBetween(1, 12), }) } @@ -87,7 +87,7 @@ func main() { } result1 := student.ListAt(link1, arg.pos) - result2 := solution.ListAt(link2, arg.pos) + result2 := correct.ListAt(link2, arg.pos) comparFuncNode5(link2, result1, result2, arg.pos) link1 = nil diff --git a/tests/go/test_listclear.go b/tests/go/test_listclear.go index 5000409f7..3bcb4c35a 100644 --- a/tests/go/test_listclear.go +++ b/tests/go/test_listclear.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node4 = student.NodeL -type List4 = solution.List -type NodeS4 = solution.NodeL +type List4 = correct.List +type NodeS4 = correct.NodeL type ListS4 = student.List func listToStringStu5(l *ListS4) string { @@ -53,17 +53,17 @@ func listPushBackTest4(l1 *ListS4, l2 *List4, data interface{}) { } } -// simply cleans the linked solution.ListS +// simply cleans the linked correct.ListS func main() { link1 := &List4{} link2 := &ListS4{} - table := []solution.NodeTest{} + table := []correct.NodeTest{} - table = solution.ElementsToTest(table) + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"I", 1, "something", 2}, }, ) @@ -72,12 +72,12 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest4(link2, link1, arg.Data[i]) } - solution.ListClear(link1) + correct.ListClear(link1) student.ListClear(link2) if link2.Head != nil { z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListClear() == %v instead of %v\n\n", - listToStringStu5(link2), solution.ListToString(link1.Head), link2.Head, link1.Head) + listToStringStu5(link2), correct.ListToString(link1.Head), link2.Head, link1.Head) } } } diff --git a/tests/go/test_listfind.go b/tests/go/test_listfind.go index 11442dcbf..6e71b5109 100644 --- a/tests/go/test_listfind.go +++ b/tests/go/test_listfind.go @@ -3,13 +3,13 @@ package main import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node9 = student.NodeL -type List9 = solution.List -type NodeS9 = solution.NodeL +type List9 = correct.List +type NodeS9 = correct.NodeL type ListS9 = student.List func listPushBackTest9(l1 *ListS9, l2 *List9, data interface{}) { @@ -39,10 +39,10 @@ func main() { link1 := &List9{} link2 := &ListS9{} - table := []solution.NodeTest{} - table = solution.ElementsToTest(table) + table := []correct.NodeTest{} + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"hello", "hello1", "hello2", "hello3"}, }, ) @@ -53,7 +53,7 @@ func main() { } if len(arg.Data) != 0 { aux1 := student.ListFind(link2, arg.Data[(len(arg.Data)-1)/2], student.CompStr) - aux2 := solution.ListFind(link1, arg.Data[(len(arg.Data)-1)/2], solution.CompStr) + aux2 := correct.ListFind(link1, arg.Data[(len(arg.Data)-1)/2], correct.CompStr) if aux1 != nil || aux2 != nil { if *aux1 != *aux2 { @@ -70,7 +70,7 @@ func main() { } aux1 := student.ListFind(link2, "lksdf", student.CompStr) - aux2 := solution.ListFind(link1, "lksdf", solution.CompStr) + 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) diff --git a/tests/go/test_listforeach.go b/tests/go/test_listforeach.go index e4e9a8cd0..7aa53f399 100644 --- a/tests/go/test_listforeach.go +++ b/tests/go/test_listforeach.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node7 = student.NodeL -type List7 = solution.List -type NodeS7 = solution.NodeL +type List7 = correct.List +type NodeS7 = correct.NodeL type ListS7 = student.List func listToStringStu8(l *ListS7) string { @@ -54,29 +54,29 @@ func listPushBackTest7(l1 *ListS7, l2 *List7, data interface{}) { } func comparFuncList7(l1 *List7, l2 *ListS7, f func(*Node7)) { - funcName := solution.GetName(f) + 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", - listToStringStu8(l2), solution.ListToString(l1.Head), funcName, l2.Head, l1.Head) + 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", - listToStringStu8(l2), solution.ListToString(l1.Head), funcName, l2.Head.Data, l1.Head.Data) + listToStringStu8(l2), correct.ListToString(l1.Head), funcName, l2.Head.Data, l1.Head.Data) } l1.Head = l1.Head.Next l2.Head = l2.Head.Next } } -// applies a function to the solution.ListS +// applies a function to the correct.ListS func main() { link1 := &List7{} link2 := &ListS7{} - table := []solution.NodeTest{} - table = solution.ElementsToTest(table) + table := []correct.NodeTest{} + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"I", 1, "something", 2}, }, ) @@ -85,12 +85,12 @@ func main() { listPushBackTest7(link2, link1, arg.Data[i]) } student.ListForEach(link2, student.Add2_node) - solution.ListForEach(link1, solution.Add2_node) + correct.ListForEach(link1, correct.Add2_node) comparFuncList7(link1, link2, student.Add2_node) student.ListForEach(link2, student.Subtract3_node) - solution.ListForEach(link1, solution.Subtract3_node) + correct.ListForEach(link1, correct.Subtract3_node) comparFuncList7(link1, link2, student.Subtract3_node) diff --git a/tests/go/test_listforeachif.go b/tests/go/test_listforeachif.go index 3f4abaac9..4ea72a1fb 100644 --- a/tests/go/test_listforeachif.go +++ b/tests/go/test_listforeachif.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node8 = student.NodeL -type List8 = solution.List -type NodeS8 = solution.NodeL +type List8 = correct.List +type NodeS8 = correct.NodeL type ListS8 = student.List // function to apply, in listforeachif @@ -82,50 +82,50 @@ func listPushBackTest8(l1 *ListS8, l2 *List8, data interface{}) { } func comparFuncList8(l1 *List8, l2 *ListS8, f func(*Node8) bool, comp func(*Node8)) { - funcFName := solution.GetName(f) - funcComp := solution.GetName(comp) + funcFName := correct.GetName(f) + 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", - listToStringStu7(l2), solution.ListToString(l1.Head), funcComp, funcFName, l2.Head, l1.Head) + 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", - listToStringStu7(l2), solution.ListToString(l1.Head), funcComp, funcFName, l2.Head.Data, l1.Head.Data) + listToStringStu7(l2), correct.ListToString(l1.Head), funcComp, funcFName, l2.Head.Data, l1.Head.Data) } l1.Head = l1.Head.Next l2.Head = l2.Head.Next } } -// applies a function to an element of the linked solution.ListS +// applies a function to an element of the linked correct.ListS func main() { link1 := &ListS8{} link2 := &List8{} - table := []solution.NodeTest{} + table := []correct.NodeTest{} table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{}, }, ) // just numbers/ints for i := 0; i < 3; i++ { - val := solution.NodeTest{ - Data: solution.ConvertIntToInterface(z01.MultRandInt()), + val := correct.NodeTest{ + Data: correct.ConvertIntToInterface(z01.MultRandInt()), } table = append(table, val) } // just strings for i := 0; i < 3; i++ { - val := solution.NodeTest{ - Data: solution.ConvertIntToStringface(z01.MultRandWords()), + val := correct.NodeTest{ + Data: correct.ConvertIntToStringface(z01.MultRandWords()), } table = append(table, val) } table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"I", 1, "something", 2}, }, ) @@ -133,11 +133,11 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest8(link1, link2, arg.Data[i]) } - solution.ListForEachIf(link2, addOneS, solution.IsPositive_node) + correct.ListForEachIf(link2, addOneS, correct.IsPositive_node) student.ListForEachIf(link1, addOne, student.IsPositive_node) comparFuncList8(link2, link1, student.IsPositive_node, addOne) - solution.ListForEachIf(link2, subtract1_sol, solution.IsPositive_node) + correct.ListForEachIf(link2, subtract1_sol, correct.IsPositive_node) student.ListForEachIf(link1, subtractOne, student.IsPositive_node) comparFuncList8(link2, link1, student.IsPositive_node, subtractOne) diff --git a/tests/go/test_listlast.go b/tests/go/test_listlast.go index 81e81b9cf..a4efa275b 100644 --- a/tests/go/test_listlast.go +++ b/tests/go/test_listlast.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node3 = student.NodeL -type List3 = solution.List -type NodeS3 = solution.NodeL +type List3 = correct.List +type NodeS3 = correct.NodeL type ListS3 = student.List func listToStringStu9(l *ListS3) string { @@ -50,15 +50,15 @@ func listPushBackTest3(l *ListS3, l1 *List3, data interface{}) { } } -// last element of the solution.ListS +// last element of the correct.ListS func main() { link1 := &List3{} link2 := &ListS3{} - table := []solution.NodeTest{} + table := []correct.NodeTest{} - table = solution.ElementsToTest(table) + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{3, 2, 1}, }, ) @@ -66,7 +66,7 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest3(link2, link1, arg.Data[i]) } - aux1 := solution.ListLast(link1) + aux1 := correct.ListLast(link1) aux2 := student.ListLast(link2) if aux1 != aux2 { diff --git a/tests/go/test_listmerge.go b/tests/go/test_listmerge.go index 3f5365959..6a7c20a41 100644 --- a/tests/go/test_listmerge.go +++ b/tests/go/test_listmerge.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node11 = student.NodeL -type List11 = solution.List -type NodeS11 = solution.NodeL +type List11 = correct.List +type NodeS11 = correct.NodeL type ListS11 = student.List func listToStringStu(l *ListS11) string { @@ -61,11 +61,11 @@ func comparFuncList11(l1 *List11, l2 *ListS11) { for l1.Head != nil || l2.Head != nil { if (l1.Head == nil && l2.Head != nil) || (l1.Head != nil && l2.Head == nil) { z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", - listToStringStu(l2), solution.ListToString(l1.Head), l2.Head, l1.Head) + 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", - listToStringStu(l2), solution.ListToString(l1.Head), l2.Head.Data, l1.Head.Data) + listToStringStu(l2), correct.ListToString(l1.Head), l2.Head.Data, l1.Head.Data) } l1.Head = l1.Head.Next l2.Head = l2.Head.Next @@ -91,22 +91,22 @@ func main() { }) table = append(table, nodeTest{ - data1: solution.ConvertIntToInterface(z01.MultRandInt()), + data1: correct.ConvertIntToInterface(z01.MultRandInt()), data2: []interface{}{}, }) // jut ints for i := 0; i < 3; i++ { val := nodeTest{ - data1: solution.ConvertIntToInterface(z01.MultRandInt()), - data2: solution.ConvertIntToInterface(z01.MultRandInt()), + data1: correct.ConvertIntToInterface(z01.MultRandInt()), + data2: correct.ConvertIntToInterface(z01.MultRandInt()), } table = append(table, val) } // just strings for i := 0; i < 2; i++ { val := nodeTest{ - data1: solution.ConvertIntToStringface(z01.MultRandWords()), - data2: solution.ConvertIntToStringface(z01.MultRandWords()), + data1: correct.ConvertIntToStringface(z01.MultRandWords()), + data2: correct.ConvertIntToStringface(z01.MultRandWords()), } table = append(table, val) } @@ -124,7 +124,7 @@ func main() { listPushBackTest11(link2Test, linkTest, arg.data2[i]) } - solution.ListMerge(link1, linkTest) + correct.ListMerge(link1, linkTest) student.ListMerge(link2, link2Test) comparFuncList11(link1, link2) diff --git a/tests/go/test_listpushback.go b/tests/go/test_listpushback.go index 0527c5469..70eb43b06 100644 --- a/tests/go/test_listpushback.go +++ b/tests/go/test_listpushback.go @@ -5,11 +5,11 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) -type ListS = solution.List +type ListS = correct.List type List = student.List func listToStringStu10(l *List) string { @@ -33,11 +33,11 @@ func comparFuncList(l *ListS, l1 *List, data []interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", - data, listToStringStu10(l1), solution.ListToString(l.Head), l1.Head, l.Head) + 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", - data, listToStringStu10(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) + data, listToStringStu10(l1), correct.ListToString(l.Head), l1.Head.Data, l.Head.Data) } l.Head = l.Head.Next l1.Head = l1.Head.Next @@ -48,17 +48,17 @@ func main() { link1 := &ListS{} link2 := &List{} - table := []solution.NodeTest{} - table = solution.ElementsToTest(table) + table := []correct.NodeTest{} + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"Hello", "man", "how are you"}, }, ) for _, arg := range table { for _, item := range arg.Data { student.ListPushBack(link2, item) - solution.ListPushBack(link1, item) + correct.ListPushBack(link1, item) } comparFuncList(link1, link2, arg.Data) } diff --git a/tests/go/test_listpushfront.go b/tests/go/test_listpushfront.go index ce95a30ea..22e80e061 100644 --- a/tests/go/test_listpushfront.go +++ b/tests/go/test_listpushfront.go @@ -5,11 +5,11 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) -type ListSa = solution.List +type ListSa = correct.List type Lista = student.List func listToStringStu11(l *Lista) string { @@ -33,11 +33,11 @@ func comparFuncList1(l *Lista, l1 *ListSa, data []interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", - data, listToStringStu11(l), solution.ListToString(l1.Head), l.Head, l1.Head) + 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", - data, listToStringStu11(l), solution.ListToString(l1.Head), l.Head, l1.Head) + data, listToStringStu11(l), correct.ListToString(l1.Head), l.Head, l1.Head) } l1.Head = l1.Head.Next l.Head = l.Head.Next @@ -48,17 +48,17 @@ func comparFuncList1(l *Lista, l1 *ListSa, data []interface{}) { func main() { link1 := &Lista{} link2 := &ListSa{} - table := []solution.NodeTest{} - table = solution.ElementsToTest(table) + table := []correct.NodeTest{} + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"Hello", "man", "how are you"}, }, ) for _, arg := range table { for _, item := range arg.Data { student.ListPushFront(link1, item) - solution.ListPushFront(link2, item) + correct.ListPushFront(link2, item) } comparFuncList1(link1, link2, arg.Data) link1 = &Lista{} diff --git a/tests/go/test_listremoveif.go b/tests/go/test_listremoveif.go index 6567c04d1..bb49e71ab 100644 --- a/tests/go/test_listremoveif.go +++ b/tests/go/test_listremoveif.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node10 = student.NodeL -type List10 = solution.List -type NodeS10 = solution.NodeL +type List10 = correct.List +type NodeS10 = correct.NodeL type ListS10 = student.List func listToStringStu12(l *ListS10) string { @@ -57,11 +57,11 @@ func comparFuncList10(l *List10, l1 *ListS10, data interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { z01.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", - data, listToStringStu12(l1), solution.ListToString(l.Head), l1.Head, l.Head) + 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", - data, listToStringStu12(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) + data, listToStringStu12(l1), correct.ListToString(l.Head), l1.Head.Data, l.Head.Data) } l.Head = l.Head.Next l1.Head = l1.Head.Next @@ -73,12 +73,12 @@ func main() { link1 := &List10{} link2 := &ListS10{} var index int - table := []solution.NodeTest{} + table := []correct.NodeTest{} - table = solution.ElementsToTest(table) + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"hello", "hello1", "hello2", "hello3"}, }, ) @@ -93,11 +93,11 @@ func main() { if link1.Head != nil && link2.Head != nil { cho := arg.Data[index] student.ListRemoveIf(link2, cho) - solution.ListRemoveIf(link1, cho) + correct.ListRemoveIf(link1, cho) comparFuncList10(link1, link2, cho) } else { student.ListRemoveIf(link2, 1) - solution.ListRemoveIf(link1, 1) + correct.ListRemoveIf(link1, 1) comparFuncList10(link1, link2, 1) } diff --git a/tests/go/test_listreverse.go b/tests/go/test_listreverse.go index 991e2b0e9..5b5a1c5ac 100644 --- a/tests/go/test_listreverse.go +++ b/tests/go/test_listreverse.go @@ -5,13 +5,13 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node6 = student.NodeL -type List6 = solution.List -type NodeS6 = solution.NodeL +type List6 = correct.List +type NodeS6 = correct.NodeL type ListS6 = student.List func listToStringStu13(l *ListS6) string { @@ -34,11 +34,11 @@ func comparFuncList6(l *List6, l1 *ListS6) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { z01.Fatalf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", - listToStringStu13(l1), solution.ListToString(l.Head), l1.Head, l.Head) + 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", - listToStringStu13(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) + listToStringStu13(l1), correct.ListToString(l.Head), l1.Head.Data, l.Head.Data) } l.Head = l.Head.Next l1.Head = l1.Head.Next @@ -71,16 +71,16 @@ func listPushBackTest6(l *ListS6, l1 *List6, data interface{}) { func main() { link1 := &List6{} link2 := &ListS6{} - table := []solution.NodeTest{{ + table := []correct.NodeTest{{ Data: []interface{}{"I", 1, "something", 2}, }} - table = solution.ElementsToTest(table) + table = correct.ElementsToTest(table) for _, arg := range table { for _, item := range arg.Data { listPushBackTest6(link2, link1, item) } student.ListReverse(link2) - solution.ListReverse(link1) + correct.ListReverse(link1) comparFuncList6(link1, link2) link1 = &List6{} link2 = &ListS6{} diff --git a/tests/go/test_listsize.go b/tests/go/test_listsize.go index c09cd1885..aaec5e11a 100644 --- a/tests/go/test_listsize.go +++ b/tests/go/test_listsize.go @@ -3,13 +3,13 @@ package main import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type Node2 = student.NodeL -type List2 = solution.List -type NodeS2 = solution.NodeL +type List2 = correct.List +type NodeS2 = correct.NodeL type ListS2 = student.List func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { @@ -39,10 +39,10 @@ func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { func main() { link := &List2{} link2 := &ListS2{} - table := []solution.NodeTest{} - table = solution.ElementsToTest(table) + table := []correct.NodeTest{} + table = correct.ElementsToTest(table) table = append(table, - solution.NodeTest{ + correct.NodeTest{ Data: []interface{}{"Hello", "man", "how are you"}, }, ) @@ -50,10 +50,10 @@ func main() { for i := 0; i < len(arg.Data); i++ { listPushBackTest2(link2, link, arg.Data[i]) } - aux := solution.ListSize(link) + aux := correct.ListSize(link) aux2 := student.ListSize(link2) if aux != aux2 { - z01.Fatalf("ListSize(%v) == %d instead of %d\n", solution.ListToString(link.Head), aux2, aux) + z01.Fatalf("ListSize(%v) == %d instead of %d\n", correct.ListToString(link.Head), aux2, aux) } link = &List2{} link2 = &ListS2{} diff --git a/tests/go/test_listsort.go b/tests/go/test_listsort.go index f221f750e..f5bbdfe35 100644 --- a/tests/go/test_listsort.go +++ b/tests/go/test_listsort.go @@ -5,12 +5,12 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) type NodeI12 = student.NodeI -type NodeIS12 = solution.NodeI +type NodeIS12 = correct.NodeI func printListStudent(n *NodeI12) string { var res string @@ -52,11 +52,11 @@ 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", - printListStudent(l1), solution.PrintList(l2), l1, l2) + 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", - printListStudent(l1), solution.PrintList(l2), l1.Data, l2.Data) + printListStudent(l1), correct.PrintList(l2), l1.Data, l2.Data) } l1 = l1.Next l2 = l2.Next @@ -83,7 +83,7 @@ func main() { for i := 0; i < len(arg.data); i++ { nodePushBackListInt12(link1, link2, arg.data[i]) } - aux1 := solution.ListSort(link2) + aux1 := correct.ListSort(link2) aux2 := student.ListSort(link1) comparFuncNodeInt12(aux2, aux1) diff --git a/tests/go/test_makerange.go b/tests/go/test_makerange.go index 4c1756292..e0cca18ab 100644 --- a/tests/go/test_makerange.go +++ b/tests/go/test_makerange.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -43,6 +43,6 @@ func main() { node{min: 10, max: 5}, ) for _, arg := range table { - z01.Challenge("MakeRange", student.MakeRange, solutions.MakeRange, arg.min, arg.max) + z01.Challenge("MakeRange", student.MakeRange, correct.MakeRange, arg.min, arg.max) } } diff --git a/tests/go/test_map.go b/tests/go/test_map.go index dfbc9ec77..fa0ef4029 100644 --- a/tests/go/test_map.go +++ b/tests/go/test_map.go @@ -3,12 +3,12 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - functionsArray := []func(int) bool{solutions.IsPositive, solutions.IsNegative0, solutions.IsPrime} + functions := []func(int) bool{correct.IsPositive, correct.IsNegative0, correct.IsPrime} type node struct { f func(int) bool @@ -18,20 +18,20 @@ func main() { table := []node{} for i := 0; i < 15; i++ { - functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)] + function := functions[z01.RandIntBetween(0, len(functions)-1)] val := node{ - f: functionSelected, + f: function, arr: z01.MultRandIntBetween(-1000000, 1000000), } table = append(table, val) } table = append(table, node{ - f: solutions.IsPrime, + f: correct.IsPrime, arr: []int{1, 2, 3, 4, 5, 6}, }) for _, arg := range table { - z01.Challenge("Map", student.Map, solutions.Map, arg.f, arg.arr) + z01.Challenge("Map", student.Map, correct.Map, arg.f, arg.arr) } } diff --git a/tests/go/test_max.go b/tests/go/test_max.go index d1241d3f2..7cd55e0f5 100644 --- a/tests/go/test_max.go +++ b/tests/go/test_max.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -14,5 +14,5 @@ func main() { args = append(args, z01.RandInt()) } - z01.Challenge("Max", student.Max, solutions.Max, args) + z01.Challenge("Max", student.Max, correct.Max, args) } diff --git a/tests/go/test_nrune.go b/tests/go/test_nrune.go index 7b438e491..fa8a01dfa 100644 --- a/tests/go/test_nrune.go +++ b/tests/go/test_nrune.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -39,6 +39,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("NRune", student.NRune, solutions.NRune, arg.word, arg.n) + z01.Challenge("NRune", student.NRune, correct.NRune, arg.word, arg.n) } } diff --git a/tests/go/test_printcomb.go b/tests/go/test_printcomb.go index 4f850c171..9213ab7c0 100644 --- a/tests/go/test_printcomb.go +++ b/tests/go/test_printcomb.go @@ -3,10 +3,10 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - z01.Challenge("PrintComb", student.PrintComb, solutions.PrintComb) + z01.Challenge("PrintComb", student.PrintComb, correct.PrintComb) } diff --git a/tests/go/test_printcomb2.go b/tests/go/test_printcomb2.go index 2174e4406..a680946ca 100644 --- a/tests/go/test_printcomb2.go +++ b/tests/go/test_printcomb2.go @@ -3,10 +3,10 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { - z01.Challenge("PrintComb2", student.PrintComb2, solutions.PrintComb2) + z01.Challenge("PrintComb2", student.PrintComb2, correct.PrintComb2) } diff --git a/tests/go/test_printcombn.go b/tests/go/test_printcombn.go index 158a62648..3468d7610 100644 --- a/tests/go/test_printcombn.go +++ b/tests/go/test_printcombn.go @@ -3,13 +3,13 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) func main() { table := []int{1, 2, 3, 4, 5, 6, 7, 8, 9} for _, arg := range table { - z01.Challenge("PrintCombN", student.PrintCombN, solutions.PrintCombN, arg) + z01.Challenge("PrintCombN", student.PrintCombN, correct.PrintCombN, arg) } } diff --git a/tests/go/test_printnbr.go b/tests/go/test_printnbr.go index 0b35e176b..532e59d6a 100644 --- a/tests/go/test_printnbr.go +++ b/tests/go/test_printnbr.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -15,6 +15,6 @@ func main() { 0, ) for _, arg := range table { - z01.Challenge("PrintNbr", student.PrintNbr, solutions.PrintNbr, arg) + z01.Challenge("PrintNbr", student.PrintNbr, correct.PrintNbr, arg) } } diff --git a/tests/go/test_printnbrbase.go b/tests/go/test_printnbrbase.go index 607dbd17b..37c5c9a1a 100644 --- a/tests/go/test_printnbrbase.go +++ b/tests/go/test_printnbrbase.go @@ -5,7 +5,7 @@ import ( "./base" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -46,7 +46,7 @@ func main() { node{n: z01.MinInt, base: "0123456789"}, ) for _, arg := range table { - z01.Challenge("PrintNbrBase", student.PrintNbrBase, solutions.PrintNbrBase, arg.n, arg.base) + z01.Challenge("PrintNbrBase", student.PrintNbrBase, correct.PrintNbrBase, arg.n, arg.base) } } diff --git a/tests/go/test_printnbrinorder.go b/tests/go/test_printnbrinorder.go index adfc66ce2..54fa1f0bb 100644 --- a/tests/go/test_printnbrinorder.go +++ b/tests/go/test_printnbrinorder.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -16,6 +16,6 @@ func main() { 0, ) for _, arg := range table { - z01.Challenge("PrintNbrInOrder", student.PrintNbrInOrder, solutions.PrintNbrInOrder, arg) + z01.Challenge("PrintNbrInOrder", student.PrintNbrInOrder, correct.PrintNbrInOrder, arg) } } diff --git a/tests/go/test_printstr.go b/tests/go/test_printstr.go index 5e9ccc808..806840d4e 100644 --- a/tests/go/test_printstr.go +++ b/tests/go/test_printstr.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -11,6 +11,6 @@ func main() { table := z01.MultRandASCII() table = append(table, "Hello World!") for _, arg := range table { - z01.Challenge("PrintStr", student.PrintStr, solutions.PrintStr, arg) + z01.Challenge("PrintStr", student.PrintStr, correct.PrintStr, arg) } } diff --git a/tests/go/test_printwordstables.go b/tests/go/test_printwordstables.go index 76a710b93..fab88b79f 100644 --- a/tests/go/test_printwordstables.go +++ b/tests/go/test_printwordstables.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -14,7 +14,7 @@ func main() { // 30 random slice of slice of strings for i := 0; i < 30; i++ { - val := solutions.SplitWhiteSpaces(strings.Join(z01.MultRandASCII(), " ")) + val := correct.SplitWhiteSpaces(strings.Join(z01.MultRandASCII(), " ")) table = append(table, val) } @@ -22,6 +22,6 @@ func main() { []string{"Hello", "how", "are", "you?"}) for _, arg := range table { - z01.Challenge("PrintWordsTables", student.PrintWordsTables, solutions.PrintWordsTables, arg) + z01.Challenge("PrintWordsTables", student.PrintWordsTables, correct.PrintWordsTables, arg) } } diff --git a/tests/go/test_raid1a.go b/tests/go/test_raid1a.go index a0466d432..38dc4a5cb 100644 --- a/tests/go/test_raid1a.go +++ b/tests/go/test_raid1a.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -27,7 +27,7 @@ func main() { // 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", solutions.Raid1a, student.Raid1a, table[i], table[i+1]) + z01.Challenge("Raid1a", correct.Raid1a, student.Raid1a, table[i], table[i+1]) } } } diff --git a/tests/go/test_raid1b.go b/tests/go/test_raid1b.go index 5eab92d3b..021591a9c 100644 --- a/tests/go/test_raid1b.go +++ b/tests/go/test_raid1b.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -27,7 +27,7 @@ func main() { // 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", solutions.Raid1b, student.Raid1b, table[i], table[i+1]) + z01.Challenge("Raid1b", correct.Raid1b, student.Raid1b, table[i], table[i+1]) } } } diff --git a/tests/go/test_raid1c.go b/tests/go/test_raid1c.go index 3eca0d9f4..cf493c23b 100644 --- a/tests/go/test_raid1c.go +++ b/tests/go/test_raid1c.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -27,7 +27,7 @@ func main() { // 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", solutions.Raid1c, student.Raid1c, table[i], table[i+1]) + z01.Challenge("Raid1c", correct.Raid1c, student.Raid1c, table[i], table[i+1]) } } } diff --git a/tests/go/test_raid1d.go b/tests/go/test_raid1d.go index b76610beb..61ecccb59 100644 --- a/tests/go/test_raid1d.go +++ b/tests/go/test_raid1d.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -27,7 +27,7 @@ func main() { // 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", solutions.Raid1d, student.Raid1d, table[i], table[i+1]) + z01.Challenge("Raid1d", correct.Raid1d, student.Raid1d, table[i], table[i+1]) } } } diff --git a/tests/go/test_raid1e.go b/tests/go/test_raid1e.go index 5cfcd6457..90ffcfd66 100644 --- a/tests/go/test_raid1e.go +++ b/tests/go/test_raid1e.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -27,7 +27,7 @@ func main() { // 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", solutions.Raid1e, student.Raid1e, table[i], table[i+1]) + z01.Challenge("Raid1e", correct.Raid1e, student.Raid1e, table[i], table[i+1]) } } } diff --git a/tests/go/test_raid3.go b/tests/go/test_raid3.go index 575de0a3a..4952522a0 100644 --- a/tests/go/test_raid3.go +++ b/tests/go/test_raid3.go @@ -60,3 +60,5 @@ func main() { executeTest("raid1e", 1, 1) executeTest("echo", 0, 0) } + +// TODO: fix paths diff --git a/tests/go/test_recursivefactorial.go b/tests/go/test_recursivefactorial.go index 029a5e105..dd3e9483f 100644 --- a/tests/go/test_recursivefactorial.go +++ b/tests/go/test_recursivefactorial.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -18,6 +18,6 @@ func main() { table = append(table, z01.IntRange(13, 20)...) } for _, arg := range table { - z01.Challenge("RecursiveFactorial", student.RecursiveFactorial, solutions.RecursiveFactorial, arg) + z01.Challenge("RecursiveFactorial", student.RecursiveFactorial, correct.RecursiveFactorial, arg) } } diff --git a/tests/go/test_recursivepower.go b/tests/go/test_recursivepower.go index 83adb31e1..1b62c1dcc 100644 --- a/tests/go/test_recursivepower.go +++ b/tests/go/test_recursivepower.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -12,9 +12,9 @@ func main() { for i < 30 { nb := z01.RandIntBetween(-8, 8) power := z01.RandIntBetween(-10, 10) - z01.Challenge("RecursivePower", student.RecursivePower, solutions.RecursivePower, nb, power) + z01.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, nb, power) i++ } - z01.Challenge("RecursivePower", student.RecursivePower, solutions.RecursivePower, 0, 0) - z01.Challenge("RecursivePower", student.RecursivePower, solutions.RecursivePower, 0, 1) + z01.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 0) + z01.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 1) } diff --git a/tests/go/test_rot14.go b/tests/go/test_rot14.go index e85dbdf5f..61d29d9f5 100644 --- a/tests/go/test_rot14.go +++ b/tests/go/test_rot14.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) @@ -22,7 +22,7 @@ func main() { for _, arg := range table { for _, s := range arg.data { - z01.Challenge("Rot14", solution.Rot14, student.Rot14, s) + z01.Challenge("Rot14", correct.Rot14, student.Rot14, s) } } } diff --git a/tests/go/test_sortedlistmerge.go b/tests/go/test_sortedlistmerge.go index 2d501647c..ae5db0639 100644 --- a/tests/go/test_sortedlistmerge.go +++ b/tests/go/test_sortedlistmerge.go @@ -3,13 +3,14 @@ package main import ( "strconv" - solution "./solutions" - student "./student" "github.com/01-edu/z01" + + correct "./correct" + student "./student" ) type NodeI13 = student.NodeI -type NodeIS13 = solution.NodeI +type NodeIS13 = correct.NodeI func printListStudent1(n *NodeI13) string { var res string @@ -85,19 +86,19 @@ func main() { link1 = student.ListSort(link1) link2 = student.ListSort(link2) - linkTest1 = solution.ListSort(linkTest1) - linkTest2 = solution.ListSort(linkTest2) + linkTest1 = correct.ListSort(linkTest1) + linkTest2 = correct.ListSort(linkTest2) aux1 := student.SortedListMerge(link1, link2) - aux2 := solution.SortedListMerge(linkTest1, linkTest2) + aux2 := correct.SortedListMerge(linkTest1, linkTest2) 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", - printListStudent1(aux1), solution.PrintList(aux2), aux1, aux2) + 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", - printListStudent1(aux1), solution.PrintList(aux2), aux1, aux2) + printListStudent1(aux1), correct.PrintList(aux2), aux1, aux2) } link1 = &NodeI13{} diff --git a/tests/go/test_sortintegertable.go b/tests/go/test_sortintegertable.go index 53bef5e20..4682bf00f 100644 --- a/tests/go/test_sortintegertable.go +++ b/tests/go/test_sortintegertable.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -21,7 +21,7 @@ func main() { copy(table2, table1) student.SortIntegerTable(table1) - solutions.SortIntegerTable(table2) + correct.SortIntegerTable(table2) if !reflect.DeepEqual(table1, table2) { z01.Fatalf("SortIntegerTable(%v), table1 == %v instead of %v ", tableCopyBefore, table1, table2) } diff --git a/tests/go/test_sortlist.go b/tests/go/test_sortlist.go index a88695aa9..249856264 100644 --- a/tests/go/test_sortlist.go +++ b/tests/go/test_sortlist.go @@ -5,11 +5,11 @@ import ( "github.com/01-edu/z01" - solution "./solutions" + correct "./correct" student "./student" ) -func listToString4(n *solution.Nodelist) (res string) { +func listToString4(n *correct.Nodelist) (res string) { it := n for it != nil { res += strconv.Itoa(it.Data) + "-> " @@ -37,8 +37,8 @@ func descending(a, b int) bool { return a >= b } -func insertNodeListSolution(l *solution.Nodelist, data int) *solution.Nodelist { - n := &solution.Nodelist{Data: data} +func insertNodeListSolution(l *correct.Nodelist, data int) *correct.Nodelist { + n := &correct.Nodelist{Data: data} it := l if it == nil { it = n @@ -67,8 +67,8 @@ func insertNodeListStudent(l1 *student.Nodelist, data int) *student.Nodelist { return it } -func compare(l2 *solution.Nodelist, l1 *student.Nodelist, f func(a, b int) bool) { - cmp := solution.GetName(f) +func compare(l2 *correct.Nodelist, l1 *student.Nodelist, f func(a, b int) bool) { + cmp := correct.GetName(f) for l1 != nil && l2 != nil { if l1.Data != l2.Data { @@ -82,7 +82,7 @@ func compare(l2 *solution.Nodelist, l1 *student.Nodelist, f func(a, b int) bool) } func main() { - var linkSolutions *solution.Nodelist + var linkSolutions *correct.Nodelist var linkStudent *student.Nodelist type nodeTest struct { @@ -113,10 +113,10 @@ func main() { for _, fn := range arg.functions { studentResult := student.SortList(linkStudent, fn) - solutionResult := solution.SortList(linkSolutions, fn) + solutionResult := correct.SortList(linkSolutions, fn) compare(solutionResult, studentResult, fn) } - linkSolutions = &solution.Nodelist{} + linkSolutions = &correct.Nodelist{} linkStudent = &student.Nodelist{} } } diff --git a/tests/go/test_sortlistinsert.go b/tests/go/test_sortlistinsert.go index 6b737612b..dcd45ad36 100644 --- a/tests/go/test_sortlistinsert.go +++ b/tests/go/test_sortlistinsert.go @@ -5,12 +5,12 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) type NodeI14 = student.NodeI -type NodeIS14 = solutions.NodeI +type NodeIS14 = correct.NodeI func listToStringStu3(n *NodeI14) string { var res string @@ -55,11 +55,11 @@ 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", - data, listToStringStu3(l1), solutions.PrintList(l2), l1, l2) + 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", - data, listToStringStu3(l1), solutions.PrintList(l2), l1.Data, l2.Data) + data, listToStringStu3(l1), correct.PrintList(l2), l1.Data, l2.Data) } l1 = l1.Next l2 = l2.Next @@ -124,11 +124,11 @@ func main() { link1 = nodepushback1(link1, item) } - link2 = solutions.ListSort(link2) + link2 = correct.ListSort(link2) link1 = sortStudentsList(link1) for _, item := range arg.data_ref { - link2 = solutions.SortListInsert(link2, item) + link2 = correct.SortListInsert(link2, item) link1 = student.SortListInsert(link1, item) } diff --git a/tests/go/test_sortwordarr.go b/tests/go/test_sortwordarr.go index 72d3be3cb..462136e9c 100644 --- a/tests/go/test_sortwordarr.go +++ b/tests/go/test_sortwordarr.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -25,7 +25,7 @@ func main() { copy(cp_sol, org) copy(cp_stu, org) - solutions.SortWordArr(cp_sol) + correct.SortWordArr(cp_sol) student.SortWordArr(cp_stu) if !reflect.DeepEqual(cp_stu, cp_sol) { diff --git a/tests/go/test_split.go b/tests/go/test_split.go index 4cad1b17d..dc8002b2a 100644 --- a/tests/go/test_split.go +++ b/tests/go/test_split.go @@ -6,7 +6,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -40,6 +40,6 @@ func main() { node{str: "HelloHAhowHAareHAyou?", sep: "HA"}) for _, arg := range table { - z01.Challenge("Split", student.Split, solutions.Split, arg.str, arg.sep) + z01.Challenge("Split", student.Split, correct.Split, arg.str, arg.sep) } } diff --git a/tests/go/test_splitwhitespaces.go b/tests/go/test_splitwhitespaces.go index 2b185d681..2dd3c0195 100644 --- a/tests/go/test_splitwhitespaces.go +++ b/tests/go/test_splitwhitespaces.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -22,6 +22,6 @@ func main() { "Hello how are you?") for _, arg := range table { - z01.Challenge("SplitWhiteSpaces", student.SplitWhiteSpaces, solutions.SplitWhiteSpaces, arg) + z01.Challenge("SplitWhiteSpaces", student.SplitWhiteSpaces, correct.SplitWhiteSpaces, arg) } } diff --git a/tests/go/test_sqrt.go b/tests/go/test_sqrt.go index 2e5c62da7..d1b534321 100644 --- a/tests/go/test_sqrt.go +++ b/tests/go/test_sqrt.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -26,6 +26,6 @@ func main() { 100, ) for _, arg := range table { - z01.Challenge("Sqrt", student.Sqrt, solutions.Sqrt, arg) + z01.Challenge("Sqrt", student.Sqrt, correct.Sqrt, arg) } } diff --git a/tests/go/test_strlen.go b/tests/go/test_strlen.go index 0199a4a18..9f2d3905f 100644 --- a/tests/go/test_strlen.go +++ b/tests/go/test_strlen.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -20,6 +20,6 @@ func main() { table = append(table, randomStringCharset) for _, s := range table { - z01.Challenge("StrLen", solutions.StrLen, student.StrLen, s) + z01.Challenge("StrLen", correct.StrLen, student.StrLen, s) } } diff --git a/tests/go/test_strrev.go b/tests/go/test_strrev.go index 63fd2245b..375b46311 100644 --- a/tests/go/test_strrev.go +++ b/tests/go/test_strrev.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -15,6 +15,6 @@ func main() { "Hola!", ) for _, arg := range table { - z01.Challenge("StrRev", student.StrRev, solutions.StrRev, arg) + z01.Challenge("StrRev", student.StrRev, correct.StrRev, arg) } } diff --git a/tests/go/test_swapbits.go b/tests/go/test_swapbits.go index c57848508..c3bc5aa11 100644 --- a/tests/go/test_swapbits.go +++ b/tests/go/test_swapbits.go @@ -5,7 +5,7 @@ import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -31,6 +31,6 @@ func main() { } for _, v := range args { - challengeBytes(student.SwapBits, solutions.SwapBits, v) + challengeBytes(student.SwapBits, correct.SwapBits, v) } } diff --git a/tests/go/test_tetrisoptimizer.go b/tests/go/test_tetrisoptimizer.go index e2b3524ba..f1f1dffbb 100644 --- a/tests/go/test_tetrisoptimizer.go +++ b/tests/go/test_tetrisoptimizer.go @@ -162,6 +162,7 @@ func main() { } // TODO: +// Fix path // Add error cases : // wrong arguments // bad file types (links, folders) diff --git a/tests/go/test_tolower.go b/tests/go/test_tolower.go index 2d9e7fd43..947414508 100644 --- a/tests/go/test_tolower.go +++ b/tests/go/test_tolower.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -13,6 +13,6 @@ func main() { "Hello! How are you?", ) for _, arg := range table { - z01.Challenge("ToLower", student.ToLower, solutions.ToLower, arg) + z01.Challenge("ToLower", student.ToLower, correct.ToLower, arg) } } diff --git a/tests/go/test_toupper.go b/tests/go/test_toupper.go index d9f12bba8..7d31f9c84 100644 --- a/tests/go/test_toupper.go +++ b/tests/go/test_toupper.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -15,6 +15,6 @@ func main() { ) for _, arg := range table { - z01.Challenge("ToUpper", student.ToUpper, solutions.ToUpper, arg) + z01.Challenge("ToUpper", student.ToUpper, correct.ToUpper, arg) } } diff --git a/tests/go/test_trimatoi.go b/tests/go/test_trimatoi.go index 6d7c51869..019fda469 100644 --- a/tests/go/test_trimatoi.go +++ b/tests/go/test_trimatoi.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -37,6 +37,6 @@ func main() { } a = stringsToTrimAtoi(a) for _, elem := range a { - z01.Challenge("TrimAtoi", student.TrimAtoi, solutions.TrimAtoi, elem) + z01.Challenge("TrimAtoi", student.TrimAtoi, correct.TrimAtoi, elem) } } diff --git a/tests/go/test_unmatch.go b/tests/go/test_unmatch.go index e41889bd4..9eb75fadb 100644 --- a/tests/go/test_unmatch.go +++ b/tests/go/test_unmatch.go @@ -3,7 +3,7 @@ package main import ( "github.com/01-edu/z01" - solutions "./solutions" + correct "./correct" student "./student" ) @@ -25,6 +25,6 @@ func main() { args := [][]int{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8} for _, v := range args { - z01.Challenge("Unmatch", student.Unmatch, solutions.Unmatch, v) + z01.Challenge("Unmatch", student.Unmatch, correct.Unmatch, v) } }