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 "..")
typed/rackunit)
((inst fold-queue-sets-immutable-tags
Integer
Void
String
(List 'a Integer String))
(set 10 11 12)
(void)
(λ (e acc) (values (format "{~a}" e) acc))
(λ (e acc x get-tag)
(let*-values ([(t1 acc1 x1) (get-tag (if (even? e)
(floor (/ e 2))
(+ (* 3 e) 1))
acc
x)]
[(t2 acc2 x2) (get-tag 127 acc1 x1)])
(values (list 'a e t1) acc2 x2))))))]
(let-values
([(h t _)
((inst fold-queue-sets-immutable-tags
Integer
Void
String
(List 'a Integer String))
(set 6 7)
(void)
(λ (e acc) (values (format "{~a}" e) acc))
(λ (e acc x get-tag)
(let*-values ([(t1 acc1 x1) (get-tag (if (even? e)
(floor (/ e 2))
(+ (* 3 e) 1))
acc
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))