Permalink
Browse files

extended integer number theory unit test

  • Loading branch information...
1 parent 6948697 commit 5e9db3b2bed484bd72207522a06b757905f6ac2e @cdrnet cdrnet committed Jan 3, 2009
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/test/MathNet.Iridium.Test/NumberTheoryTest.cs
@@ -75,6 +75,17 @@ public void TestIsPerfectSquare()
Assert.IsFalse(IntegerTheory.IsPerfectSquare((i * i) - 1), i.ToString() + "^2-1 (-)");
Assert.IsFalse(IntegerTheory.IsPerfectSquare((i * i) + 1), i.ToString() + "^2+1 (-)");
}
+
+ // Selected Cases
+ Assert.IsTrue(IntegerTheory.IsPerfectSquare(100000000), "100000000 (+)");
+ Assert.IsFalse(IntegerTheory.IsPerfectSquare(100000001), "100000001 (-)");
+ Assert.IsFalse(IntegerTheory.IsPerfectSquare(99999999), "99999999 (-)");
+ Assert.IsFalse(IntegerTheory.IsPerfectSquare(-4), "-4 (-)");
+ Assert.IsFalse(IntegerTheory.IsPerfectSquare(Int32.MinValue), "Int32.MinValue (-)");
+ Assert.IsFalse(IntegerTheory.IsPerfectSquare(Int32.MaxValue), "Int32.MaxValue (-)");
+ Assert.IsTrue(IntegerTheory.IsPerfectSquare(1), "1 (+)");
+ Assert.IsTrue(IntegerTheory.IsPerfectSquare(0), "0 (+)");
+ Assert.IsFalse(IntegerTheory.IsPerfectSquare(-1), "-1 (-)");
}
}
}

0 comments on commit 5e9db3b

Please sign in to comment.