Loading src/com/android/calculator2/BoundedRational.java +3 −0 Original line number Diff line number Diff line Loading @@ -555,6 +555,9 @@ public class BoundedRational { } return prod1.multiply(prod2); } else { if (n == 0) { return BigInteger.ONE; } BigInteger res = BigInteger.valueOf(n); for (long i = n - step; i > 1; i -= step) { res = res.multiply(BigInteger.valueOf(i)); Loading tests/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.android.exactcalculator" android:targetPackage="com.android.calculator2" android:label="BoundedRational and Calculator Functional Test" /> <application> Loading tests/README.txt +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ Run on Android with 2) Install the calculator with adb install <tree root>/out/target/product/generic/data/app/ExactCalculator/ExactCalculator.apk 3) adb install <tree root>/out/target/product/generic/data/app/ExactCalculatorTests/ExactCalculatorTests.apk 4) adb shell am instrument -w com.android.exactcalculator.tests/android.test.InstrumentationTestRunner 4) adb shell am instrument -w com.android.calculator2.tests/android.test.InstrumentationTestRunner There are three kinds of tests: Loading tests/src/com/android/calculator2/BRTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -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)) { Loading Loading
src/com/android/calculator2/BoundedRational.java +3 −0 Original line number Diff line number Diff line Loading @@ -555,6 +555,9 @@ public class BoundedRational { } return prod1.multiply(prod2); } else { if (n == 0) { return BigInteger.ONE; } BigInteger res = BigInteger.valueOf(n); for (long i = n - step; i > 1; i -= step) { res = res.multiply(BigInteger.valueOf(i)); Loading
tests/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.android.exactcalculator" android:targetPackage="com.android.calculator2" android:label="BoundedRational and Calculator Functional Test" /> <application> Loading
tests/README.txt +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ Run on Android with 2) Install the calculator with adb install <tree root>/out/target/product/generic/data/app/ExactCalculator/ExactCalculator.apk 3) adb install <tree root>/out/target/product/generic/data/app/ExactCalculatorTests/ExactCalculatorTests.apk 4) adb shell am instrument -w com.android.exactcalculator.tests/android.test.InstrumentationTestRunner 4) adb shell am instrument -w com.android.calculator2.tests/android.test.InstrumentationTestRunner There are three kinds of tests: Loading
tests/src/com/android/calculator2/BRTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -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)) { Loading