File: Test4

package info (click to toggle)
omake 0.10.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,076 kB
  • sloc: ml: 49,729; ansic: 5,163; makefile: 688; sh: 110
file content (27 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (3)
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
#
# Required keyword parameters.
#
errors = 0
check(debug, i, j) =
   if $(equal $i, $j)
       println($"$(debug) = $i [SUCCESS]")
   else
       eprintln($"$(debug) = $i, should be $j [FAILURE]")
       errors = $(add $(errors), 1)
       export
   export

f(~x, ~y) =
   sub($x, $y)

check($'$(f ~x = 7, ~y = 3)', $(f ~x = 7, ~y = 3), 4)

try
    f(~y = 7)
    eprintln($'f(~y = 7) succeeded improperly [FAILURE]')
    errors = $(add $(errors), 1)
default
    eprintln($'f(~y = 7) failed properly [SUCCESS]')

if $(errors)
    exit 1