From 09b995aca6c21ad41b7b35c64b2fa3a906ad50f4 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Fri, 14 Nov 2014 21:51:53 +0000 Subject: [PATCH] BigIntegerFieldElement.isNonZero() tests --- .../bigint/BigIntegerFieldElementTest.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/core/java/test/junit/net/i2p/crypto/eddsa/math/bigint/BigIntegerFieldElementTest.java b/core/java/test/junit/net/i2p/crypto/eddsa/math/bigint/BigIntegerFieldElementTest.java index feda15daca..15d662d96b 100644 --- a/core/java/test/junit/net/i2p/crypto/eddsa/math/bigint/BigIntegerFieldElementTest.java +++ b/core/java/test/junit/net/i2p/crypto/eddsa/math/bigint/BigIntegerFieldElementTest.java @@ -56,14 +56,22 @@ public class BigIntegerFieldElementTest { assertThat(ten, is(equalTo(BYTES_TEN))); } - /** - * Test method for {@link FieldElement#isNonZero()}. - */ + // region isNonZero + @Test - public void testIsNonZero() { - fail("Not yet implemented"); + public void isNonZeroReturnsFalseIfFieldElementIsZero() { + // Assert: + assertThat(ZERO.isNonZero(), is(equalTo(false))); } + @Test + public void isNonZeroReturnsTrueIfFieldElementIsNonZero() { + // Assert: + assertThat(TWO.isNonZero(), is(equalTo(true))); + } + + // endregion + /** * Test method for {@link FieldElement#isNegative()}. */ @@ -142,7 +150,6 @@ public class BigIntegerFieldElementTest { @Test public void testEqualsObject() { assertThat(new BigIntegerFieldElement(ed25519Field, BigInteger.ZERO), is(equalTo(ZERO))); - //assertThat(new BigIntegerFieldElement(ed25519Field, BYTES_ZERO), is(equalTo(ZERO))); assertThat(new BigIntegerFieldElement(ed25519Field, BigInteger.valueOf(1000)), is(equalTo(new BigIntegerFieldElement(ed25519Field, BigInteger.valueOf(1000))))); assertThat(ONE, is(not(equalTo(TWO)))); } -- GitLab