public
Description: The Nu programming language.
Homepage: http://programming.nu
Clone URL: git://github.com/timburks/nu.git
nu / test / test_truth.nu
100644 24 lines (15 sloc) 0.835 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;; test_truth.nu
;; tests for Nu representations of truth and falseness.
;;
;; Copyright (c) 2007 Tim Burks, Neon Design Technology, Inc.
 
(class TestTruth is NuTestCase
     
     (imethod (id) testTrue is
          (assert_equal "true" (if 1 (then "true") (else "false")))
          (assert_equal "true" (if YES (then "true") (else "false")))
          (assert_equal "true" (if (list 1 2 3) (then "true") (else "false")))
          (assert_equal "true" (if "zero" (then "true") (else "false")))
          (assert_equal "true" (if "false" (then "true") (else "false"))))
     
     (imethod (id) testFalse is
          (assert_equal "false" (if 0 (then "true") (else "false")))
          (assert_equal "false" (if NO (then "true") (else "false")))
          (assert_equal "false" (if nil (then "true") (else "false")))))