dests 0.3.0

D Extended Set Test Suite: minimal


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

D Extended Set (DES) test suite

Build Status Join the chat at https://gitter.im/dexset/discussion

some aux funcs for unittesting

eq func Example:
/+ using epsilon of second argument (double.epsilon)
 + for compare int and double
 + abs( 1 - 1.0 ) < double.epsilon
 +/
assert( eq( 1, 1.0 ) );

// ditto
assert( eq( [[1,2],[3,4]], [[1.0f,2],[3.0f,4]] ) );

// grapheme comparation
assert( eq( "hello", "hello"w ) );

// compile error: array of array can't be compared with int
static assert( !__traits(compiles, eq(["hello"],1)) );

/+ no compile error: char can be compared with int
 + but length of 'hello' not equals length of [1,2,3]
 +/
assert( !eq( "hello", [1,2,3] ) );

// approx comparation, only for numeric values
assert(  eq_approx( [1.1f,2,3], [1,2,3], 0.2 ) );
assert( !eq_approx( [1.1f,2,3], [1,2,3], 0.1 ) );
assert funcs Example:
// use 'eq' func to compare values
assertEq( [1.0f,2.0f], [1,2] );

// throw AssertError with message 'assertNotEq fails: [1.0f, 2.0f] == [1, 2]'
assertNotEq( [1.0f,2.0f], [1,2] );

// throw AssertError with message 'fail compare: [1.0, 2.0] is not [1, 3]'
assertEq( [1.0f,2.0f], [1,3], "fail compare: %s is not %s" );

// use 'is' for comparation with null
assertNull( some_object );
assertNotNull( some_object );

// thowing exception assertion
assertExcept!MyException({ throw new MyException; });

// numeric in range assertion
assertInRange( 0, 1, 2 );
assertInRange( 0, 0, 2 );
assertExcept!AssertError({ assertInRange( 0, 2, 2 ); });
assertInRange!"[]"( 0, 2, 2 );
assertInRange!"(]"( 0.0f, 2, 2.0 );

To build doc use harbored-mod

Authors: Oleg Butko (deviator)

Dependencies: none

Versions:
0.3.0 2015-Dec-16
0.2.5 2015-Jun-03
0.2.4 2015-Jun-02
0.2.3 2015-Jun-02
0.2.2 2015-Jun-01
Show all 8 versions
Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 1279 downloads total