summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2015-10-01 16:07:56 -0700
committerHans Boehm <hboehm@google.com>2015-10-09 23:14:11 +0000
commit9ad6f6d99c895cb32de602b9f731f4cb730066a6 (patch)
tree50d9c00fff79a0bd4fb66e615820e7300e42d85c /tests/src
parent51fc9bddf33616aa8abaf4a37889efa90679e445 (diff)
downloadandroid_packages_apps_ExactCalculator-9ad6f6d99c895cb32de602b9f731f4cb730066a6.tar.gz
android_packages_apps_ExactCalculator-9ad6f6d99c895cb32de602b9f731f4cb730066a6.tar.bz2
android_packages_apps_ExactCalculator-9ad6f6d99c895cb32de602b9f731f4cb730066a6.zip
Fix factorial(0)
Bug: 24575798 Make factorial(0) return 1, as intended. Add a few factorial tests. Fix targetPackage spec so test is actually runnable again. Change-Id: Ibb8d827f0325999c6b5ed49a939e1532ddf55639 (cherry picked from commit 6951591806f46405564a6cb868a88d0daf6764d2)
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/calculator2/BRTest.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/src/com/android/calculator2/BRTest.java b/tests/src/com/android/calculator2/BRTest.java
index 77d4bf0..89906ca 100644
--- a/tests/src/com/android/calculator2/BRTest.java
+++ b/tests/src/com/android/calculator2/BRTest.java
@@ -145,6 +145,10 @@ public class BRTest extends TestCase {
"digitsRequired(-1/2)");
check(BoundedRational.digitsRequired(new BoundedRational(1,-2)) == 1,
"digitsRequired(1/-2)");
+ check(BoundedRational.fact(BoundedRational.ZERO).equals(BoundedRational.ONE), "0!");
+ check(BoundedRational.fact(BoundedRational.ONE).equals(BoundedRational.ONE), "1!");
+ check(BoundedRational.fact(BoundedRational.TWO).equals(BoundedRational.TWO), "2!");
+ check(BoundedRational.fact(BR_15).equals(new BoundedRational(1307674368000L)), "15!");
// We check values that include all interesting degree values.
BoundedRational r = BR_M390;
while (!r.equals(BR_390)) {