I need help building the function, so i will just ask help for one easy function to test, then i adapt this to my program..
Imagine I have file1.hs with this function defined:
function :: Int -> Int -> [String]
function a b = ["result"]
Now I created a new haskell file called test.hs where I imported file1.hs
In test.hs I create a bunch of examples like this:
test1 0 0 = function 0 0
...
test100 55 55 = function 55 55
Now, I want to do a function that runs all those tests I created, and counts the ones with the correct result, the ones that crashed and the ones that had some error but that was called in the file1...
Something like:
-
test1 is supose to run and give back ["result"]
-
test2 is supose to have and error(but it was called in the program)
-
test3 crash(because has one error that isn't called in the program).
So the result would be:
Correct answers = 1
Called error = 1
Crash = 1
I was thinking something like having V W X and inclemnt the one that happens and then doing next test, i could do this with the correct answers but i'm not sure what i can do to test crash's...
Aucun commentaire:
Enregistrer un commentaire