Browse Source

Overwrite file

content-update
Xavier Petit 4 years ago committed by xpetit
parent
commit
2f0becd572
  1. 16
      tests/go/solutions/atoibaseprog/test_atoibaseprog.go
  2. 50
      tests/go/test_atoibaseprog.go

16
tests/go/solutions/atoibaseprog/test_atoibaseprog.go

@ -1,11 +1,9 @@
package main
import (
"github.com/01-edu/z01"
"./base"
correct "./correct"
"github.com/01-edu/z01"
)
// this is the function that creates the TESTS
@ -17,8 +15,8 @@ func main() {
table := []node{}
// 15 random pairs of string numbers with valid bases
for i := 0; i < 15; i++ {
// 5 random pairs of string numbers with valid bases
for i := 0; i < 5; i++ {
validBaseToInput := base.Valid()
val := node{
s: base.StringFrom(validBaseToInput),
@ -26,8 +24,8 @@ func main() {
}
table = append(table, val)
}
// 15 random pairs of string numbers with invalid bases
for i := 0; i < 15; i++ {
// 5 random pairs of string numbers with invalid bases
for i := 0; i < 5; i++ {
invalidBaseToInput := base.Invalid()
val := node{
s: "thisinputshouldnotmatter",
@ -43,8 +41,10 @@ func main() {
node{s: "bbbbbab", base: "-ab"},
)
for _, arg := range table {
z01.Challenge("AtoiBaseProg", AtoiBase, correct.AtoiBase, arg.s, arg.base)
z01.ChallengeMain("atoibaseprog", arg.s, arg.base)
}
z01.ChallengeMain("atoibaseprog")
z01.ChallengeMain("atoibaseprog", "125", "0123456789", "something")
}
// TODO: fix base exercises

50
tests/go/test_atoibaseprog.go

@ -1,50 +0,0 @@
package main
import (
"./base"
"github.com/01-edu/z01"
)
// this is the function that creates the TESTS
func main() {
type node struct {
s string
base string
}
table := []node{}
// 5 random pairs of string numbers with valid bases
for i := 0; i < 5; i++ {
validBaseToInput := base.Valid()
val := node{
s: base.StringFrom(validBaseToInput),
base: validBaseToInput,
}
table = append(table, val)
}
// 5 random pairs of string numbers with invalid bases
for i := 0; i < 5; i++ {
invalidBaseToInput := base.Invalid()
val := node{
s: "thisinputshouldnotmatter",
base: invalidBaseToInput,
}
table = append(table, val)
}
table = append(table,
node{s: "125", base: "0123456789"},
node{s: "1111101", base: "01"},
node{s: "7D", base: "0123456789ABCDEF"},
node{s: "uoi", base: "choumi"},
node{s: "bbbbbab", base: "-ab"},
)
for _, arg := range table {
z01.ChallengeMain("atoibaseprog", arg.s, arg.base)
}
z01.ChallengeMain("atoibaseprog")
z01.ChallengeMain("atoibaseprog", "125", "0123456789", "something")
}
// TODO: fix base exercises
Loading…
Cancel
Save