diff --git a/pkgs/racket-test-core/tests/racket/basic.rktl b/pkgs/racket-test-core/tests/racket/basic.rktl index 4573a7a090..4589930b54 100644 --- a/pkgs/racket-test-core/tests/racket/basic.rktl +++ b/pkgs/racket-test-core/tests/racket/basic.rktl @@ -1140,6 +1140,49 @@ (err/rt-test (bytes-fill! #"static" 1)) (err/rt-test (bytes-fill! (bytes-copy #"oops") #\5)) +(test #t bytes=? #"a" #"a" #"a") +(test #t bytes=? #"a" #"a") +(test #t bytes=? #"a") +(test #f bytes=? #"a" #"a" #"c") +(test #f bytes=? #"a" #"b" #"c") +(test #f bytes=? #"a" #"b") +(test #f bytes=? #"c" #"a" #"a") +(test #f bytes=? #"c" #"b" #"a") +(test #f bytes=? #"b" #"a") +(err/rt-test (bytes=? 1)) +(err/rt-test (bytes=? #"a" 1)) +(err/rt-test (bytes=? #"a" #"a" 1)) +(err/rt-test (bytes=? #"a" #"b" 1)) + +(test #f bytes? #"a" #"a" #"a") +(test #f bytes>? #"a" #"a") +(test #t bytes>? #"a") +(test #f bytes>? #"a" #"a" #"c") +(test #f bytes>? #"a" #"b" #"c") +(test #f bytes>? #"a" #"b") +(test #f bytes>? #"c" #"a" #"a") +(test #t bytes>? #"c" #"b" #"a") +(test #t bytes>? #"b" #"a") +(err/rt-test (bytes>? 1)) +(err/rt-test (bytes>? #"a" 1)) +(err/rt-test (bytes>? #"a" #"a" 1)) +(err/rt-test (bytes>? #"a" #"b" 1)) + + (define r (regexp "(-[0-9]*)+")) (test '("-12--345" "-345") regexp-match r "a-12--345b") (test '((1 . 9) (5 . 9)) regexp-match-positions r "a-12--345b") diff --git a/racket/src/cs/rumble.sls b/racket/src/cs/rumble.sls index 4298533a0c..616865b72c 100644 --- a/racket/src/cs/rumble.sls +++ b/racket/src/cs/rumble.sls @@ -285,7 +285,7 @@ bytes->list list->bytes bytes->immutable-bytes bytes-copy! bytes-copy bytes-fill! - bytes=? bytes? bytes<=? bytes>=? + bytes=? bytes? bytes-append subbytes diff --git a/racket/src/cs/rumble/bytes.ss b/racket/src/cs/rumble/bytes.ss index baf41a5b1b..9ad18d0608 100644 --- a/racket/src/cs/rumble/bytes.ss +++ b/racket/src/cs/rumble/bytes.ss @@ -74,6 +74,9 @@ (define-syntax-rule (define-bytes-compare name do-name) (define/who name (case-lambda + [(a) + (check who bytes? a) + #t] [(a b) (check who bytes? a) (check who bytes? b) @@ -82,7 +85,7 @@ (check who bytes? a) (check who bytes? b) (for-each (lambda (arg) - (check who byte? arg)) + (check who bytes? arg)) l) (and (do-name a b) (let loop ([a b] [l l]) @@ -126,13 +129,8 @@ [(fx= va vb) (loop (fx1+ i))] [else #f]))])))) -(define (do-bytes>=? a b) (not (do-bytes? a b))) - (define-bytes-compare bytes? do-bytes>?) -(define-bytes-compare bytes>=? do-bytes>=?) (define/who bytes-append (case-lambda