Chicken Shen

Check-in [b8b4bad84b]
Login
Overview
Comment:Update to tests
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:b8b4bad84bc9450ad04cc2030397b1499225869c13f3a14402926294addda3b4
User & Date: david 2019-01-31 11:56:57
Context
2019-01-31
21:25
Updated release-info check-in: 8fba1f7d82 user: david tags: trunk
11:56
Update to tests check-in: b8b4bad84b user: david tags: trunk
11:34
Commented out tests that weren't working check-in: 37f1f4aa3d user: david tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/run.scm.

1
2
3
4
5
6
7

8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(import
  srfi-1
  srfi-4
  test
  shen)

(define true-tests

  `((= "FOO" (cn "FOO" ""))
    (= "FOO" (cn "" "FOO"))
    (= "FOO" (cn (pos "FOO" 0) (tlstr "FOO")))
    (= (pos "FOO" 0) (n->string (string->n "FOO")))
    (= (intern "x") (intern "x"))
    (do (set x y) (= (value x) y))                                     
    (= y (set x y))                                                    

    (= "Error"  (trap-error (simple-error "Error")
			    (lambda E (error-to-string E)))) 
    (= x (hd (cons x y)))                                              
    (= y (tl (cons x y)))                                              
    (= 3 (eval-kl (cons + (cons 1 (cons 2 ())))))                      
    (= (+ 1 2) ((+ 1) 2))                                              
    ;;(boolean? true)
    ;;(boolean? false)
    (boolean? (intern "true"))                                         
    (boolean? (intern "false"))))

  (define false-tests
    `(
      ;;(symbol? true)
      ;;(symbol? false)                                       
      (symbol? (intern "true"))                             
      (symbol? (intern "false"))                            
      (symbol? (lambda X X))                                
      (symbol? (value *stinput*))                           

      (trap-error (simple-error "") (lambda E (symbol? E))) 
      (symbol? ())))

  (test-begin "true-tests")
  (for-each
   (lambda (t)
     (test "true-test" #t  (eval-without-macros t)))
   true-tests)
  (test-end "true-tests")

  (test-begin "false-tests")
  (for-each
   (lambda (t)
     (test "false-test" #f (eval-without-macros t)))
   false-tests)
  (test-end "false-tests")
  (test-exit)







>
|
|
|
|
|
|
|
>
|
|
|
|
|
|
<
<
|
|



<
<
|
|
|
|
>
|
|

|


|

|

|


|

|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22


23
24
25
26
27


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(import
  srfi-1
  srfi-4
  test
  shen)

(define true-tests
  `(
    ("string concat"   . (= "FOO" (cn "FOO" "")))
    ("string concat"   . (= "FOO" (cn "" "FOO")))
    ("string position" . (= "FOO" (cn (pos "FOO" 0) (tlstr "FOO"))))
    ("string codes"    . (= (pos "FOO" 0) (n->string (string->n "FOO"))))
    ("string interns"  . (= (intern "x") (intern "x")))
    ("set / value "    . (do (set x y) (= (value x) y)))
    ("set"             . (= y (set x y)))
    ("trap-error"      . (= "Error"  (trap-error
				      (simple-error "Error")
				      (lambda E (error-to-string E)))))
    ("hd / cons"       . (= x (hd (cons x y))))
    ("tl / cons"       . (= y (tl (cons x y))))
    ("eval-kl"         . (= 3 (eval-kl (cons + (cons 1 (cons 2 ()))))))
    ("partial"         . (= (+ 1 2) ((+ 1) 2)))            


    ("boolean/true"    . (boolean? (intern "true")))
    ("boolean/false"   . (boolean? (intern "false")))))

  (define false-tests
    `(


      ("symbol/true"       . (symbol? (intern "true")))
      ("symbol/false"      . (symbol? (intern "false")))
      ("symbol/lambda"     . (symbol? (lambda X X)))
      ("symbol/stinput"    . (symbol? (value *stinput*)))
      ("trap-error/simple" . (trap-error (simple-error "")
					 (lambda E (symbol? E))))
      ("symbol/empty"      . (symbol? ()))))

  (test-begin "should be true")
  (for-each
   (lambda (t)
     (test (car t) #t (eval-without-macros (cdr t))))
   true-tests)
  (test-end "should be true")

  (test-begin "should be false")
  (for-each
   (lambda (t)
     (test (car t) #f (eval-without-macros (cdr t))))
   false-tests)
  (test-end "should be false")
  (test-exit)