-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.coffee
36 lines (25 loc) · 923 Bytes
/
test.coffee
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
eq = (ok = require 'assert').deepEqual
F = require './fuc.coffee'
minus = (a, b) -> a - b
minus1 = (n) -> n - 1
ok (F.isO {}) and !(F.isO yes) and !(F.isO 1) and !(F.isO '') and !(F.isO [])
eq '1', F.pp 1
eq 'a', F.pp 'a'
eq '{\n "a": 1\n}', F.pp a:1
eq (minus 1, 2), (F.curry minus)(1)(2)
eq (minus 1, 2), (F.curry minus)(1, 2)
eq (minus 2, 1), (F.flip minus)(1, 2)
eq (minus1 2), F.flap 2, minus1
eq (1), do F.dnib {a:1}, -> @a
eq {a:1}, (F.dnib {}, (@a) -> @)(1)
eq {a:1}, F.uni {a:1}, {}
eq {a:1}, F.uni {}, {a:1}
eq {a:2}, F.uni {a:1}, {a:2}
eq {a:2}, F.uni {a:1}, {a:2}
eq {a:1, b:2}, F.uni {a:1}, {b:2}
eq {a:2, b:2}, F.uni {a:1}, {a:2, b:2}
eq {a:1, b:2, c:3}, F.uni {a:1}, {b:2}, {c:3}
eq [0, 2], F.maf ((n) -> if n%2 then null else n-2), [1, 2, 4]
eq {a:1, b:2}, F.zop [['a', 1], ['b', 2]]
eq 'OK', F.__ 'OK'
eq 'Pass', F.___ 'All Tests', 'Pass'