summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2015-10-11 16:46:19 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-10-11 16:46:19 +0000
commitc07e2616582e85e859ddf77cfb0378b99199ffc7 (patch)
treed85cc9eb8daaa461e35fd7894b8c2c389258d157 /tests/src
parent1e05c8a241fdbaed1ad6a5a9a9582ec6e50b6a19 (diff)
parent6cccee27f07ad3cf8ba5d221afd8bfd4a867b573 (diff)
downloadandroid_packages_apps_ExactCalculator-c07e2616582e85e859ddf77cfb0378b99199ffc7.tar.gz
android_packages_apps_ExactCalculator-c07e2616582e85e859ddf77cfb0378b99199ffc7.tar.bz2
android_packages_apps_ExactCalculator-c07e2616582e85e859ddf77cfb0378b99199ffc7.zip
am 6cccee27: Merge "Fix factorial(0)" into mnc-dr-dev
* commit '6cccee27f07ad3cf8ba5d221afd8bfd4a867b573': Fix factorial(0)
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 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)) {