From e8056e48ccc2e90c373fbd6c9a1fb2b39578df18 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Thu, 31 Mar 2022 19:54:47 -0700 Subject: Allow overriding the cmp function in assert-equal. --- csc/testing.csc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'csc/testing.csc') diff --git a/csc/testing.csc b/csc/testing.csc index a0180e6..aad2a63 100644 --- a/csc/testing.csc +++ b/csc/testing.csc @@ -59,11 +59,13 @@ (define-syntax assert-equal (syntax-rules () + ((assert-equal cmp left right) + (let ((x left) + (y right)) + (unless (cmp x y) + (fatalf "Fatal: {} is not equal to {}.\nleft is {}\nright is {}" 'left 'right x y)))) ((assert-equal left right) - (let ((x left) - (y right)) - (unless (equal? x y) - (fatalf "Fatal: {} is not equal to {}.\nleft is {}\nright is {}" 'left 'right x y)))))) + (assert-equal equal? left right)))) (define-syntax assert-raises -- cgit v1.3.1