File: unit_test.cf

package info (click to toggle)
confluence 0.10.6-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 788 kB
  • ctags: 862
  • sloc: ml: 6,801; ansic: 834; makefile: 228; sh: 3
file content (49 lines) | stat: -rw-r--r-- 1,601 bytes parent folder | download | duplicates (4)
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
(*
    Confluence System Design Library
    Copyright (C) 2003-2004 Tom Hawkins (tomahawkins@yahoo.com)
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*)

-run_test
-assert_equal
-assert_boolean
-assert_logic

is

component run_test +parent_name +test_name +test_suite is
  {test_suite (parent_name ++ "/" ++ test_name)}
end

component assert_equal +test_name +assert_name +a +b is
  if a != b
    {print ("** assert_equal violation: " ++ test_name ++ "/" ++ assert_name ++ " -> " ++ {string_of a [] $} ++ " != " ++ {string_of b [] $})}
  end
end

component assert_boolean +test_name +assert_name +a is
  if ! a
    {print ("** assert_boolean violation: " ++ test_name ++ "/" ++ assert_name)}
  end
end

component assert_logic +test_name +assert_name +a is
  (* XXX
  {assert ("** assert_logic violation: " ++ test_name ++ "/" ++ assert_name) a}
  {output (test_name ++ "/" ++ assert_name) a}
  *)
end