Browse Source

Remove unnecessary empty lines and simplify code

content-update
Xavier Petit 4 years ago committed by xpetit
parent
commit
b1af817bb4
  1. 1
      tests/go/activebits_test.go
  2. 1
      tests/go/advancedsortwordarr_test.go
  3. 1
      tests/go/alphacount_test.go
  4. 8
      tests/go/any_test.go
  5. 3
      tests/go/appendrange_test.go
  6. 1
      tests/go/boolean_test.go
  7. 1
      tests/go/btreedeletenode_test.go
  8. 1
      tests/go/btreeinsertdata_test.go
  9. 2
      tests/go/btreesearchitem_test.go
  10. 1
      tests/go/cat_test.go
  11. 1
      tests/go/compare_test.go
  12. 1
      tests/go/concatparams_test.go
  13. 1
      tests/go/convertbase_test.go
  14. 8
      tests/go/countif_test.go
  15. 1
      tests/go/displayfile_test.go
  16. 1
      tests/go/doop_test.go
  17. 1
      tests/go/fixthemain_test.go
  18. 3
      tests/go/foreach_test.go
  19. 1
      tests/go/index_test.go
  20. 1
      tests/go/isprintable_test.go
  21. 6
      tests/go/issorted_test.go
  22. 1
      tests/go/listclear_test.go
  23. 1
      tests/go/listfind_test.go
  24. 1
      tests/go/listforeach_test.go
  25. 2
      tests/go/listforeachif_test.go
  26. 2
      tests/go/map_test.go
  27. 1
      tests/go/nbrconvertalpha_test.go
  28. 1
      tests/go/printnbrinorder_test.go
  29. 2
      tests/go/printwordstables_test.go
  30. 1
      tests/go/raid1a_test.go
  31. 1
      tests/go/rectangle_test.go
  32. 2
      tests/go/rotatevowels_test.go
  33. 1
      tests/go/solutions/addlinkednumbers/addlinkednumbers_test.go
  34. 1
      tests/go/solutions/addlinkednumbers/main.go
  35. 2
      tests/go/solutions/addprimesum/addprimesum_test.go
  36. 1
      tests/go/solutions/addprimesum/main.go
  37. 7
      tests/go/solutions/advancedsortwordarr.go
  38. 1
      tests/go/solutions/alphamirror/main.go
  39. 2
      tests/go/solutions/atoibase.go
  40. 3
      tests/go/solutions/atoibaseprog/main.go
  41. 1
      tests/go/solutions/atoiprog/main.go
  42. 1
      tests/go/solutions/balancedstring/balancedstring_test.go
  43. 1
      tests/go/solutions/brainfuck/brainfuck_test.go
  44. 1
      tests/go/solutions/btree.go
  45. 3
      tests/go/solutions/challenge.go
  46. 3
      tests/go/solutions/changeorder/changeorder_test.go
  47. 1
      tests/go/solutions/changeorder/main.go
  48. 1
      tests/go/solutions/chunk/main.go
  49. 1
      tests/go/solutions/compareprog/compareprog_test.go
  50. 1
      tests/go/solutions/costumeprofit/costumeprofit_test.go
  51. 1
      tests/go/solutions/countdown/main.go
  52. 2
      tests/go/solutions/countif.go
  53. 1
      tests/go/solutions/displayfile/main.go
  54. 1
      tests/go/solutions/doopprog/doopprog_test.go
  55. 1
      tests/go/solutions/doppelgangerprog/main.go
  56. 3
      tests/go/solutions/fib/fib_test.go
  57. 1
      tests/go/solutions/fib/main.go
  58. 1
      tests/go/solutions/findprevprime.go
  59. 3
      tests/go/solutions/findprevprimeprog/main.go
  60. 1
      tests/go/solutions/flags/main.go
  61. 1
      tests/go/solutions/foldint/main.go
  62. 6
      tests/go/solutions/foreach.go
  63. 3
      tests/go/solutions/foreachprog/foreachprog_test.go
  64. 7
      tests/go/solutions/foreachprog/main.go
  65. 1
      tests/go/solutions/fprime/main.go
  66. 2
      tests/go/solutions/game23/game23_test.go
  67. 1
      tests/go/solutions/gcd/gcd_test.go
  68. 2
      tests/go/solutions/gcd/main.go
  69. 1
      tests/go/solutions/grouping/grouping_test.go
  70. 1
      tests/go/solutions/halfcontestprog/halfcontestprog_test.go
  71. 1
      tests/go/solutions/halfcontestprog/main.go
  72. 4
      tests/go/solutions/hiddenp/hiddenp_test.go
  73. 2
      tests/go/solutions/hiddenp/main.go
  74. 1
      tests/go/solutions/inter/inter_test.go
  75. 2
      tests/go/solutions/inter/main.go
  76. 1
      tests/go/solutions/interestingnumber/interestingnumber_test.go
  77. 1
      tests/go/solutions/interestingnumber/main.go
  78. 1
      tests/go/solutions/inverttree/main.go
  79. 8
      tests/go/solutions/issorted.go
  80. 1
      tests/go/solutions/itoaprog/main.go
  81. 1
      tests/go/solutions/lcm/lcm_test.go
  82. 1
      tests/go/solutions/listclear.go
  83. 2
      tests/go/solutions/listmerge.go
  84. 1
      tests/go/solutions/listpushfront.go
  85. 1
      tests/go/solutions/listremoveifprog/main.go
  86. 1
      tests/go/solutions/listreverse.go
  87. 1
      tests/go/solutions/listsizeprog/main.go
  88. 1
      tests/go/solutions/listsort.go
  89. 2
      tests/go/solutions/map.go
  90. 1
      tests/go/solutions/maxprog/main.go
  91. 1
      tests/go/solutions/merge/main.go
  92. 1
      tests/go/solutions/nauuo/main.go
  93. 3
      tests/go/solutions/nauuo/nauuo_test.go
  94. 1
      tests/go/solutions/nbrconvertalpha/main.go
  95. 1
      tests/go/solutions/nenokku/nenokku_test.go
  96. 1
      tests/go/solutions/printmemory/main.go
  97. 1
      tests/go/solutions/printmemory/printmemory_test.go
  98. 1
      tests/go/solutions/printnbrbase.go
  99. 4
      tests/go/solutions/printrevcombprog/main.go
  100. 1
      tests/go/solutions/priorprime/main.go
  101. Some files were not shown because too many files changed in this diff diff.show_more

