.....

try:

unittest {
      Velocity v = new Velocity( 2.0f, 5.0f );
      v *= 5.0f;  // <- line 110
      printf( "v = %s\n", to!string(v) );
}

instead. Basically version is like static if, it doesn't indicate its a function. Instead it changes what code gets compiled. Where as a unittest block, is essentially just a function that gets called at a special time, that is only compiled as if version(unittest) was also used.

Thank you very much. That was quite helpful.

So, what is the generally accepted way include unit testing? TDD is all the rage these days and I though I would try my hand at it as well as D.

Reply via email to