// Verify that the the dm0 check is correct for all 3 failure cases.
// and for the positive case
@Test public void test_check_dm0()
throws NtruException
{
NtruEncryptKey keys = new NtruEncryptKey(OID.ees401ep1);
// Check the ability to count 1's.
// Verify the boundary case and one case on each side of the dm0 limit
short threeOnesArray[] = {-1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1};
FullPolynomial threeOnes = new FullPolynomial(threeOnesArray);
assertFalse(keys.check_dm0(threeOnes, 4));
assertTrue(keys.check_dm0(threeOnes, 3));
assertTrue(keys.check_dm0(threeOnes, 2));
// Check the ability to count 0's.
// Verify the boundary case and one case on each side of the dm0 limit
short threeZerosArray[] = {-1, -1, -1, -1, -1, 0, 0, 0, 1, 1, 1, 1, 1};
FullPolynomial threeZeros = new FullPolynomial(threeZerosArray);
assertFalse(keys.check_dm0(threeZeros, 4));
assertTrue(keys.check_dm0(threeZeros, 3));
assertTrue(keys.check_dm0(threeZeros, 2));
// Check the ability to count -1's.
// Verify the boundary case and one case on each side of the dm0 limit
short threeNegOnesArray[] = {-1, -1, -1, -1, -1, 0,0,0,0,0, 1,1,1};
FullPolynomial threeNegOnes = new FullPolynomial(threeNegOnesArray);
assertFalse(keys.check_dm0(threeNegOnes, 4));
assertTrue(keys.check_dm0(threeNegOnes, 3));
assertTrue(keys.check_dm0(threeNegOnes, 2));
}