Test a function: Difference between revisions

Content added Content deleted
No edit summary
Line 665: Line 665:
Using the library [http://www.xs4all.nl/~mmzeeman/ocaml/ OUnit].
Using the library [http://www.xs4all.nl/~mmzeeman/ocaml/ OUnit].


The module '''Palindrome''' is where are compiled the two functions ''is_palindrome'' and ''rem_space'' from [http://rosettacode.org/wiki/Palindrome#OCaml this page]. We put these two functions in a file named ''palindrome.ml'' and compile it with ''ocamlc -c palindrome.ml -o palindrome.cmo'', then with the code below in the file ''palindrome_tests.ml'' we execute the tests with this command line:
The module '''Palindrome''' is where are compiled the two functions ''is_palindrome'' and ''rem_space'' from [[Palindrome#OCaml|this page]]. We put these two functions in a file named ''palindrome.ml'' and compile it with ''ocamlc -c palindrome.ml -o palindrome.cmo'', then with the code below in the file ''palindrome_tests.ml'' we execute the tests with this command line:
ocaml unix.cma -I +oUnit oUnit.cma palindrome.cmo palindrome_tests.ml
ocaml unix.cma -I +oUnit oUnit.cma palindrome.cmo palindrome_tests.ml