Android Open Source - AstroPhysCalc Time Unit Test






From Project

Back to project page AstroPhysCalc.

License

The source code is released under:

Apache License

If you think the Android project AstroPhysCalc listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.astrophyscalc;
/*from w w  w.jav  a  2  s  .com*/
import org.junit.Assert;
import org.junit.Test;

public class TimeUnitTest extends Assert {

  @Test
  public void testGetUnit() {

    final String days = TimeUnit.DAYS.getName();
    TimeUnit unit = TimeUnit.getUnit(days);
    assertEquals(TimeUnit.DAYS, unit);
  }

  @Test
  public void testCompare() {

    int result;

    result = TimeUnit.S.compare(TimeUnit.S);
    assertEquals(0, result);

    result = TimeUnit.S.compare(TimeUnit.DAYS);
    assertEquals(-1, result);

    result = TimeUnit.S.compare(TimeUnit.YEARS);
    assertEquals(-1, result);


    result = TimeUnit.DAYS.compare(TimeUnit.S);
    assertEquals(1, result);

    result = TimeUnit.DAYS.compare(TimeUnit.DAYS);
    assertEquals(0, result);

    result = TimeUnit.DAYS.compare(TimeUnit.YEARS);
    assertEquals(-1, result);


    result = TimeUnit.YEARS.compare(TimeUnit.S);
    assertEquals(1, result);

    result = TimeUnit.YEARS.compare(TimeUnit.DAYS);
    assertEquals(1, result);

    result = TimeUnit.YEARS.compare(TimeUnit.YEARS);
    assertEquals(0, result);
  }

}




Java Source Code List

org.astrophyscalc.AstroPhysCalcActivity.java
org.astrophyscalc.CalcPage.java
org.astrophyscalc.CalcRow.java
org.astrophyscalc.Calculator.java
org.astrophyscalc.Constants.java
org.astrophyscalc.DimensionTest.java
org.astrophyscalc.Dimension.java
org.astrophyscalc.FractionTest.java
org.astrophyscalc.Fraction.java
org.astrophyscalc.LengthUnit.java
org.astrophyscalc.MassUnit.java
org.astrophyscalc.TimeUnitTest.java
org.astrophyscalc.TimeUnit.java
org.astrophyscalc.UnitAndDimTest.java
org.astrophyscalc.UnitAndDim.java
org.astrophyscalc.UnitExpressionTest.java
org.astrophyscalc.UnitExpression.java
org.astrophyscalc.UnitSelectionRule.java
org.astrophyscalc.UnitSelector.java
org.astrophyscalc.UnitSpinnerItem.java
org.astrophyscalc.UnitUtilTest.java
org.astrophyscalc.UnitUtil.java
org.astrophyscalc.Unit.java
org.astrophyscalc.ValueAndUnitsTest.java
org.astrophyscalc.ValueAndUnits.java