Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fit SRFI 175 tests into Gambit's native test framework #11

Merged
merged 2 commits into from
Dec 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions srfi/175/175.scm
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@
(or (and (fx<= #x40 x #x5f) (fx- x #x40))
(and (fx= x #x3f) #x7f))))

(define (ascii-mirror-bracket char)
(if (fixnum? char)
(let ((char (ascii-mirror-bracket (integer->char char))))
(and char (char->integer char)))
(case char
(define (ascii-mirror-bracket x)
(if (char? x)
(case x
((#\() #\))
((#\)) #\()
((#\[) #\])
Expand All @@ -136,7 +134,9 @@
((#\}) #\{)
((#\<) #\>)
((#\>) #\<)
(else #f))))
(else #f))
(let ((x (ascii-mirror-bracket (integer->char x))))
(and x (char->integer x)))))

(define (ascii-ci-cmp char1 char2)
(let ((cc1 (ensure-int char1))
Expand Down
17 changes: 4 additions & 13 deletions srfi/175/test.scm
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
;; Copyright 2019 Lassi Kortela
;; SPDX-License-Identifier: MIT

(import (scheme base) (scheme file) (scheme read) (scheme write) (srfi 175))

(define-syntax want
(syntax-rules ()
((_ right-answer (proc args ...))
(unless (equal? right-answer (proc args ...))
(display "Failed: wanted ")
(write right-answer)
(display " but got ")
(write (proc args ...))
(display " from ")
(display '(proc args ...))
(newline)))))
(import (srfi 175))
(import (_test))

(define-syntax want (syntax-rules () ((_ x y) (check-equal? x y))))

(want #f (ascii-codepoint? -1))
(want #t (ascii-codepoint? 0))
Expand Down