2
# (c) Software Lab. Alexander Burger
14
(unless (= *OS "SunOS")
16
(sigio (setq "SigSock" (port T 0 "SigPort"))
17
(setq "SigVal" (udp "SigSock")) )
18
(test '((setq "SigVal" (udp "SigSock"))) (sigio))
19
(udp "localhost" "SigPort" '(a b c))
21
(test '(a b c) "SigVal")
27
(test NIL (pipe (prog (kill *Pid) (pr 7)) (rd)))
28
(test 7 (pipe (protect (kill *Pid) (pr 7)) (rd)))
32
(test "Quit" (catch '("Quit") (quit "Quit")))
36
(let (X (box 7) L (123))
37
(test 7 (val (adr (adr X))))
38
(test 123 (car (adr (adr L)))) )
42
(test '((A . 1) (B . 2))
45
(test '((B . 2) (A . 1))
48
(test '((Y . 8) (C . 3) (B . 2) (A . 1) (X . 7))
50
(env 'X 7 '(A B (C . 3)) 'Y 8) ) )
56
((quote (N) (up N)) 2) ) )
59
((quote (N) (up N 7)) 2)
63
### args next arg rest ####
64
(test '(T 1 1 3 (2 3 4))
65
(let foo '(@ (list (args) (next) (arg) (arg 2) (rest)))
69
((quote @ (list (next) (arg) (next) (arg))) 7) )
75
(test 4 (*/ (- (usec) U) 100000)) )
79
(test (path '@) (pack (pwd) '/))
84
(test (path "@test") (pwd))
89
(test '(T . @) (info "test"))
91
(out (tmp "info") (prinl "info"))
96
(test (cons (tmp) "file" 1)
97
(out (tmp "file") (println '(file)))
102
(call 'mkdir "-p" (tmp "dir"))
103
(out (tmp "dir/.abc"))
108
(test '("a" "b" "c") (sort (dir (tmp "dir"))))
109
(test '("." ".." ".abc" "a" "b" "c") (sort (dir (tmp "dir") T)))
120
(call "bin/picolisp" "-prog (println (argv)) (bye)" "abc" 123)
124
(call "bin/picolisp" "-prog (argv A B) (println (list A B)) (bye)" "abc" 123)
131
(call "bin/picolisp" "-prog (println (list (opt) (opt))) (bye)" "abc" 123)
135
(call "bin/picolisp" "-de f () (println (opt))" "-f" "abc" "-bye")
140
(use (Dat1 Tim1 Dat2 Tim2 D1 T1 D2 T2)
143
(setq Dat1 (date) Tim1 (time T))
148
D1 (in '(date "+%Y %m %d") (list (read) (read) (read)))
149
T1 (in '(date "+%H %M %S") (list (read) (read) (read)))
150
D2 (in '(date "-u" "+%Y %m %d") (list (read) (read) (read)))
151
T2 (in '(date "-u" "+%H %M %S") (list (read) (read) (read))) )
153
(test Tim1 (time T1))
154
(test Tim1 (apply time T1))
155
(test Tim2 (time T2))
156
(test Dat1 (date D1))
157
(test Dat1 (apply date D1))
158
(test Dat2 (date D2)) )
160
(test (2000 7 15) (date 730622))
161
(test 730622 (date 2000 7 15))
162
(test 730622 (date (2000 7 15)))
163
(test NIL (date NIL))
165
(test (11 17 23) (time 40643))
166
(test 40643 (time 11 17 23))
167
(test 40643 (time (11 17 23)))
168
(test NIL (time NIL))