10

I'm currently grading assignments for a course on SML. I've written some test cases to automatically check correctness of functions in the students' assignments, and I'd like to be able to import their code and then run the test cases against that code. I'm imagining something similar to python import semantics. Right now, the best solution I have is to copy-paste this code at the bottom of each assignment. Is this possible with SML?

jbeard4
  • 12,664
  • 4
  • 57
  • 67

2 Answers2

8

Use use:

use "filename.sml";
(* your test cases here *)

If you have the student solution in "student.sml" and your test cases in "tests.sml":

use "student.sml";
use "tests.sml";
Emil Vikström
  • 90,431
  • 16
  • 141
  • 175
2

Look at QCheck, a unit testing library for SML

kelloti
  • 8,705
  • 5
  • 46
  • 82