dests ~master

D Extended Set Test Suite: minimal


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

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.1 2020-May-19
0.3.0 2015-Dec-16
0.2.5 2015-Jun-03
0.2.4 2015-Jun-02
0.2.3 2015-Jun-02
Show all 9 versions
Download Stats:
  • 0 downloads today

  • 3 downloads this week

  • 6 downloads this month

  • 2410 downloads total

Score:
1.0
Short URL:
dests.dub.pm