@Test
public void testIntNoTails()
{
long binPos;
final IntType tmp = new IntType();
final Real1dBinMapper< IntType > binMapper =
new Real1dBinMapper< IntType >( 0.0, 100.0, 100, false );
assertEquals( 100, binMapper.getBinCount() );
for ( double i = 0; i <= 100; i += 0.125 )
{
tmp.setReal( i );
binPos = binMapper.map( tmp );
double expectedBin = Math.round( i );
if ( i >= 99.5 )
expectedBin--;
assertEquals( expectedBin, binPos, 0 );
binMapper.getLowerBound( binPos, tmp );
assertEquals( expectedBin, tmp.getRealDouble(), 0.0 );
binMapper.getUpperBound( binPos, tmp );
assertEquals( expectedBin + 1, tmp.getRealDouble(), 0.0 );
// Note - one would hope this would calc easily but due to rounding
// errors
// one cannot always easily tell what the bin center is when using
// an
// integral type with a Real1dBinMapper. One should really use an
// Integer1dBinMapper in these cases. Disabling test.
// binMapper.getCenterValues(binPos, tmpList);
// assertEquals(expectedBin + 1, tmp.getRealDouble(), 0.0);
}
tmp.setReal( -1 );
assertEquals( Long.MIN_VALUE, binMapper.map( tmp ) );
tmp.setReal( 101 );
assertEquals( Long.MAX_VALUE, binMapper.map( tmp ) );
}