xref: /openbsd-src/regress/include/bitstring/good/8 (revision a4a66a2b7b2e7ede0b2cd06faaaf57170bb49de2)
1Testing with TEST_LENGTH = 8
2
3test _bit_byte, _bit_mask, and bitstr_size
4  i   _bit_byte(i)   _bit_mask(i) bitstr_size(i)
5  0              0              1              0
6  1              0              2              1
7  2              0              4              1
8  3              0              8              1
9  4              0             16              1
10  5              0             32              1
11  6              0             64              1
12  7              0            128              1
13
14test bit_alloc, clearbits, bit_ffc, bit_ffs
15be:   0  -1 00000000
16is:   0  -1 00000000
17
18test bit_set
19be:   1   0 10010010
20is:   1   0 10010010
21
22test bit_clear
23be:   0   3 00010000
24is:   0   3 00010000
25
26test bit_test using previous bitstring
27  i    bit_test(i)
28  0              0
29  1              0
30  2              0
31  3              8
32  4              0
33  5              0
34  6              0
35  7              0
36
37test clearbits
38be:   0  -1 00000000
39is:   0  -1 00000000
40
41test bit_nset and bit_nclear
42be:   0   1 01111110
43is:   0   1 01111110
44be:   0   1 01000010
45is:   0   1 01000010
46be:   0  -1 00000000
47is:   0  -1 00000000
48be:   7   0 11111110
49is:   7   0 11111110
50be:   0  -1 00000000
51is:   0  -1 00000000
52
53first 1 bit should move right 1 position each line
54  0  -1   0 11111111
55  1   0   1 01111111
56  2   0   2 00111111
57  3   0   3 00011111
58  4   0   4 00001111
59  5   0   5 00000111
60  6   0   6 00000011
61  7   0   7 00000001
62
63first 0 bit should move right 1 position each line
64  0   0  -1 00000000
65  1   1   0 10000000
66  2   2   0 11000000
67  3   3   0 11100000
68  4   4   0 11110000
69  5   5   0 11111000
70  6   6   0 11111100
71  7   7   0 11111110
72
73first 0 bit should move left 1 position each line
74  0  -1   0 11111111
75  1   7   0 11111110
76  2   6   0 11111100
77  3   5   0 11111000
78  4   4   0 11110000
79  5   3   0 11100000
80  6   2   0 11000000
81  7   1   0 10000000
82
83first 1 bit should move left 1 position each line
84  0   0  -1 00000000
85  1   0   7 00000001
86  2   0   6 00000011
87  3   0   5 00000111
88  4   0   4 00001111
89  5   0   3 00011111
90  6   0   2 00111111
91  7   0   1 01111111
92
930 bit should move right 1 position each line
94  0   0   1 01111111
95  1   1   0 10111111
96  2   2   0 11011111
97  3   3   0 11101111
98  4   4   0 11110111
99  5   5   0 11111011
100  6   6   0 11111101
101  7   7   0 11111110
102
1031 bit should move right 1 position each line
104  0   1   0 10000000
105  1   0   1 01000000
106  2   0   2 00100000
107  3   0   3 00010000
108  4   0   4 00001000
109  5   0   5 00000100
110  6   0   6 00000010
111  7   0   7 00000001
112
113CHI square test
114  0   1   0 10000001
115  1   0   1 01000010
116  2   0   2 00100100
117  3   0   3 00011000
118  4   0   3 00011000
119  5   0   2 00100100
120  6   0   1 01000010
121  7   1   0 10000001
122
123macros should evaluate arguments only once
124_bit_byte(0) -> 1
125_bit_mask(1) -> 2
126bitstr_size(2) -> 3
127bit_alloc(3) -> 4
128bit_alloc(4) -> 5
129bit_test(5) -> 6
130bit_set(6) -> 7
131bit_clear(7) -> 8
132bit_nclear(0, 1) -> 2
133bit_nset(2, 3) -> 4
134bit_ffc(4, 0) -> 5
135bit_ffs(5, 0) -> 6
136