mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.0 KiB
51 lines
1.0 KiB
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/01-edu/z01"
|
||
|
|
||
5 years ago
|
"./base"
|
||
|
|
||
5 years ago
|
solutions "../../solutions"
|
||
|
)
|
||
|
|
||
|
// this is the function that creates the TESTS
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
type node struct {
|
||
|
s string
|
||
|
base string
|
||
|
}
|
||
|
|
||
|
table := []node{}
|
||
|
|
||
|
// 15 random pairs of string numbers with valid bases
|
||
|
for i := 0; i < 15; i++ {
|
||
5 years ago
|
validBaseToInput := base.Valid()
|
||
5 years ago
|
val := node{
|
||
5 years ago
|
s: base.StringFrom(validBaseToInput),
|
||
5 years ago
|
base: validBaseToInput,
|
||
|
}
|
||
|
table = append(table, val)
|
||
|
}
|
||
|
// 15 random pairs of string numbers with invalid bases
|
||
|
for i := 0; i < 15; i++ {
|
||
5 years ago
|
invalidBaseToInput := base.Invalid()
|
||
5 years ago
|
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 {
|
||
5 years ago
|
z01.Challenge("AtoiBaseProg", AtoiBase, solutions.AtoiBase, arg.s, arg.base)
|
||
5 years ago
|
}
|
||
|
}
|
||
5 years ago
|
|
||
|
// TODO: fix base exercises
|