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

« back to all changes in this revision

Viewing changes to tst/ref/AXI0041.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:
11
11
# - the copyright holder be liable for any  direct, indirect, incidental or -
12
12
# - special damages arising in any way out of the use of this software.     -
13
13
# ---------------------------------------------------------------------------
14
 
# - copyright (c) 1999-2007 amaury darsch                                   -
 
14
# - copyright (c) 1999-2011 amaury darsch                                   -
15
15
# ---------------------------------------------------------------------------
16
16
 
17
17
# @info   bitset test module
18
18
# @author amaury darsch
19
19
 
20
20
# create a bitset
21
 
const  bs   (BitSet)
 
21
const  bs   (Bitset 8)
22
22
assert true (bitset-p bs)
 
23
assert 8    (bs:length)
23
24
 
24
25
# check, mark and clear
25
 
assert false (bs:get 0)
 
26
assert false (bs:marked-p 0)
26
27
bs:mark 0
27
 
assert true  (bs:get 0)
 
28
assert true  (bs:marked-p 0)
28
29
bs:clear 0
29
 
assert false (bs:get 0)
 
30
assert false (bs:marked-p 0)
 
31
 
 
32
# mark and check
 
33
bs:mark 0
 
34
bs:mark 2
 
35
bs:mark 4
 
36
bs:mark 6
 
37
 
 
38
# set a bitset by binary value
 
39
bs:set "010101"
 
40
assert 6 (bs:length)
 
41
 
 
42
# clamp by 1 and check
 
43
bs:clamp true
 
44
assert 5 (bs:length)
 
45
 
 
46
# set a bitset by hexadecimal value
 
47
bs:reset
 
48
assert 0 (bs:length)
 
49
bs:set "0x12345678"
 
50
assert 32 (bs:length)
 
51
 
 
52
assert (Byte 0x78) (bs:to-byte 0)
 
53
assert (Byte 0x12) (bs:to-byte 24)
 
54
 
 
55
# extract subset
 
56
trans sb (bs:subset 4)
 
57
assert (Byte 0x08) (sb:to-byte 0)