RTest, a random testing framework

bearophile bearophileHUGS at lycos.com
Mon Jul 21 15:01:05 PDT 2008


Fawzi Mohamed:
> = RTest
> == RTest a random testing framework

This code:

template isFloat(T){
    static if(is(T==float)||is(T==double)||is(T==real)){
        const bool isFloat=true;
    } else {
        const bool isFloat=false;
    }
}

Can be written as:

template isFloat(T){
    const bool isFloat = is(T == float) || is(T == double) || is(T == real);
}

Or using a nicer template:

template isFloat(T){
    const bool isFloat = IsType!(T, float, double, real);
}

Bye,
bearophile



More information about the Digitalmars-d mailing list