Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fbc: #ELSEIFDEF, #ELSEIFNDEF pre-processor conditional compilation di…
…rectives - add '#elseifdef SYMBOL' to test symbol defined - add '#elseifndef SYMBOL' to test symbol not definde Abbreviated conditionals: - #ifdef A - #elseifdef B - #elseifndef C - ... etc - #endif Instead of: - #if defined( A ) - #elseif defined( B ) - #elseif not defined( C ) - ... etc - #endif
- Loading branch information
Showing
6 changed files
with
172 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
#define | ||
#else | ||
#elseif | ||
#elseifdef | ||
#elseifndef | ||
#endif | ||
#endmacro | ||
#error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#include "fbcunit.bi" | ||
|
||
'' - don't mix false/true intrinsic constants | ||
'' of the compiler in with these tests | ||
#undef FALSE | ||
#undef TRUE | ||
|
||
#define FALSE 0 | ||
#define TRUE NOT FALSE | ||
|
||
#define A_DEFINED | ||
|
||
SUITE( fbc_tests.pp.ifdef ) | ||
|
||
TEST( ifdefTestDefined ) | ||
#ifdef A_DEFINED | ||
CU_PASS("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
END_TEST | ||
|
||
TEST( ifdefTestNotDefined ) | ||
#ifdef B_NOT_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_PASS("") | ||
#endif | ||
END_TEST | ||
|
||
TEST( ifndefTestDefined ) | ||
#ifndef A_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_PASS("") | ||
#endif | ||
END_TEST | ||
|
||
TEST( ifndefTestNotDefined ) | ||
#ifndef B_NOT_DEFINED | ||
CU_PASS("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
END_TEST | ||
|
||
TEST( elseifdefTestDefined ) | ||
#if 0 | ||
CU_FAIL_FATAL("") | ||
#elseifdef A_DEFINED | ||
CU_PASS("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
|
||
#if 1 | ||
CU_PASS("") | ||
#elseifdef A_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
END_TEST | ||
|
||
TEST( elseifdefTestNotDefined ) | ||
#if 0 | ||
CU_FAIL_FATAL("") | ||
#elseifdef B_NOT_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_PASS("") | ||
#endif | ||
|
||
#if 1 | ||
CU_PASS("") | ||
#elseifdef B_NOT_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
END_TEST | ||
|
||
TEST( elseifndefTestDefined ) | ||
#if 0 | ||
CU_FAIL_FATAL("") | ||
#elseifndef A_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_PASS("") | ||
#endif | ||
|
||
#if 1 | ||
CU_PASS("") | ||
#elseifndef A_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
END_TEST | ||
|
||
TEST( elseifndefTestNotDefined ) | ||
#if 0 | ||
CU_FAIL_FATAL("") | ||
#elseifndef B_NOT_DEFINED | ||
CU_PASS("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
|
||
#if 1 | ||
CU_PASS("") | ||
#elseifndef B_NOT_DEFINED | ||
CU_FAIL_FATAL("") | ||
#else | ||
CU_FAIL_FATAL("") | ||
#endif | ||
END_TEST | ||
|
||
END_SUITE |