示例#1
0
Test_InRange(
    RType< IReal >  t,
    IReal           min,
    IReal           max,
    bool            skipout
)
{
    Print( "null passes" );
    t.Check( null );
    Print( "Smaller fails" );
    if( !skipout )
        Expect(
            e => RTypeException.Match( e,
                (vr,f) => vr.Equals( f.Down().Parameter( "item" ) ),
                rt => rt.Equals( t ) ),
            () => t.Check( min.Minus( Real.Create( 1m ) ) ) );
    Print( "Min passes" );
    t.Check( min );
    Print( "In range passes" );
    t.Check( Real.Create( 10 ) );
    Print( "Max passes" );
    t.Check( max );
    Print( "Bigger fails" );
    if( !skipout )
        Expect(
            e => RTypeException.Match( e,
                (vr,f) => vr.Equals( f.Down().Parameter( "item" ) ),
                rt => rt.Equals( t ) ),
            () => t.Check( max.Plus( Real.Create( 1m ) ) ) );
}