public class BooleanArrayComparatorTest
{
@Test
public void testBooleanArrayComparator()
{
BooleanArrayComparator comparator = new BooleanArrayComparator();
assertEquals( 0, comparator.compare( null, null ) );
boolean[] b1 = new boolean[]
{ true, true, true };
boolean[] b2 = new boolean[]
{ true, true, false };
boolean[] b3 = new boolean[]
{ true, false, true };
boolean[] b4 = new boolean[]
{ false, true, true };
boolean[] b5 = new boolean[]
{ true, true };
// 0
assertEquals( 0, comparator.compare( null, null ) );
assertEquals( 0, comparator.compare( new boolean[]
{}, new boolean[]
{} ) );
assertEquals( 0, comparator.compare( b1, b1 ) );
// -1
assertEquals( -1, comparator.compare( null, new boolean[]
{} ) );
assertEquals( -1, comparator.compare( null, b1 ) );
assertEquals( -1, comparator.compare( new boolean[]
{}, b1 ) );
assertEquals( -1, comparator.compare( new boolean[]
{}, b4 ) );
assertEquals( -1, comparator.compare( b5, b1 ) );
assertEquals( -1, comparator.compare( b5, b3 ) );
// 1
assertEquals( 1, comparator.compare( new boolean[]
{}, null ) );
assertEquals( 1, comparator.compare( b1, null ) );
assertEquals( 1, comparator.compare( b1, new boolean[]
{} ) );
assertEquals( 1, comparator.compare( b1, b2 ) );
assertEquals( 1, comparator.compare( b1, b3 ) );
assertEquals( 1, comparator.compare( b1, b4 ) );
assertEquals( 1, comparator.compare( b1, b5 ) );
}