diff --git a/app/src/test/java/info/nightscout/androidaps/utils/RoundTest.java b/app/src/test/java/info/nightscout/androidaps/utils/RoundTest.java deleted file mode 100644 index 568b67057e..0000000000 --- a/app/src/test/java/info/nightscout/androidaps/utils/RoundTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package info.nightscout.androidaps.utils; - -import org.junit.Test; - -import static org.junit.Assert.*; - -public class RoundTest { - - public RoundTest(){ - super(); - } - - @Test - public void roundToTest() throws Exception { - assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000000000000000001d ); - assertEquals( -3.26d, Round.roundTo(-3.2553715764602713d, 0.01d), 0.00000000000000000001d ); - assertEquals( 0.816d, Round.roundTo(0.8156666666666667d, 0.001d), 0.00000000000000000001d ); - assertEquals( 0.235d, Round.roundTo(0.235d, 0.001d), 0.00000000000000000001d ); - assertEquals( 0.3d, Round.roundTo(0.3d, 0.1d), 0.00000000000000001d ); - assertEquals( 0.0017d, Round.roundTo(0.0016960652144170627d, 0.0001d), 0.00000000000000000001d ); - assertEquals( 0.0078d, Round.roundTo(0.007804436682291013d, 0.0001d), 0.00000000000000000001d ); - assertEquals( 0.6d, Round.roundTo(0.6d, 0.05d), 0.00000000000000000001d ); - assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000000000000000001d ); - assertEquals( 0d, Round.roundTo(0d, 1d), 0.00000000000000000001d ); - } - - @Test - public void floorToTest() throws Exception { - assertEquals( 0.5d, Round.floorTo(0.54d, 0.05d), 0.00000001d ); - assertEquals( 1d, Round.floorTo(1.59d, 1d), 0.00000001d ); - assertEquals( 0d, Round.floorTo(0d, 1d), 0.00000001d ); - } - - @Test - public void ceilToTest() throws Exception { - assertEquals( 0.6d, Round.ceilTo(0.54d, 0.1d), 0.00000001d ); - assertEquals( 2d, Round.ceilTo(1.49999d, 1d), 0.00000001d ); - assertEquals( 0d, Round.ceilTo(0d, 1d), 0.00000001d ); - } - -} \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index f77ee5261c..c9a18bd8ce 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -36,6 +36,12 @@ android { ext.enableCrashlytics = false } } + flavorDimensions "standard" + productFlavors { + full { + dimension "standard" + } + } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 diff --git a/core/src/test/java/info/nightscout/androidaps/utils/RoundTest.kt b/core/src/test/java/info/nightscout/androidaps/utils/RoundTest.kt new file mode 100644 index 0000000000..ad86a4755b --- /dev/null +++ b/core/src/test/java/info/nightscout/androidaps/utils/RoundTest.kt @@ -0,0 +1,35 @@ +package info.nightscout.androidaps.utils + +import org.junit.Assert +import org.junit.Test + +class RoundTest { + + @Test + fun roundToTest() { + Assert.assertEquals(0.55, Round.roundTo(0.54, 0.05), 0.00000000000000000001) + Assert.assertEquals(-3.26, Round.roundTo(-3.2553715764602713, 0.01), 0.00000000000000000001) + Assert.assertEquals(0.816, Round.roundTo(0.8156666666666667, 0.001), 0.00000000000000000001) + Assert.assertEquals(0.235, Round.roundTo(0.235, 0.001), 0.00000000000000000001) + Assert.assertEquals(0.3, Round.roundTo(0.3, 0.1), 0.00000000000000001) + Assert.assertEquals(0.0017, Round.roundTo(0.0016960652144170627, 0.0001), 0.00000000000000000001) + Assert.assertEquals(0.0078, Round.roundTo(0.007804436682291013, 0.0001), 0.00000000000000000001) + Assert.assertEquals(0.6, Round.roundTo(0.6, 0.05), 0.00000000000000000001) + Assert.assertEquals(1.0, Round.roundTo(1.49, 1.0), 0.00000000000000000001) + Assert.assertEquals(0.0, Round.roundTo(0.0, 1.0), 0.00000000000000000001) + } + + @Test + fun floorToTest() { + Assert.assertEquals(0.5, Round.floorTo(0.54, 0.05), 0.00000001) + Assert.assertEquals(1.0, Round.floorTo(1.59, 1.0), 0.00000001) + Assert.assertEquals(0.0, Round.floorTo(0.0, 1.0), 0.00000001) + } + + @Test + fun ceilToTest() { + Assert.assertEquals(0.6, Round.ceilTo(0.54, 0.1), 0.00000001) + Assert.assertEquals(2.0, Round.ceilTo(1.49999, 1.0), 0.00000001) + Assert.assertEquals(0.0, Round.ceilTo(0.0, 1.0), 0.00000001) + } +} \ No newline at end of file