diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /src/regression/bool1.c | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'src/regression/bool1.c')
| -rw-r--r-- | src/regression/bool1.c | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/src/regression/bool1.c b/src/regression/bool1.c new file mode 100644 index 0000000..46857bf --- /dev/null +++ b/src/regression/bool1.c @@ -0,0 +1,133 @@ +#include "gpsim_assert.h" + +unsigned char failures=0; + +unsigned int aint0 = 0; +unsigned int aint1 = 0; +unsigned char achar0 = 0; +unsigned char achar1 = 0; + +void +done() +{ + ASSERT(MANGLE(failures) == 0); + PASSED(); +} + +void bool_or1(void) +{ + + if( (achar0 >0) || (achar1 >0 )) + failures++; +} + +void bool_or2(void) +{ + + if( achar0 || achar1) + failures++; +} + +void bool_test1(void) +{ + + if( (achar0==0) || achar1) + failures++; +} + + +void bool_test2(void) +{ + + if( (achar0==0) || aint0) + failures++; +} + +void bool_and1(void) +{ + + if( achar0 && achar1) + failures++; +} + +void bin_or1(void) +{ + + char t; + + t = achar0 | achar1; + if(t) + failures++; +} + +void bin_xor1(void) +{ + + if(achar0 ^ achar1) + failures++; +} + + +void bool_test3(void) +{ + + if((achar0 == 0x42) || (achar1 == 42)) + failures++; +} + + +void bool_or_lit1(void) +{ + + achar0 |= 0x0f; + + if(achar0 > 0x10) + failures++; + + if( (achar0 | 0x10) > 0xf0) + failures++; + +} + +void bool_and_lit1(void) +{ + + achar0 &= 0xf0; + + if(achar0 > 0x10) + failures++; + + if( (achar0 & 0x10) > 0xf0) + failures++; + + achar0 &= 0xef; + +} + +void main(void) +{ + + bool_or1(); + bool_or2(); + bool_and1(); + bin_or1(); + bin_xor1(); + + achar0++; + bool_and1(); + bool_test1(); + bool_test2(); + bool_test3(); + + + achar0--; achar1++; + bool_and1(); + + achar0=0; + achar1=0; + + bool_or_lit1(); + bool_and_lit1(); + + done(); +} |
