}
}
public void testEqualsMatches_AudioFormat()
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray);
// AudioFormat - equal and match:
{
final AudioFormat[] f2s = new AudioFormat[]{
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray),
(AudioFormat) f1.clone(),
(AudioFormat) f1.intersects(f1)
};
for (int i = 0; i < f2s.length; ++i)
{
AudioFormat f2 = f2s[i];
assertTrue(f1.equals(f2));
assertTrue(f1.matches(f2));
assertTrue(f2.equals(f1));
assertTrue(f2.matches(f1));
}
}
// AudioFormat - not equal and not match:
{
final AudioFormat[] f2s = new AudioFormat[]{
new AudioFormat(AudioFormat.ALAW, 2.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 3.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 11, 2, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 12, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 13, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 14, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 15, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 16.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 6.0, Format.intArray),
};
for (int i = 0; i < f2s.length; ++i)
{
AudioFormat f2 = f2s[i];
//System.out.println(f2);
assertFalse(f1.equals(f2));
assertFalse(f1.matches(f2));
assertFalse(f2.equals(f1));
assertFalse(f2.matches(f1));
}
}
// AudioFormat - not equal but match:
{
final AudioFormat[] f2s = new AudioFormat[]{
new AudioFormat(null, 2.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, Format.NOT_SPECIFIED, 1, 2, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, Format.NOT_SPECIFIED, 2, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, Format.NOT_SPECIFIED, 3, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, Format.NOT_SPECIFIED, 4, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, Format.NOT_SPECIFIED, 5, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, Format.NOT_SPECIFIED, 6.0, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, Format.NOT_SPECIFIED, Format.byteArray),
new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 6.0, null),
};
for (int i = 0; i < f2s.length; ++i)
{
AudioFormat f2 = f2s[i];
//System.out.println(f2);
assertFalse(f1.equals(f2));
assertTrue(f1.matches(f2));
assertFalse(f2.equals(f1));
assertTrue(f2.matches(f1));
}
}
}