Android Open Source - Sensoria Test Float Convertor






From Project

Back to project page Sensoria.

License

The source code is released under:

MIT License

If you think the Android project Sensoria 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 com.grocs.sensors.common;
/* w w  w . j a v  a2 s.c om*/
import junit.framework.TestCase;

public class TestFloatConvertor extends TestCase {

  public void testConstructorNoArg() {
    FloatConvertor fc = new FloatConvertor();
    assertEquals(1, fc.doConvert(1), 0.1);
    assertEquals(1, fc.doConvert((float) 1.49), 0.1);
    assertEquals(2, fc.doConvert((float) 1.50), 0.1);
    assertEquals(2, fc.doConvert((float) 1.51), 0.1);
  }

  public void testConstructorArgPresision1() {
    FloatConvertor fc = new FloatConvertor(1);
    assertEquals(1.0, fc.doConvert(1), 0.01);
    assertEquals(1.2, fc.doConvert((float) 1.24), 0.01);
    assertEquals(1.3, fc.doConvert((float) 1.25), 0.01);
    assertEquals(1.3, fc.doConvert((float) 1.26), 0.01);
  }

  public void testConstructorArgPresision2() {
    FloatConvertor fc = new FloatConvertor(2);
    assertEquals(1.0, fc.doConvert(1), 0.001);
    assertEquals(1.23, fc.doConvert((float) 1.234), 0.001);
    assertEquals(1.24, fc.doConvert((float) 1.235), 0.001);
    assertEquals(1.24, fc.doConvert((float) 1.236), 0.001);
  }
}




Java Source Code List

com.grocs.sensors.common.FloatConvertor.java
com.grocs.sensors.common.ISensorData.java
com.grocs.sensors.common.ISensorDescription.java
com.grocs.sensors.common.SensorCollector.java
com.grocs.sensors.common.SensorConstants.java
com.grocs.sensors.common.SensorDataComparator.java
com.grocs.sensors.common.SensorDataManagerListener.java
com.grocs.sensors.common.SensorDataManager.java
com.grocs.sensors.common.SensorData.java
com.grocs.sensors.common.SensorDescriptions.java
com.grocs.sensors.common.SensorFilter.java
com.grocs.sensors.common.SensorUtils.java
com.grocs.sensors.common.TestFloatConvertor.java
com.grocs.sensors.ui.ActivityDetail.java
com.grocs.sensors.ui.Activity.java
com.grocs.sensors.ui.EntryAdapter.java
com.grocs.sensors.ui.FloatFormatter.java
com.grocs.sensors.ui.SensorEntryComparator.java
com.grocs.sensors.ui.SensorEntry.java
com.grocs.sensors.ui.SensorPreferenceActivity.java
com.grocs.sensors.ui.TestFloatFormatter.java