Cleaned up tests

This commit is contained in:
Georges Dupéron 2016-01-17 22:47:17 +01:00
parent 5b1b32d5c9
commit 47f0a3b573
3 changed files with 61 additions and 52 deletions

View File

@ -402,19 +402,38 @@ was a tag requested.
(require (submod "..") (require (submod "..")
typed/rackunit) typed/rackunit)
((inst fold-queue-sets-immutable-tags (let-values
Integer ([(h t _)
Void ((inst fold-queue-sets-immutable-tags
String Integer
(List 'a Integer String)) Void
(set 10 11 12) String
(void) (List 'a Integer String))
(λ (e acc) (values (format "{~a}" e) acc)) (set 6 7)
(λ (e acc x get-tag) (void)
(let*-values ([(t1 acc1 x1) (get-tag (if (even? e) (λ (e acc) (values (format "{~a}" e) acc))
(floor (/ e 2)) (λ (e acc x get-tag)
(+ (* 3 e) 1)) (let*-values ([(t1 acc1 x1) (get-tag (if (even? e)
acc (floor (/ e 2))
x)] (+ (* 3 e) 1))
[(t2 acc2 x2) (get-tag 127 acc1 x1)]) acc
(values (list 'a e t1) acc2 x2))))))] x)]
[(t2 acc2 x2) (get-tag 85 acc1 x1)])
(values (list 'a e t1) acc2 x2))))])
(check-equal? (sort (hash-keys h) <)
(sort '(7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
6 3
85 256 128 64 32)
<))
(check-true (set=? (set-remove
(set-remove
(set-remove(list->set (hash-keys h)) 7)
6)
85)
(list->set
(map (λ ([x : (List 'a Integer String)])
(let ([s (caddr x)])
(string->number
(substring s 1 (- (string-length s)
1)))))
(hash-values h))))))))]

View File

@ -1,36 +0,0 @@
#lang racket
(require "low-untyped.rkt")
(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))])
(define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst)
(displayln (syntax->datum #'((___foo.truc ...) ...)))
(displayln (syntax->datum #'(fst ___fst.truc))))
(newline)
(with-syntax ([(foo ...) #'(aa bb cc)])
(define-temp-ids "___~a.truc" (foo ...) #:first-base fst)
(displayln (syntax->datum #'(___foo.truc ...)))
(displayln (syntax->datum #'(fst ___fst.truc))))
(newline)
(with-syntax ([foo #'aa])
(define-temp-ids "___~a.truc" foo)
(displayln (syntax->datum #'___foo.truc))
(displayln (syntax->datum #'(fst ___fst.truc))))
(newline)
(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))])
(define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst)
(displayln (syntax->datum #'(___foo.truc ... ...)))
(displayln (syntax->datum #'(fst ___fst.truc))))
(newline)
(define a 1)
(+ a a)
(module t typed/racket
(require "low.rkt"))

View File

@ -0,0 +1,26 @@
#lang racket
(require "low-untyped.rkt")
(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))])
(define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst)
(syntax->datum #'((___foo.truc ...) ...))
(syntax->datum #'(fst ___fst.truc))
(void))
(with-syntax ([(foo ...) #'(aa bb cc)])
(define-temp-ids "___~a.truc" (foo ...) #:first-base fst)
(syntax->datum #'(___foo.truc ...))
(syntax->datum #'(fst ___fst.truc))
(void))
(with-syntax ([foo #'aa])
(define-temp-ids "___~a.truc" foo)
(syntax->datum #'___foo.truc)
(syntax->datum #'(fst ___fst.truc))
(void))
(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))])
(define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst)
(syntax->datum #'(___foo.truc ... ...))
(syntax->datum #'(fst ___fst.truc))
(void))