AssertTest

Defines system specific assert and standard static_assert.

Summary
AssertTestDefines system specific assert and standard static_assert.
CopyrightThis program is free software.
Files
C-kern/api/test/assert.hHeader file of AssertTest.
Functions
test
assertPrints »Assertion failed« and aborts process.
static_assertChecks condition to be true during compilation.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/test/assert.h

Header file of AssertTest.

Functions

Summary
test
assertPrints »Assertion failed« and aborts process.
static_assertChecks condition to be true during compilation.

test

assert

#define assert(
   expr
) ((expr) ? (void) 0 : assertfail_maincontext(STR(expr), __FILE__, __LINE__, __FUNCTION__))

Prints »Assertion failed« and aborts process.  Uses <assertfail_maincontext> to implement its functionality.

static_assert

#define static_assert(C,
S) ((void)(sizeof(char[(C)?1:-1])))

Checks condition to be true during compilation.  No runtime code is generated.  Can only be used in function context.

Paramters

CCondition which must hold true
Shuman readable explanation (ignored)
#define assert(
   expr
) ((expr) ? (void) 0 : assertfail_maincontext(STR(expr), __FILE__, __LINE__, __FUNCTION__))
Prints »Assertion failed« and aborts process.
#define static_assert(C,
S) ((void)(sizeof(char[(C)?1:-1])))
Checks condition to be true during compilation.
Defines system specific assert and standard static_assert.
Close