commit 922d50d02f9bcc6f17040bc94b313ae4b391351e parent 95c156717cbc45cd115114d69fb5862e634e71e2 Author: Georges Dupéron <georges.duperon@gmail.com> Date: Mon, 3 Oct 2016 03:34:04 +0200 Added tests for more complex to-replace types. Diffstat:
| M | test/test-traversal-1.rkt | | | 34 | ++++++++++++++++++++++++++++++++-- |
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/test/test-traversal-1.rkt b/test/test-traversal-1.rkt @@ -13,6 +13,8 @@ (define-fold f₆ t₆ (List Null (Pairof Null Null) Null) String) (define-fold f₇ t₇ (Listof String) String) (define-fold f₈ t₈ (List String Foo (Listof String)) String) +(define-fold f₉ t₉ (List (Listof String) Foo (Listof String)) (Listof String)) +(define-fold f₁₀ t₁₀ (List String Foo (Listof String)) (Listof String)) (define (string->symbol+acc [x : String] [acc : Integer]) (values (string->symbol x) (add1 acc))) @@ -61,4 +63,32 @@ 0) : (Values (List Symbol (Listof String) (Listof Symbol)) Integer) - '(abc ("def" "ghi") (jkl mno)) 3) -\ No newline at end of file + '(abc ("def" "ghi") (jkl mno)) 3) + +(check-equal?-values: ((f₉ (make-predicate (Listof String)) + (λ ([l : (Listof String)] [acc : Integer]) + (values (map string->symbol l) + (add1 acc)))) + '(("a" "b" "c") + ("def" "ghi") + ("jkl" "mno")) + 0) + : (Values (List (Listof Symbol) + (Listof String) + (Listof Symbol)) + Integer) + '((a b c) ("def" "ghi") (jkl mno)) 2) + +(check-equal?-values: ((f₁₀ (make-predicate (Listof String)) + (λ ([l : (Listof String)] [acc : Integer]) + (values (map string->symbol l) + (add1 acc)))) + '("abc" + ("def" "ghi") + ("jkl" "mno")) + 0) + : (Values (List String + (Listof String) + (Listof Symbol)) + Integer) + '("abc" ("def" "ghi") (jkl mno)) 1) +\ No newline at end of file