1
tests/go/activebits_test.go

@ -18,5 +18,4 @@ func TestActiveBits(t *testing.T) {
for _, v := range args {
z01.Challenge(t, student.ActiveBits, solutions.ActiveBits, v)
}
}

1
tests/go/advancedsortwordarr_test.go

@ -40,5 +40,4 @@ func TestAdvancedSortWordArr(t *testing.T) {
)
}
}
}

1
tests/go/alphacount_test.go

@ -25,6 +25,5 @@ func TestAlphaCount(t *testing.T) {
for i := 0; i < len(arr); i++ {
z01.Challenge(t, student.AlphaCount, solutions.AlphaCount, arr[i])
}
}

8
tests/go/any_test.go

@ -19,42 +19,34 @@ func TestAny(t *testing.T) {
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)
}
for i := 0; i < 5; i++ {
val := node{
f: solutions.IsNumeric,
arr: z01.MultRandDigit(),
}
table = append(table, val)
}
for i := 0; i < 5; i++ {
val := node{
f: solutions.IsLower,
arr: z01.MultRandLower(),
}
table = append(table, val)
}
for i := 0; i < 5; i++ {
val := node{
f: solutions.IsUpper,
arr: z01.MultRandUpper(),
}
table = append(table, val)
}
table = append(table,

3
tests/go/appendrange_test.go

@ -10,7 +10,6 @@ import (
)
func TestAppendRange(t *testing.T) {
type node struct {
min int
max int
@ -20,7 +19,6 @@ func TestAppendRange(t *testing.T) {
//15 random pairs of ints for a Valid Range
for i := 0; i < 15; i++ {
minVal := z01.RandIntBetween(-10000000, 1000000)
gap := z01.RandIntBetween(1, 20)
val := node{
@ -31,7 +29,6 @@ func TestAppendRange(t *testing.T) {
}
//15 random pairs of ints with ||invalid range||
for i := 0; i < 15; i++ {
minVal := z01.RandIntBetween(-10000000, 1000000)
gap := z01.RandIntBetween(1, 20)
val := node{

1
tests/go/boolean_test.go

@ -8,7 +8,6 @@ import (
)
func TestBoolean(t *testing.T) {
table := append(z01.MultRandWords(), "1 2 3 4 5")
for _, s := range table {

1
tests/go/btreedeletenode_test.go

@ -97,7 +97,6 @@ func CompareTrees_delete(t *testing.T, fn interface{}, deleted string, rootOr, r
if !student.BTreeIsBinary(rootS) || sel != nil {
errorMessage_delete(t, fn, deleted, rootOr, root, rootS)
}
}
func TestBTreeDeleteNode(t *testing.T) {

1
tests/go/btreeinsertdata_test.go

@ -125,5 +125,4 @@ func TestBTreeInsertData(t *testing.T) {
rootS = student.BTreeInsertData(rootS, arg)
CompareTrees_insert(t, fn, arg, root, rootS)
}
}

2
tests/go/btreesearchitem_test.go

@ -24,7 +24,6 @@ func errorMessage_search(t *testing.T, fn interface{}, root, a *solutions.TreeNo
func CompareNode_search(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode,
seaVal string) {
if a == nil && b == nil {
return
}
@ -87,5 +86,4 @@ func TestBTreeSearchItem(t *testing.T) {
selectedStu := student.BTreeSearchItem(rootS, v)
CompareNode_search(t, fn, root, selectedSol, selectedStu, v)
}
}

1
tests/go/cat_test.go

@ -29,7 +29,6 @@ func execC(name string, args ...string) (string, error) {
}
func TestCat(t *testing.T) {
var table []string
pathFileName := "./student/cat/quest8.txt"
pathFileName2 := "./student/cat/quest8T.txt"

1
tests/go/compare_test.go

@ -38,7 +38,6 @@ func TestCompare(t *testing.T) {
toCompare: wrongMatch,
}
table = append(table, val)
}
// those are the test values from the README examples
table = append(table,

1
tests/go/concatparams_test.go

@ -10,7 +10,6 @@ import (
)
func TestConcatParams(t *testing.T) {
table := [][]string{}
//30 random slice of strings

1
tests/go/convertbase_test.go

@ -10,7 +10,6 @@ import (
)
func TestConvertBase(t *testing.T) {
type node struct {
nbr string
baseFrom string

8
tests/go/countif_test.go

@ -20,42 +20,34 @@ func TestCountIf(t *testing.T) {
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)
}
for i := 0; i < 5; i++ {
val := node{
f: solutions.IsNumeric,
arr: z01.MultRandDigit(),
}
table = append(table, val)
}
for i := 0; i < 5; i++ {
val := node{
f: solutions.IsLower,
arr: z01.MultRandLower(),
}
table = append(table, val)
}
for i := 0; i < 5; i++ {
val := node{
f: solutions.IsUpper,
arr: z01.MultRandUpper(),
}
table = append(table, val)
}
table = append(table,

1
tests/go/displayfile_test.go

@ -9,7 +9,6 @@ import (
)
func TestDisplayfile(t *testing.T) {
var table []string
pathFileName := "./student/displayfile/quest8.txt"

1
tests/go/doop_test.go

@ -10,7 +10,6 @@ import (
)
func TestDoop(t *testing.T) {
operatorsTable := []string{"+", "-", "*", "/", "%"}
table := []string{}

1
tests/go/fixthemain_test.go

@ -7,6 +7,5 @@ import (
)
func TestFixthemain(t *testing.T) {
z01.ChallengeMain(t)
}

3
tests/go/foreach_test.go

@ -10,7 +10,6 @@ import (
)
func TestForEach(t *testing.T) {
functionsArray := []func(int){solutions.Add0, solutions.Add1, solutions.Add2, solutions.Add3}
type node struct {
@ -23,14 +22,12 @@ func TestForEach(t *testing.T) {
//15 random slice of random ints with a random function from selection
for i := 0; i < 15; i++ {
functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)]
val := node{
f: functionSelected,
arr: z01.MultRandIntBetween(-1000000, 1000000),
}
table = append(table, val)
}
table = append(table, node{

1
tests/go/index_test.go

@ -40,7 +40,6 @@ func TestIndex(t *testing.T) {
toFind: wrongMatch,
}
table = append(table, val)
}
// those are the test values from the README examples
table = append(table,

1
tests/go/isprintable_test.go

@ -23,7 +23,6 @@ func TestIsPrintable(t *testing.T) {
r[i] = letters[rand.Intn(len(letters))]
}
table = append(table, string(r))
}
// Special cases added to table

6
tests/go/issorted_test.go

@ -22,19 +22,16 @@ func TestIsSorted(t *testing.T) {
//5 unordered slices
for i := 0; i < 5; i++ {
functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)]
val := node{
f: functionSelected,
arr: z01.MultRandIntBetween(-1000000, 1000000),
}
table = append(table, val)
}
//5 slices ordered in ascending order
for i := 0; i < 5; i++ {
functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)]
orderedArr := z01.MultRandIntBetween(-1000000, 1000000)
sort.Ints(orderedArr)
@ -44,12 +41,10 @@ func TestIsSorted(t *testing.T) {
arr: orderedArr,
}
table = append(table, val)
}
//5 slices ordered in descending order
for i := 0; i < 5; i++ {
functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)]
reverseArr := z01.MultRandIntBetween(-1000000, 1000000)
sort.Sort(sort.Reverse(sort.IntSlice(reverseArr)))
@ -58,7 +53,6 @@ func TestIsSorted(t *testing.T) {
arr: reverseArr,
}
table = append(table, val)
}
table = append(table, node{

1
tests/go/listclear_test.go

@ -69,7 +69,6 @@ func TestListClear(t *testing.T) {
)
for _, arg := range table {
for i := 0; i < len(arg.Data); i++ {
listPushBackTest4(link2, link, arg.Data[i])
}

1
tests/go/listfind_test.go

@ -77,5 +77,4 @@ func TestListFind(t *testing.T) {
t.Fatalf("ListFind(ref: lksdf) == %s instead of %s\n", *aux, *aux1)
}
}
}

1
tests/go/listforeach_test.go

@ -82,7 +82,6 @@ func TestListForEach(t *testing.T) {
},
)
for _, arg := range table {
for i := 0; i < len(arg.Data); i++ {
listPushBackTest7(link2, link, arg.Data[i])
}

2
tests/go/listforeachif_test.go

@ -57,7 +57,6 @@ func listToStringStu7(l *ListS8) string {
}
func listPushBackTest8(l *ListS8, l1 *List8, data interface{}) {
n := &Node8{Data: data}
n1 := &NodeS8{Data: data}
@ -119,7 +118,6 @@ func TestListForEachIf(t *testing.T) {
Data: solution.ConvertIntToInterface(z01.MultRandInt()),
}
table = append(table, val)
}
// just strings
for i := 0; i < 3; i++ {

2
tests/go/map_test.go

@ -20,14 +20,12 @@ func TestMap(t *testing.T) {
table := []node{}
for i := 0; i < 15; i++ {
functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)]
val := node{
f: functionSelected,
arr: z01.MultRandIntBetween(-1000000, 1000000),
}
table = append(table, val)
}
table = append(table, node{

1
tests/go/nbrconvertalpha_test.go

@ -9,7 +9,6 @@ import (
)
func TestNbrConvertAlpha(t *testing.T) {
type node struct {
array []string
}

1
tests/go/printnbrinorder_test.go

@ -19,5 +19,4 @@ func TestPrintNbrInOrder(t *testing.T) {
for _, arg := range table {
z01.Challenge(t, student.PrintNbrInOrder, solutions.PrintNbrInOrder, arg)
}
}

2
tests/go/printwordstables_test.go

@ -11,12 +11,10 @@ import (
)
func TestPrintWordsTables(t *testing.T) {
table := [][]string{}
//30 random slice of slice of strings
for i := 0; i < 30; i++ {
val := solutions.SplitWhiteSpaces(strings.Join(z01.MultRandASCII(), " "))
table = append(table, val)
}

1
tests/go/raid1a_test.go

@ -9,7 +9,6 @@ import (
)
func TestRaid1a(t *testing.T) {
// testing examples of subjects
table := []int{
5, 3,

1
tests/go/rectangle_test.go

@ -7,6 +7,5 @@ import (
)
func TestRectangle(t *testing.T) {
z01.ChallengeMain(t, "")
}

2
tests/go/rotatevowels_test.go

@ -8,7 +8,6 @@ import (
)
func TestRotateVowels(t *testing.T) {
Lower := z01.RuneRange('a', 'z')
Upper := z01.RuneRange('A', 'Z')
letters := Lower + Upper + " "
@ -28,5 +27,4 @@ func TestRotateVowels(t *testing.T) {
z01.ChallengeMain(t, "happy thoughts", "good luck")
z01.ChallengeMain(t, "al's elEphAnt is overly underweight!")
z01.ChallengeMain(t, "aEi", "Ou")
}

1
tests/go/solutions/addlinkednumbers/addlinkednumbers_test.go

@ -84,7 +84,6 @@ func solNodeString(node *solNode) string {
func compareNodes(t *testing.T, stuResult *stuNode, solResult *solNode, num1, num2 int) {
if stuResult == nil && solResult == nil {
} else if stuResult != nil && solResult == nil {
stuNum := stuNodeString(stuResult)
t.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n",

1
tests/go/solutions/addlinkednumbers/main.go

@ -36,5 +36,4 @@ func AddLinkedNumbers(num1, num2 *NodeAddL) *NodeAddL {
}
func main() {
}

2
tests/go/solutions/addprimesum/addprimesum_test.go

@ -14,7 +14,6 @@ func isAPrime(nb int) bool {
}
if nb <= 3 {
return true
} else if nb%2 == 0 || nb%3 == 0 {
return false
}
@ -30,7 +29,6 @@ func isAPrime(nb int) bool {
}
func TestAddPrimeSum(t *testing.T) {
var table []string
// fill with all rpime numbers between 0 and 100

1
tests/go/solutions/addprimesum/main.go

@ -14,7 +14,6 @@ func isPrime(nb int) bool {
}
if nb <= 3 {
return true
} else if nb%2 == 0 || nb%3 == 0 {
return false
}

7
tests/go/solutions/advancedsortwordarr.go

@ -4,11 +4,10 @@ func CompArray(a, b string) int {
if a < b {
return -1
}
if a == b {
return 0
} else {
if a > b {
return 1
}
return 0
}
func AdvancedSortWordArr(array []string, f func(a, b string) int) {
@ -17,7 +16,5 @@ func AdvancedSortWordArr(array []string, f func(a, b string) int) {
array[i], array[i-1] = array[i-1], array[i]
i = 0
}
}
}

1
tests/go/solutions/alphamirror/main.go

@ -6,7 +6,6 @@ import (
)
func main() {
if len(os.Args) == 2 {
arg := []rune(os.Args[1])
for i, ch := range arg {

2
tests/go/solutions/atoibase.go

@ -22,7 +22,6 @@ func UniqueChar(s string) bool {
if InStr(r[i], s[i+1:n]) {
return false
}
}
return true
}
@ -48,7 +47,6 @@ func Power(nbr int, pwr int) int {
return nbr
}
return nbr * Power(nbr, pwr-1)
}
func AtoiBase(s string, base string) int {

3
tests/go/solutions/atoibaseprog/main.go

@ -20,7 +20,6 @@ func UniqueChar(s string) bool {
if InStr(r[i], s[i+1:n]) {
return false
}
}
return true
}
@ -46,7 +45,6 @@ func Power(nbr int, pwr int) int {
return nbr
}
return nbr * Power(nbr, pwr-1)
}
func Index(s string, toFind string) int {
@ -79,5 +77,4 @@ func AtoiBase(s string, base string) int {
}
func main() {
}

1
tests/go/solutions/atoiprog/main.go

@ -10,5 +10,4 @@ func Atoi(s string) int {
}
func main() {
}

1
tests/go/solutions/balancedstring/balancedstring_test.go

@ -7,7 +7,6 @@ import (
)
func TestBalancedString(t *testing.T) {
// Declaration of an empty array of type string
table := []string{}

1
tests/go/solutions/brainfuck/brainfuck_test.go

@ -8,7 +8,6 @@ import (
)
func TestBrainFuck(t *testing.T) {
// individual tests 1)Hello World! 2)Hi 3)abc 4)ABC
args := []string{"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.",

1
tests/go/solutions/btree.go

@ -193,7 +193,6 @@ func BTreeRotateLeft(node *TreeNode) *TreeNode {
//Returns the maximum node in the subtree started by root
func BTreeMax(root *TreeNode) *TreeNode {
if root == nil || root.Right == nil {
return root
}

3
tests/go/solutions/challenge.go

@ -86,7 +86,6 @@ func ChallengeTree(t *testing.T,
fn1, fn2 interface{},
arg1 *TreeNode, arg2 interface{},
args ...interface{}) {
args1 := []interface{}{arg1}
args2 := []interface{}{arg2}
@ -107,7 +106,6 @@ func ChallengeTree(t *testing.T,
z01.Format(st1.Stdout),
)
}
}
func Challenge(t *testing.T, fn1, fn2 interface{}, arg1, arg2 interface{}, args ...interface{}) {
@ -131,7 +129,6 @@ func Challenge(t *testing.T, fn1, fn2 interface{}, arg1, arg2 interface{}, args
z01.Format(st1.Stdout),
)
}
}
func PrintList(n *NodeI) string {

3
tests/go/solutions/changeorder/changeorder_test.go

@ -93,7 +93,6 @@ func compareNodes(t *testing.T, stuResult *stuNode, solResult *solNode, num1 int
}
func TestChangeorder(t *testing.T) {
// Declaration of the node that is going to take the group of arguments that are going to
// inputed during each iteration of a Challenge between the student and the staff solution.
// (note: a node is not always necessary but in this case it makes the writing of the test easier)
@ -129,7 +128,6 @@ func TestChangeorder(t *testing.T) {
//Once the random node created, this iteration is added to the earlier declared table
//along with the 4 specific examples taken from the examples of the readme.
table = append(table, value)
}
//The table with 4 specific exercises and 15 randoms is now ready to be "challenged"
@ -162,5 +160,4 @@ func TestChangeorder(t *testing.T) {
// When both are satisfied with the coherence between the subject and its tests. The code can be commited
// and redeployed by the team-01.
// We then advised the staff team to test the new exercise invidually with their current build of the exam
}

1
tests/go/solutions/changeorder/main.go

@ -60,5 +60,4 @@ func Changeorder(node *NodeAddL) *NodeAddL {
}
func main() {
}

1
tests/go/solutions/chunk/main.go

@ -20,5 +20,4 @@ func Chunk(slice []int, size int) {
}
func main() {
}

1
tests/go/solutions/compareprog/compareprog_test.go

@ -35,7 +35,6 @@ func TestCompareProg(t *testing.T) {
toCompare: wrongMatch,
}
table = append(table, val)
}
// those are the test values from the README examples
table = append(table,

1
tests/go/solutions/costumeprofit/costumeprofit_test.go

@ -12,7 +12,6 @@ type node struct {
}
func TestCostumeProfit(t *testing.T) {
table := []node{}
for i := 0; i < 25; i++ {

1
tests/go/solutions/countdown/main.go

@ -5,7 +5,6 @@ import "fmt"
func main() {
count := 9
for count != -1 {
fmt.Print(count)
count--
}

2
tests/go/solutions/countif.go

@ -1,7 +1,6 @@
package solutions
func CountIf(f func(string) bool, arr []string) int {
counter := 0
for _, el := range arr {
if f(el) {
@ -10,5 +9,4 @@ func CountIf(f func(string) bool, arr []string) int {
}
return counter
}

1
tests/go/solutions/displayfile/main.go

@ -7,7 +7,6 @@ import (
)
func main() {
if len(os.Args) < 2 {
fmt.Println("File name missing")
return

1
tests/go/solutions/doopprog/doopprog_test.go

@ -10,7 +10,6 @@ import (
)
func TestDoopProg(t *testing.T) {
operatorsTable := []string{"+", "-", "*", "/", "%"}
table := []string{}

1
tests/go/solutions/doppelgangerprog/main.go

@ -12,5 +12,4 @@ func DoppelGanger(big, little string) int {
}
func main() {
}

3
tests/go/solutions/fib/fib_test.go

@ -9,7 +9,6 @@ import (
)
func TestFib(t *testing.T) {
// Declaration of the node that is going to take the group of arguments that are going to
// inputed during each iteration of a Challenge between the student and the staff solution.
// (note: a node is not always necessary but in this case it makes the writing of the test easier)
@ -48,7 +47,6 @@ func TestFib(t *testing.T) {
//Once the random node created, this iteration is added to the earlier declared table
//along with the 4 specific examples taken from the examples of the readme.
table = append(table, value)
}
//The table with 4 specific exercises and 15 randoms is now ready to be "challenged"
@ -78,5 +76,4 @@ func TestFib(t *testing.T) {
// When both are satisfied with the coherence between the subject and its tests. The code can be commited
// and redeployed by the team-01.
// We then advised the staff team to test the new exercise invidually with their current build of the exam
}

1
tests/go/solutions/fib/main.go

@ -33,5 +33,4 @@ func Fib(n int) int {
}
func main() {
}

1
tests/go/solutions/findprevprime.go

@ -8,5 +8,4 @@ func FindPrevPrime(nbr int) int {
return nbr
}
return FindPrevPrime(nbr - 1)
}

3
tests/go/solutions/findprevprimeprog/main.go

@ -1,7 +1,6 @@
package main
func main() {
}
func FindPrevPrime(nbr int) int {
@ -12,11 +11,9 @@ func FindPrevPrime(nbr int) int {
return nbr
}
return FindPrevPrime(nbr - 1)
}
func IsPrime(nb int) bool {
if nb <= 0 || nb == 1 {
return false
}

1
tests/go/solutions/flags/main.go

@ -59,7 +59,6 @@ func main() {
fmt.Println(" ", v.shortenFlag)
fmt.Println(" ", v.handler)
}
} else if size <= 4 {
var str []rune
strToInsert := ""

1
tests/go/solutions/foldint/main.go

@ -10,5 +10,4 @@ func FoldInt(f func(int, int) int, arr []int, n int) {
fmt.Println(result)
}
func main() {
}

6
tests/go/solutions/foreach.go

@ -5,29 +5,23 @@ import (
)
func ForEach(f func(int), arr []int) {
for _, el := range arr {
f(el)
}
}
func Add0(nbr int) {
fmt.Println(nbr)
}
func Add1(nbr int) {
fmt.Println(nbr + 1)
}
func Add2(nbr int) {
fmt.Println(nbr + 2)
}
func Add3(nbr int) {
fmt.Println(nbr + 3)
}

3
tests/go/solutions/foreachprog/foreachprog_test.go

@ -9,7 +9,6 @@ import (
)
func TestForEachProg(t *testing.T) {
functionsArray := []func(int){solutions.Add0, solutions.Add1, solutions.Add2, solutions.Add3}
type node struct {
@ -22,14 +21,12 @@ func TestForEachProg(t *testing.T) {
//15 random slice of random ints with a random function from selection
for i := 0; i < 15; i++ {
functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)]
val := node{
f: functionSelected,
arr: z01.MultRandIntBetween(-1000000, 1000000),
}
table = append(table, val)
}
table = append(table, node{

7
tests/go/solutions/foreachprog/main.go

@ -5,33 +5,26 @@ import (
)
func ForEach(f func(int), arr []int) {
for _, el := range arr {
f(el)
}
}
func Add0(nbr int) {
fmt.Println(nbr)
}
func Add1(nbr int) {
fmt.Println(nbr + 1)
}
func Add2(nbr int) {
fmt.Println(nbr + 2)
}
func Add3(nbr int) {
fmt.Println(nbr + 3)
}
func main() {
}

1
tests/go/solutions/fprime/main.go

@ -35,5 +35,4 @@ func main() {
par, _ := strconv.Atoi(os.Args[1])
fprime(par)
}
}

2
tests/go/solutions/game23/game23_test.go

@ -26,7 +26,6 @@ func nd(a, b int) int {
}
func TestGame23(t *testing.T) {
// Declaration of the node that is going to take the group of arguments that are going to
// inputed during each iteration of a Challenge between the student and the staff solution.
// (note: a node is not always necessary but in this case it makes the writing of the test easier)
@ -117,5 +116,4 @@ func TestGame23(t *testing.T) {
// When both are satisfied with the coherence between the subject and its tests. The code can be commited
// and redeployed by the team-01.
// We then advised the staff team to test the new exercise invidually with their current build of the exam
}

1
tests/go/solutions/gcd/gcd_test.go

@ -16,7 +16,6 @@ func TestGCD(t *testing.T) {
args := [][]string{arg1, arg2, arg3, arg4, arg5}
for i := 0; i < 25; i++ {
number1 := strconv.Itoa(z01.RandIntBetween(1, 100000))
number2 := strconv.Itoa(z01.RandIntBetween(1, 100))
args = append(args, []string{number1, number2})

2
tests/go/solutions/gcd/main.go

@ -8,7 +8,6 @@ import (
//Greatest common divisor
func gcd(num1, num2 uint) uint {
for i := num1; i > 0; i-- {
if num1%i == 0 && num2%i == 0 {
return i
@ -29,5 +28,4 @@ func main() {
v2, _ := strconv.Atoi(os.Args[2])
fmt.Println(gcd(uint(v1), uint(v2)))
}

1
tests/go/solutions/grouping/grouping_test.go

@ -7,7 +7,6 @@ import (
)
func TestGrouping(t *testing.T) {
type args struct {
first string
second string

1
tests/go/solutions/halfcontestprog/halfcontestprog_test.go

@ -50,5 +50,4 @@ func TestHalf_contest(t *testing.T) {
for _, arg := range table {
z01.Challenge(t, Halfcontest, solutions.Halfcontest, arg.h1, arg.m1, arg.h2, arg.m2)
}
}

1
tests/go/solutions/halfcontestprog/main.go

@ -10,5 +10,4 @@ func Halfcontest(h1, m1, h2, m2 int) int {
}
func main() {
}

4
tests/go/solutions/hiddenp/hiddenp_test.go

@ -22,7 +22,6 @@ func TestHiddenP(t *testing.T) {
args = append(args, extraArg)
args = append(args, extraArg2)
}
for i := 0; i < 10; i++ {
randomLowerLetter := z01.RandStr(2, z01.RuneRange('a', 'z'))
@ -32,10 +31,8 @@ func TestHiddenP(t *testing.T) {
args = append(args, extraArg)
args = append(args, extraArg2)
}
for i := 0; i < 10; i++ {
randomLowerLetter := z01.RandStr(1, z01.RuneRange('a', 'z'))
randomUpperLetter := z01.RandStr(1, z01.RuneRange('A', 'Z'))
extraArg := []string{randomLowerLetter, z01.RandLower()}
@ -43,7 +40,6 @@ func TestHiddenP(t *testing.T) {
args = append(args, extraArg)
args = append(args, extraArg2)
}
for _, v := range args {

2
tests/go/solutions/hiddenp/main.go

@ -49,10 +49,8 @@ func main() {
if count == len(first) {
z01.PrintRune('1')
} else {
z01.PrintRune('0')
}
z01.PrintRune('\n')
}

1
tests/go/solutions/inter/inter_test.go

@ -23,7 +23,6 @@ func TestInter(t *testing.T) {
table = append(table, strings.Join([]string{str1, str2}, " "))
table = append(table, strings.Join([]string{z01.RandAlnum(), z01.RandAlnum()}, " "))
}
for _, s := range table {

2
tests/go/solutions/inter/main.go

@ -7,7 +7,6 @@ import (
)
func result(str1 string, str2 string) string {
arraystr1 := []rune(str1)
arraystr2 := []rune(str2)
sizeStr1 := len(arraystr1)
@ -25,7 +24,6 @@ func result(str1 string, str2 string) string {
}
func main() {
if len(os.Args) == 3 {
fmt.Println(result(os.Args[1], os.Args[2]))
} else {

1
tests/go/solutions/interestingnumber/interestingnumber_test.go

@ -34,7 +34,6 @@ func TestInterestingNumber(t *testing.T) {
//Once the random node created, this iteration is added to the earlier declared table
//along with the 4 specific examples taken from the examples of the readme.
table = append(table, value)
}
for _, arg := range table {

1
tests/go/solutions/interestingnumber/main.go

@ -23,5 +23,4 @@ func InterestingNumber(n int) int {
}
func main() {
}

1
tests/go/solutions/inverttree/main.go

@ -23,5 +23,4 @@ func InvertTree(root *TNode) *TNode {
}
func main() {
}

8
tests/go/solutions/issorted.go

@ -5,9 +5,8 @@ func IsSortedBy1(a, b int) int {
return -1
} else if a-b > 0 {
return 1
} else {
return 0
}
return 0
}
func IsSortedBy10(a, b int) int {
@ -15,9 +14,8 @@ func IsSortedBy10(a, b int) int {
return -10
} else if a-b > 0 {
return 10
} else {
return 0
}
return 0
}
func IsSortedByDiff(a, b int) int {
@ -25,7 +23,6 @@ func IsSortedByDiff(a, b int) int {
}
func IsSorted(f func(int, int) int, arr []int) bool {
ascendingOrdered := true
descendingOrdered := true
@ -42,5 +39,4 @@ func IsSorted(f func(int, int) int, arr []int) bool {
}
return ascendingOrdered || descendingOrdered
}

1
tests/go/solutions/itoaprog/main.go

@ -9,5 +9,4 @@ func Itoa(v int) string {
}
func main() {
}

1
tests/go/solutions/lcm/lcm_test.go

@ -9,7 +9,6 @@ import (
)
func TestLcm(t *testing.T) {
type node struct {
first int
second int

1
tests/go/solutions/listclear.go

@ -2,7 +2,6 @@ package solutions
//cleans the list
func ListClear(l *List) {
temp := l.Head
next := l.Head
for temp != nil {

2
tests/go/solutions/listmerge.go

@ -2,11 +2,9 @@ package solutions
//merges the 2 lists in one(in the end of the first list)
func ListMerge(l1 *List, l2 *List) {
if l1.Head == nil {
l1.Head, l1.Tail = l2.Head, l2.Tail
return
}
l1.Tail.Next = l2.Head
}

1
tests/go/solutions/listpushfront.go

@ -2,7 +2,6 @@ package solutions
//inserts node on the first position of the list
func ListPushFront(l *List, data interface{}) {
n := &NodeL{Data: data}
if l.Head == nil {

1
tests/go/solutions/listremoveifprog/main.go

@ -30,5 +30,4 @@ func ListRemoveIf(l *List, data_ref interface{}) {
}
func main() {
}

1
tests/go/solutions/listreverse.go

@ -2,7 +2,6 @@ package solutions
//reverses the list
func ListReverse(l *List) {
current := l.Head
prev := l.Head
prev = nil

1
tests/go/solutions/listsizeprog/main.go

@ -22,5 +22,4 @@ func ListSize(l *List) int {
}
func main() {
}

1
tests/go/solutions/listsort.go

@ -1,7 +1,6 @@
package solutions
func ListSort(l *NodeI) *NodeI {
Head := l
if Head == nil {
return nil

2
tests/go/solutions/map.go

@ -9,7 +9,6 @@ func IsNegative0(value int) bool {
}
func Map(f func(int) bool, arr []int) []bool {
arrBool := make([]bool, len(arr))
for i, el := range arr {
@ -17,5 +16,4 @@ func Map(f func(int) bool, arr []int) []bool {
}
return arrBool
}

1
tests/go/solutions/maxprog/main.go

@ -10,5 +10,4 @@ func Max(arr []int) int {
}
func main() {
}

1
tests/go/solutions/merge/main.go

@ -20,5 +20,4 @@ func MergeTrees(t1 *TreeNodeM, t2 *TreeNodeM) *TreeNodeM {
}
func main() {
}

1
tests/go/solutions/nauuo/main.go

@ -34,5 +34,4 @@ func Nauuo(plus, minus, rand int) string {
}
func main() {
}

3
tests/go/solutions/nauuo/nauuo_test.go

@ -9,7 +9,6 @@ import (
)
func TestNauuo(t *testing.T) {
// Declaration of the node that is going to take the group of arguments that are going to
// inputed during each iteration of a Challenge between the student and the staff solution.
// (note: a node is not always necessary but in this case it makes the writing of the test easier)
@ -52,7 +51,6 @@ func TestNauuo(t *testing.T) {
//Once the random node created, this iteration is added to the earlier declared table
//along with the 4 specific examples taken from the examples of the readme.
table = append(table, value)
}
//The table with 4 specific exercises and 15 randoms is now ready to be "challenged"
@ -82,5 +80,4 @@ func TestNauuo(t *testing.T) {
// When both are satisfied with the coherence between the subject and its tests. The code can be commited
// and redeployed by the team-01.
// We then advised the staff team to test the new exercise invidually with their current build of the exam
}

1
tests/go/solutions/nbrconvertalpha/main.go

@ -8,7 +8,6 @@ import (
)
func IsNumeric(str string) bool {
for i := 0; i < len(str); i++ {
if !(str[i] >= '0' && str[i] <= '9') {
return false

1
tests/go/solutions/nenokku/nenokku_test.go

@ -11,7 +11,6 @@ type node struct {
}
func TestNenokku(t *testing.T) {
table := []node{}
table = append(table,

1
tests/go/solutions/printmemory/main.go

@ -86,5 +86,4 @@ func PrintMemory(arr [10]int) {
}
func main() {
}

1
tests/go/solutions/printmemory/printmemory_test.go

@ -19,5 +19,4 @@ func TestPrintMemory(t *testing.T) {
}
table2 := [10]int{104, 101, 108, 108, 111, 16, 21, 42}
z01.Challenge(t, PrintMemory, solutions.PrintMemory, table2)
}

1
tests/go/solutions/printnbrbase.go

@ -19,7 +19,6 @@ func PrintNbrBase(n int, base string) {
PrintNbrBase(sign*(n/length), base)
z01.PrintRune(rbase[sign*(n%length)])
}
} else {
z01.PrintRune('N')
z01.PrintRune('V')

4
tests/go/solutions/printrevcombprog/main.go

@ -3,23 +3,19 @@ package main
import "fmt"
func main() {
for a := 9; a >= 2; {
for b := a - 1; b >= 1; {
for c := b - 1; c >= 0; {
if a > b && b > c && (a+b+c) != 3 {
fmt.Printf("%d%d%d, ", a, b, c)
}
if (a + b + c) == 3 {
fmt.Printf("%d%d%d\n", a, b, c)
}
c--
}
b--
}
a--
}
}

1
tests/go/solutions/priorprime/main.go

@ -24,5 +24,4 @@ func Priorprime(x int) int {
}
func main() {
}

Some files were not shown because too many files changed in this diff diff.show_more

Loading…
Cancel
Save