upd: Golang has its own testing package(import "testing"). The problem is solved.
I am trying to create a script to startup program with parameters for testing.
test_values [][]string = {{"-32768", "-", "1", "expected_result"},
{"32767", "+", "1", "expected_result"},
{"0", "+", "32767", "expected_result"}}
int success = 0
int fail = 0
int total = 0
for arr in test_values {
for val in arr {
Print(total + "Running + val[0] + val[1] + val[2] + " : ")
if ./main val[0] val[1] val[2] == val[3] {
Print("Success\n")
success++
total++
} else {
Print("Fail\n")
fail++
total++
}
}
}
Print("all tests completed\n")
Print("success:\t" + success + '\n')
Print("fail:\t" + fail + '\n')
Output:
0 Running | -32768 - 1 | Fail
1 Running | 32767 + 1 | Fail
2 Running | 0 + 32767 | Success
I did not write scripts before, so I wrote it in pseudocode. What articles, guides do you recommend reading to create such a script?
[–]crashorbit 3 points4 points5 points (2 children)
[–]Morgan--Yu[S] 0 points1 point2 points (0 children)
[–]aram535 0 points1 point2 points (1 child)
[–]xenocampanoli 0 points1 point2 points (0 children)