Blame test-c/n_13.c

Packit Service 8bf002
/* n_13.c:  Valid operators in #if expression.  */
Packit Service 8bf002
Packit Service 8bf002
/* Valid operators are (precedence in this order) :
Packit Service 8bf002
    defined, (unary)+, (unary)-, ~, !,
Packit Service 8bf002
    *, /, %,
Packit Service 8bf002
    +, -,
Packit Service 8bf002
    <<, >>,
Packit Service 8bf002
    <, >, <=, >=,
Packit Service 8bf002
    ==, !=,
Packit Service 8bf002
    &,
Packit Service 8bf002
    ^,
Packit Service 8bf002
    |,
Packit Service 8bf002
    &&,
Packit Service 8bf002
    ||,
Packit Service 8bf002
    ? :
Packit Service 8bf002
 */
Packit Service 8bf002
Packit Service 8bf002
#include    "defs.h"
Packit Service 8bf002
Packit Service 8bf002
main( void)
Packit Service 8bf002
{
Packit Service 8bf002
    fputs( "started\n", stderr);
Packit Service 8bf002
Packit Service 8bf002
/* 13.1:    Bit shift.  */
Packit Service 8bf002
#if     1 << 2 != 4 || 8 >> 1 != 4
Packit Service 8bf002
    fputs( "Bad arithmetic of <<, >> operators.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 13.2:    Bitwise operators.  */
Packit Service 8bf002
#if     (3 ^ 5) != 6 || (3 | 5) != 7 || (3 & 5) != 1
Packit Service 8bf002
    fputs( "Bad arithmetic of ^, |, & operators.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 13.3:    Result of ||, && operators is either of 1 or 0. */
Packit Service 8bf002
#if     (2 || 3) != 1 || (2 && 3) != 1 || (0 || 4) != 1 || (0 && 5) != 0
Packit Service 8bf002
    fputs( "Bad arithmetic of ||, && operators.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 13.4:    ?, : operator.  */
Packit Service 8bf002
#if     (0 ? 1 : 2) != 2
Packit Service 8bf002
    fputs( "Bad arithmetic of ?: operator.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
    fputs( "success\n", stderr);
Packit Service 8bf002
    return  0;
Packit Service 8bf002
}
Packit Service 8bf002