1
# ---------------------------------------------------------------------------
3
# - afnix:sio module test unit -
4
# ---------------------------------------------------------------------------
5
# - This program is free software; you can redistribute it and/or modify -
6
# - it provided that this copyright notice is kept intact. -
8
# - This program is distributed in the hope that it will be useful, but -
9
# - without any warranty; without even the implied warranty of -
10
# - merchantability or fitness for a particular purpose. In no event shall -
11
# - the copyright holder be liable for any direct, indirect, incidental or -
12
# - special damages arising in any way out of the use of this software. -
13
# ---------------------------------------------------------------------------
14
# - copyright (c) 1999-2011 amaury darsch -
15
# ---------------------------------------------------------------------------
17
# @info afnix:sio named fifo test unit
18
# @author amaury darsch
21
interp:library "afnix-sio"
23
# create a default named fifo
24
trans fifo (afnix:sio:NamedFifo)
25
assert true (afnix:sio:named-fifo-p fifo)
27
# check the size and local search flag
28
assert 0 (fifo:length)
29
assert true (fifo:empty-p)
30
assert false (fifo:get-unique)
36
# check size and existence
37
assert 3 (fifo:length)
38
assert true (fifo:exists-p "hello")
39
assert true (fifo:exists-p "world")
42
assert "hello" (fifo:pop)
43
assert 2 (fifo:length)
44
assert true (fifo:exists-p "hello")
45
assert true (fifo:exists-p "world")
48
assert "world" (fifo:pop)
49
assert 1 (fifo:length)
50
assert true (fifo:exists-p "hello")
51
assert false (fifo:exists-p "world")
54
assert "hello" (fifo:pop)
55
assert 0 (fifo:length)
56
assert false (fifo:exists-p "hello")
57
assert false (fifo:exists-p "world")
59
# create a uniq named fifo
60
trans fifo (afnix:sio:NamedFifo)
63
# check the size and local search flag
64
assert 0 (fifo:length)
65
assert true (fifo:empty-p)
66
assert true (fifo:get-unique)
72
# check size and existence
73
assert 2 (fifo:length)
74
assert true (fifo:exists-p "hello")
75
assert true (fifo:exists-p "world")
78
assert "world" (fifo:pop)
79
assert 1 (fifo:length)
80
assert true (fifo:exists-p "hello")
81
assert false (fifo:exists-p "world")
84
assert "hello" (fifo:pop)
85
assert 0 (fifo:length)
86
assert false (fifo:exists-p "hello")
87
assert false (fifo:exists-p "world")