File: json.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 (23 lines) | stat: -rw-r--r-- 456 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
# We test some ground values for json import/export.
success = ref true

def test(d,x) = 
  y = of_json(default=d,json_of(x))
  if y == d or y != x then
    success := false
  end
end

test(2, 1)
test(3.14, 4.25)
test((1,"foo"), (2,"bar"))
test([("foo",(1,"bar"))], [("gni",(2,"boo"))])
test([(1,[("fr","bar")])], [(2,[("en","foo")])])
test([("ping",())], [("pong",())])
# More.. ?

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