Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
unixpickle
GitHub Repository: unixpickle/kahoot-hack
Path: blob/master/kahoot/eval_test.go
10110 views
1
package kahoot
2
3
import "testing"
4
5
func TestEval(t *testing.T) {
6
exprs := map[string]int64{
7
"(23 + 64 + 35 * 35)": 1312,
8
"88 * 94 * 9 * 48": 3573504,
9
"59 * 93 * (89 *\t 9) * 60 * (4 + 47)": 13448966220,
10
"(7 + 80 + ((23 * 35) + 32))": 924,
11
"(58 + 8 + ((72 * 46) + 56 * 13 + 49))": 4155,
12
}
13
for expr, expected := range exprs {
14
actual, err := eval(expr)
15
if err != nil {
16
t.Error(expr+": ", err)
17
} else if actual != expected {
18
t.Errorf("%s: expected %d got %d", expr, expected, actual)
19
}
20
}
21
}
22
23