~eda-qa/dhlib/main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
divert(-1)
/* <license>
 * This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
 * For full copyright and license information please refer to doc/license.txt.
 * </license> 
 */

// The Assert macros works like they would in C, using the checked
// expression as part of the exception/message which is generated.
// $1 is the expression to check
// $2 is an optional message to clarifiy the condition NOTE: it will be treated as a static string for now, but make sure it is quoted for future compatibility
//HAXE: The {}'d form is to allow ;'s to appear after the assert
define(`ASSERT',`{Assert.isTrue($1,HERE _DOC(<<<$1$2>>>));}')
define(`ASSERT_TRUE',`{Assert.isTrue($1,HERE _DOC(<<<$1$2>>>));}')
define(`ASSERT_FALSE',`{Assert.isFalse($1,HERE _DOC(<<<$1$2>>>));}')
define(`ASSERT_NULL',`{Assert.isNull($1,HERE _DOC(<<<$1$2>>>));}')
define(`ASSERT_NOTNULL',`{Assert.notNull($1,HERE _DOC(<<<$1$2>>>));}')
define(`ASSERT_UNIMPLEMENTED',`{Assert.unimplemented($1,HERE _DOC(<<<$1$2>>>));}')
define(`ASSERT_IS',`{Assert.is($1,$2,HERE _DOC(<<<$1 instanceof $2>>>));}')

// a convenient way to check for conditions on parsing and throw appropriate TypeParseError's
define(`PARSE_CHECK',`{if( !($1) ) throw new TypeParseError($2,$3,HERE _DOC(<<<$1>>>));}')

divert