summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/calculator2
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2015-10-11 16:43:16 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-11 16:43:16 +0000
commit6cccee27f07ad3cf8ba5d221afd8bfd4a867b573 (patch)
tree347039674b7742567dce02368a0e43dc1affa092 /tests/src/com/android/calculator2
parentfc6db0729d7f4e4570c9e56d969f4bd983065711 (diff)
parent9ad6f6d99c895cb32de602b9f731f4cb730066a6 (diff)
downloadandroid_packages_apps_ExactCalculator-6cccee27f07ad3cf8ba5d221afd8bfd4a867b573.tar.gz
android_packages_apps_ExactCalculator-6cccee27f07ad3cf8ba5d221afd8bfd4a867b573.tar.bz2
android_packages_apps_ExactCalculator-6cccee27f07ad3cf8ba5d221afd8bfd4a867b573.zip
Merge "Fix factorial(0)" into mnc-dr-dev
Diffstat (limited to 'tests/src/com/android/calculator2')
-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 0163a0f..68214d0 100644
--- a/tests/src/com/android/calculator2/BRTest.java
+++ b/tests/src/com/android/calculator2/BRTest.java
@@ -151,6 +151,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)) {