File: eval.liq

package info (click to toggle)
liquidsoap 1.1.1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,536 kB
  • ctags: 4,416
  • sloc: ml: 34,126; python: 956; makefile: 633; sh: 487; perl: 258; lisp: 62; ansic: 43; ruby: 8
file content (45 lines) | stat: -rw-r--r-- 1,018 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
count = ref 1
fail = ref false

def echo(s)
  # system("echo "^quote(s))
  if s != string_of(!count) then
    fail := true
  end
  count := !count + 1
  ()
end

def test(lbl,f)
  if f() then echo(lbl) else echo("fail "^lbl) end
end

test("1", { 1==1 })
test("2", { 1+1==2 })
test("3", { (-1)+2==1 })
test("4", { (-1)+2 <= 3*2 })
test("5", { true })
test("6", { true and true })
test("7", { 1==1 and 1==1 })
test("8", { (1==1) and (1==1) })
test("9", { true and (-1)+2 <= 3*2 })

l = [ ("bla",""), ("bli","x"), ("blo","xx"), ("blu","xxx"), ("dix","10") ]
echo(l["dix"])
test("11",{ 2 == list.length(string.split(separator="",l["blo"])) })

%ifdef foobarbaz
  if = if is not a well-formed expression, and we do not care...
%endif

echo("1#{1+1}")
echo(string_of(int_of_float(float_of_string(default=13.,"blah"))))

f=fun(x)->x
# Checking that the following is not recursive:
f=fun(x)->f(x)
echo(string_of(f(14)))

test("15",{ list.remove(2,[2]) == [] })

if !fail then print("TEST FAILED") else print("TEST PASSED") end