FileDocCategorySizeDatePackage
MathTest.javaAPI DocAndroid 1.5 API13206Wed May 06 22:42:02 BST 2009com.android.unit_tests

MathTest

public class MathTest extends android.test.PerformanceTestBase
Implements basic performance test functionality for java.lang.Math

Fields Summary
public static final int
ITERATIONS
public static final double
sDouble1
public static final double
sDouble2
public static final float
sFloat
public static final int
sInt
Constructors Summary
Methods Summary
public intstartPerformance(PerformanceTestCase.Intermediates intermediates)


    
        
        intermediates.setInternalIterations(ITERATIONS);
        return 0;
    
public voidtestDoubleAbs()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
            result = Math.abs(sDouble1);
        }
    
public voidtestFloatAbs()

        float result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
            result = Math.abs(sFloat);
        }
    
public voidtestMathACos()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
            result = Math.acos(sDouble1);
        }
    
public voidtestMathASin()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
            result = Math.asin(sDouble1);
        }
    
public voidtestMathATan()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
            result = Math.atan(sDouble1);
        }
    
public voidtestMathCeil()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
            result = Math.ceil(sDouble1);
        }
    
public voidtestMathCos()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
            result = Math.cos(sDouble1);
        }
    
public voidtestMathExp()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
            result = Math.exp(sDouble1);
        }
    
public voidtestMathFloor()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
            result = Math.floor(sDouble1);
        }
    
public voidtestMathIEEERemainder()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
            result = Math.IEEEremainder(sDouble1, sDouble2);
        }
    
public voidtestMathLog()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
            result = Math.log(sDouble1);
        }
    
public voidtestMathMax()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
            result = Math.max(sDouble1, sDouble2);
        }
    
public voidtestMathMin()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
            result = Math.min(sDouble1, sDouble2);
        }
    
public voidtestMathPow()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
            result = Math.pow(sDouble1, sDouble2);
        }
    
public voidtestMathRandom()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.random();
            result = Math.random();
            result = Math.random();
            result = Math.random();
            result = Math.random();
            result = Math.random();
            result = Math.random();
            result = Math.random();
            result = Math.random();
            result = Math.random();
        }
    
public voidtestMathRound()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
            result = Math.round(sDouble1);
        }
    
public voidtestMathSin()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
            result = Math.sin(sDouble1);
        }
    
public voidtestMathSqrt()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
            result = Math.sqrt(sDouble1);
        }
    
public voidtestMathTan()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
            result = Math.tan(sDouble1);
        }
    
public voidtestMathToDegrees()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
            result = Math.toDegrees(sDouble1);
        }
    
public voidtestMathToRadians()

        double result;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
            result = Math.toRadians(sDouble1);
        }