~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/mod/sio/tst/SIO0007.als

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ---------------------------------------------------------------------------
 
2
# - SIO0007.als                                                             -
 
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.                  -
 
7
# -                                                                         -
 
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
# ---------------------------------------------------------------------------
 
16
 
 
17
# @info   afnix:sio named fifo test unit
 
18
# @author amaury darsch
 
19
 
 
20
# get the module
 
21
interp:library "afnix-sio"
 
22
 
 
23
# create a default named fifo
 
24
trans  fifo (afnix:sio:NamedFifo)
 
25
assert true (afnix:sio:named-fifo-p fifo)
 
26
 
 
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)
 
31
 
 
32
# add some element
 
33
fifo:add "hello"
 
34
fifo:add "world"
 
35
fifo:add "hello"
 
36
# check size and existence
 
37
assert 3    (fifo:length)
 
38
assert true (fifo:exists-p "hello")
 
39
assert true (fifo:exists-p "world")
 
40
 
 
41
# pop and check
 
42
assert "hello" (fifo:pop)
 
43
assert 2       (fifo:length)
 
44
assert true    (fifo:exists-p "hello")
 
45
assert true    (fifo:exists-p "world")
 
46
 
 
47
# pop and check
 
48
assert "world" (fifo:pop)
 
49
assert 1       (fifo:length)
 
50
assert true    (fifo:exists-p "hello")
 
51
assert false   (fifo:exists-p "world")
 
52
 
 
53
# pop and check
 
54
assert "hello" (fifo:pop)
 
55
assert 0       (fifo:length)
 
56
assert false   (fifo:exists-p "hello")
 
57
assert false   (fifo:exists-p "world")
 
58
 
 
59
# create a uniq named fifo
 
60
trans  fifo (afnix:sio:NamedFifo)
 
61
fifo:set-unique true
 
62
 
 
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)
 
67
 
 
68
# add some element
 
69
fifo:add "hello"
 
70
fifo:add "world"
 
71
fifo:add "hello"
 
72
# check size and existence
 
73
assert 2    (fifo:length)
 
74
assert true (fifo:exists-p "hello")
 
75
assert true (fifo:exists-p "world")
 
76
 
 
77
# pop and check
 
78
assert "world" (fifo:pop)
 
79
assert 1       (fifo:length)
 
80
assert true    (fifo:exists-p "hello")
 
81
assert false   (fifo:exists-p "world")
 
82
 
 
83
# pop and check
 
84
assert "hello" (fifo:pop)
 
85
assert 0       (fifo:length)
 
86
assert false   (fifo:exists-p "hello")
 
87
assert false   (fifo:exists-p "world")