view test/cond.d @ 131:5825d48b27d1 trunk

[svn r135] * Merged DMD 1.025 * * Fixed a minor linking order mishap * * Added an command line option -annotate * * Fixed some problems with running optimizations * * Added std.stdio and dependencies to lphobos (still not 100% working, but compiles and links) * * Fixed problems with passing aggregate types to variadic functions * * Added initial code towards full GC support, currently based on malloc and friends, not all the runtime calls the GC yet for memory * * Fixed problems with resolving nested function context pointers for some heavily nested cases * * Redid function argument passing + other minor code cleanups, still lots to do on this end... *
author lindquist
date Fri, 04 Jan 2008 01:38:42 +0100
parents c53b6e3fe49a
children d9d5d59873d8
line wrap: on
line source

version=AndAnd;
version=OrOr;

version(AndAnd)
void andand1()
{
    int a,b;
    a = 4;
    b = 5;
    assert(a == 4);
    assert(b == 5);
    assert(a+b == 9);
    assert(a == 4 && b == 5);
    assert(a != 3 && b == 5);
    assert(a > 2);
    assert(a < 54);
    assert(a < b);
    assert(a > b-2);
    
    int apb = a+b;
    int amb = a*b;
    assert(apb < amb && apb > a);
}

version(OrOr)
void oror1()
{
    int a,b;
    a = 10;
    b = 1000;
    assert(a);
    assert(b);
    assert(a || b);
    assert(a > b || a < b);
}

void main()
{
    printf("Conditionals test\n");
    version(AndAnd) andand1();
    version(OrOr) oror1();
    printf("  SUCCESS\n");
}