Welcome to Web-News
A Web-based News Reader
Subject Re: RTest, a random testing framework
From bearophile <bearophileHUGS@lycos.com>
Date Mon, 21 Jul 2008 18:01:05 -0400
Newsgroups digitalmars.D

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

Recent messages in this thread
 
-# RTest, a random testing framework Fawzi Mohamed 21-Jul-2008 05:30 pm
.|# Re: RTest, a random testing framework (Current message) bearophile 21-Jul-2008 06:01 pm
.-# Re: RTest, a random testing framework BCS 21-Jul-2008 06:12 pm
.|-# Re: RTest, a random testing framework Fawzi Mohamed 22-Jul-2008 03:06 am
.|.-# Re: RTest, a random testing framework Fawzi Mohamed 22-Jul-2008 06:45 pm
.|..-# Re: RTest, a random testing framework Fawzi Mohamed 23-Jul-2008 03:20 am
.|...\# Re: RTest, a random testing framework Fawzi Mohamed 23-Jul-2008 03:30 am
.|# Re: RTest, a random testing framework JAnderson 22-Jul-2008 10:43 am
.-# Re: RTest, a random testing framework Bruce Adams 22-Jul-2008 03:47 pm
..\# Re: RTest, a random testing framework Fawzi Mohamed 23-Jul-2008 03:25 am