aboutsummaryrefslogtreecommitdiffstats
path: root/csc/hash-map-test.csc
diff options
context:
space:
mode:
Diffstat (limited to 'csc/hash-map-test.csc')
-rw-r--r--csc/hash-map-test.csc13
1 files changed, 10 insertions, 3 deletions
diff --git a/csc/hash-map-test.csc b/csc/hash-map-test.csc
index 353e6b4..3e26570 100644
--- a/csc/hash-map-test.csc
+++ b/csc/hash-map-test.csc
@@ -15,8 +15,15 @@
(string<? (symbol->string s1) (symbol->string s2)))
+(define (cmp-symbols s1 s2)
+ (cond
+ ((symbol<? s1 s2) -1)
+ ((symbol=? s1 s2) 0)
+ (else 1)))
+
+
(define (alist->map->alist l)
- (map->alist (alist->map hash-symbol symbol<? l)))
+ (map->alist (alist->map hash-symbol cmp-symbols l)))
(define (sort-alist l)
@@ -70,9 +77,9 @@
(test lookup
(assert-equal
2
- (lookup (alist->map hash-symbol symbol<? '((a . 1) (b . 2) (c . 3))) 'b)))
+ (lookup (alist->map hash-symbol cmp-symbols '((a . 1) (b . 2) (c . 3))) 'b)))
(test lookup-notfound
(assert-raises key-not-found-error?
- (lookup (alist->map hash-symbol symbol<? '((a . 1) (b . 2) (c . 3))) 'd)))
+ (lookup (alist->map hash-symbol cmp-symbols '((a . 1) (b . 2) (c . 3))) 'd)))