Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vMaroon committed Jun 25, 2024
1 parent c3f5c12 commit 7c7ee1d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Spr24/HW/Homework3/test_parse.sml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use "hw3_q3.sml";
exception TestFailure of string;

local
fun sexp_to_string (ATOM(SYMBOL(s))) = s
| sexp_to_string (ATOM(NIL)) = "NIL"
| sexp_to_string (CONS(x, y)) = "(" ^ sexp_to_string x ^ "." ^ sexp_to_string y ^ ")";
fun sexp_to_string (ATOM(SYMBOL s)) = s
| sexp_to_string (ATOM NIL) = "NIL"
| sexp_to_string (CONS (x, y)) = "(" ^ sexp_to_string x ^ "." ^ sexp_to_string y ^ ")";
in
fun assert_equal (expected, actual, msg) =
if expected = actual then ()
else raise TestFailure(msg ^ ": expected " ^ sexp_to_string expected ^ ", but got " ^ sexp_to_string actual);
else raise TestFailure (msg ^ ": expected " ^ sexp_to_string expected ^ ", but got " ^ sexp_to_string actual);
end;

let
Expand Down

0 comments on commit 7c7ee1d

Please sign in to comment.