Added unsigned bit-field test
This commit is contained in:
parent
f9d19e9302
commit
72f667fbf9
|
@ -1,6 +1,8 @@
|
|||
OPS
|
||||
bf.cem.g
|
||||
bf.sed
|
||||
bfu.cem.g
|
||||
bfu.sed
|
||||
cel.cem.g
|
||||
cel.sed
|
||||
clu.cem.g
|
||||
|
|
111
lang/cem/ctest/ctgen/bfu.cem.g
Normal file
111
lang/cem/ctest/ctgen/bfu.cem.g
Normal file
|
@ -0,0 +1,111 @@
|
|||
bfs.bf1 + bfs.bf2
|
||||
bfs.bf1 - bfs.bf2
|
||||
bfs.bf1 / bfs.bf2
|
||||
bfs.bf1 % bfs.bf2
|
||||
bfs.bf1 * bfs.bf2
|
||||
bfs.bf1 & bfs.bf2
|
||||
bfs.bf1 | bfs.bf2
|
||||
bfs.bf1 ^ bfs.bf2
|
||||
bfs.bf1 || bfs.bf2
|
||||
bfs.bf1 && bfs.bf2
|
||||
bfs.bf1 << 1
|
||||
bfs.bf1 >> 1
|
||||
-bfs.bf1
|
||||
!bfs.bf1
|
||||
~bfs.bf1
|
||||
bfs.bf1 == bfs.bf2
|
||||
bfs.bf1 != bfs.bf2
|
||||
bfs.bf1 <= bfs.bf2
|
||||
bfs.bf1 >= bfs.bf2
|
||||
bfs.bf1 < bfs.bf2
|
||||
bfs.bf1 > bfs.bf2
|
||||
bfs.bf1 ? bfs.bf1 : bfs.bf2
|
||||
bfs.bf3 = bfs.bf1 1
|
||||
bfs.bf3 += bfs.bf1 0
|
||||
bfs.bf3 -= bfs.bf1 254
|
||||
bfs.bf3 /= bfs.bf1 255
|
||||
bfs.bf3 %= bfs.bf1 0
|
||||
bfs.bf3 *= bfs.bf1 255
|
||||
bfs.bf3 &= bfs.bf1 1
|
||||
bfs.bf3 |= bfs.bf1 255
|
||||
bfs.bf3 ^= bfs.bf1 254
|
||||
bfs.bf3 <<= 1 254
|
||||
bfs.bf3 >>= 1 127
|
||||
bfs.bf3 ++ 0
|
||||
bfs.bf3 -- 254
|
||||
-- bfs.b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.bf3 %= bfs.bf1 ) 0 0
|
||||
bfs.bf4 = ( bfs.bf3 *= bfs.bf1 ) 255 255
|
||||
bfs.bf4 = ( bfs.bf3 &= bfs.bf1 ) 1 1
|
||||
bfs.bf4 = ( bfs.bf3 |= bfs.bf1 ) 255 255
|
||||
bfs.bf4 = ( bfs.bf3 ^= bfs.bf1 ) 254 254
|
||||
bfs.bf4 = ( bfs.bf3 <<= 1 ) 254 254
|
||||
bfs.bf4 = ( bfs.bf3 >>= 1 ) 127 127
|
||||
bfs.bf4 = ( bfs.bf3 ++ ) 0 255
|
||||
bfs.bf4 = ( bfs.bf3 -- ) 254 255
|
||||
bfs.bf4 = ( -- bfs.bf3 ) 254 254
|
||||
bfs.bf4 = ( ++ bfs.bf3 ) 0 0
|
||||
yes if ( bfs.bf1 + bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 - bfs.bf2 ) yes() ; else no()
|
||||
no if ( bfs.bf1 / bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 % bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 * bfs.bf2 ) yes() ; else no()
|
||||
no if ( bfs.bf1 & bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 | bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 ^ bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 || bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 && bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 << 1 ) yes() ; else no()
|
||||
no if ( bfs.bf1 >> 1 ) yes() ; else no()
|
||||
yes if ( -bfs.bf1 ) yes() ; else no()
|
||||
no if ( !bfs.bf1 ) yes() ; else no()
|
||||
yes if ( ~bfs.bf1 ) yes() ; else no()
|
||||
no if ( bfs.bf1 == bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 != bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 <= bfs.bf2 ) yes() ; else no()
|
||||
no if ( bfs.bf1 >= bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 < bfs.bf2 ) yes() ; else no()
|
||||
no if ( bfs.bf1 > bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf1 ? bfs.bf1 : bfs.bf2 ) yes() ; else no()
|
||||
yes if ( bfs.bf3 = bfs.bf1 ) yes() ; else no() 1
|
||||
no if ( bfs.bf3 += bfs.bf1 ) yes() ; else no() 0
|
||||
yes if ( bfs.bf3 -= bfs.bf1 ) yes() ; else no() 254
|
||||
yes if ( bfs.bf3 /= bfs.bf1 ) yes() ; else no() 255
|
||||
no if ( bfs.bf3 %= bfs.bf1 ) yes() ; else no() 0
|
||||
yes if ( bfs.bf3 *= bfs.bf1 ) yes() ; else no() 255
|
||||
yes if ( bfs.bf3 &= bfs.bf1 ) yes() ; else no() 1
|
||||
yes if ( bfs.bf3 |= bfs.bf1 ) yes() ; else no() 255
|
||||
yes if ( bfs.bf3 ^= bfs.bf1 ) yes() ; else no() 254
|
||||
yes if ( bfs.bf3 <<= 1 ) yes() ; else no() 254
|
||||
yes if ( bfs.bf3 >>= 1 ) yes() ; else no() 127
|
||||
yes if ( bfs.bf3 ++ ) yes() ; else no() 0
|
||||
yes if ( bfs.bf3 -- ) yes() ; else no() 254
|
||||
yes if ( -- bfs.bf3 ) yes() ; else no() 254
|
||||
no if ( ++ bfs.bf3 ) yes() ; else no() 0
|
26
lang/cem/ctest/ctgen/bfu.sed
Normal file
26
lang/cem/ctest/ctgen/bfu.sed
Normal file
|
@ -0,0 +1,26 @@
|
|||
/ISTART/c\
|
||||
/* test bit fields */\
|
||||
struct bfs {\
|
||||
unsigned int bf1:1 ;\
|
||||
unsigned int bf2:4 ;\
|
||||
unsigned int bf3:8 ;\
|
||||
unsigned int bf4:16 ;\
|
||||
} bfs ;
|
||||
s/FN/main/
|
||||
/LSTART/c\
|
||||
bfs.bf1=1 ; bfs.bf2=8 ;
|
||||
/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
|
||||
/Z1/s/#/ %d&/
|
||||
/Z1/s/@/, Z1&/
|
||||
/Z2/s/#/ %d&/
|
||||
/Z2/s/@/, Z2&/
|
||||
/Z1/s/^/Z1 = 255 ; /
|
||||
/Z2/s/^/Z2 = 3 ; /
|
||||
/[XYZS]/s/^/ /
|
||||
s/X/bfs.bf1/g
|
||||
s/Y/bfs.bf2/g
|
||||
s/S/1/g
|
||||
s/Z1/bfs.bf3/g
|
||||
s/Z2/bfs.bf4/g
|
||||
s/#/\\n/
|
||||
s/@//
|
Loading…
Reference in a new issue