This is a simple test framework, which will be improved with additional helper functions throughout the course on сoursera.org
This is a simple and useful test framework, which use only SML. And you can write simple tests right now! Congratulation!
-
You can separate tests from realization in separate files
-
For simple example of using. I created next structure in samples folder
sample1.sml
- simple file with with realiztion of your functionssample1tests.sml
- simple tests file forsample1.sml
unitlib
- folder for our powerfull :)smlunit
library
Each line of test file must be ended by semicolon!
use "lib\\smlunit.sml";
use "sample1.sml";
test("should return 7 as result of addition", isTrue(addition(3,4) = 7));
test("should return 25 as result of multiplying", isTrue(multiplication(5,5) = 25));
fun addition(num1 : int, num2 : int) =
num1 + num2
fun multiplication(num1 : int, num2 : int) =
num1 * num2