view tests/mini/cond.d @ 445:cc40db549aea

Changed the handling of variadic intrinsics a bit. Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues. Changed the handling of parameter attributes to a bit more generalized approach. Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 . Parameter attribs now properly set for intrinsic calls if necessary. Made the tango.math.Math patch less intrusive. Fixed/added some mini tests.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Fri, 01 Aug 2008 17:59:58 +0200
parents 1bb99290e03a
children
line wrap: on
line source

extern(C) int printf(char*, ...);

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");
}