Merge pull request #598 from MilosKozak/coverage

Coverage
This commit is contained in:
Milos Kozak 2018-01-11 00:09:07 +01:00 committed by GitHub
commit 1d5d44e008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View file

@ -15,4 +15,7 @@ android:
script:
# Unit Test
- ./gradlew test
- ./gradlew test jacocoTestReport
after_success:
- bash <(curl -s https://codecov.io/bash)

View file

@ -5,3 +5,7 @@
[![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build status](https://travis-ci.org/MilosKozak/AndroidAPS.svg?branch=master)](https://travis-ci.org/MilosKozak/AndroidAPS)
[![Coverage Status][coverage-img]][coverage-url]
[coverage-img]: https://img.shields.io/coveralls//MilosKozak/AndroidAPS/dev.svg
[coverage-url]: https://coveralls.io/github//MilosKozak/AndroidAPS?branch=dev

View file

@ -1,14 +1,17 @@
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'jacoco-android'
repositories {
maven { url 'https://maven.fabric.io/public' }
@ -61,6 +64,9 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
productFlavors {
flavorDimensions "standard"

View file

@ -14,18 +14,21 @@ public class RoundTest {
public void roundToTest() throws Exception {
assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000001d );
assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000001d );
assertEquals( 0d, Round.roundTo(0d, 1d), 0.00000001d );
}
@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 );
}
}