diff options
Diffstat (limited to 'csc/hash-map-test.csc')
| -rw-r--r-- | csc/hash-map-test.csc | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/csc/hash-map-test.csc b/csc/hash-map-test.csc index 7885908..da58e69 100644 --- a/csc/hash-map-test.csc +++ b/csc/hash-map-test.csc @@ -12,19 +12,8 @@ (csc hash-map)) -(define (hash-symbol s) - (hash-bytevector (string->utf8 (symbol->string s)))) - - -(define (cmp-symbols s1 s2) - (cond - ((symbol=? s1 s2) 0) - ((string<? (symbol->string s1) (symbol->string s2)) -1) - (else 1))) - - (define (alist->map->alist l) - (map->alist (alist->map hash-symbol cmp-symbols l))) + (map->alist (alist->map compare-symbols l))) (test map->alist-singleton @@ -78,18 +67,18 @@ (test lookup (assert-equal 2 - (lookup (alist->map hash-symbol cmp-symbols '((a . 1) (b . 2) (c . 3))) 'b))) + (lookup (alist->map compare-symbols '((a . 1) (b . 2) (c . 3))) 'b))) (test lookup-notfound (assert-raises key-not-found-error? - (lookup (alist->map hash-symbol cmp-symbols '((a . 1) (b . 2) (c . 3))) 'd))) + (lookup (alist->map compare-symbols '((a . 1) (b . 2) (c . 3))) 'd))) (test lookup-default (assert-equal #f - (lookup (alist->map hash-symbol cmp-symbols '((a . #t) (b . #t))) 'c #f))) + (lookup (alist->map compare-symbols '((a . #t) (b . #t))) 'c #f))) (define transform-map @@ -98,7 +87,7 @@ (define (test-map . bindings) - (alist->map hash-symbol cmp-symbols bindings)) + (alist->map compare-symbols bindings)) (test merge |
