parent
75ff796510
commit
f639a78ff4
1 changed files with 10 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.core.data
|
package info.nightscout.core.data
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.interfaces.iob.Iob
|
import info.nightscout.interfaces.iob.Iob
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class IobTest {
|
class IobTest {
|
||||||
|
@ -10,23 +10,23 @@ class IobTest {
|
||||||
val a = Iob().iobContrib(1.0).activityContrib(2.0)
|
val a = Iob().iobContrib(1.0).activityContrib(2.0)
|
||||||
val b = Iob().iobContrib(3.0).activityContrib(4.0)
|
val b = Iob().iobContrib(3.0).activityContrib(4.0)
|
||||||
a.plus(b)
|
a.plus(b)
|
||||||
Assertions.assertEquals(4.0, a.iobContrib, 0.01)
|
assertThat(a.iobContrib).isWithin(0.01).of(4.0)
|
||||||
Assertions.assertEquals(6.0, a.activityContrib, 0.01)
|
assertThat(a.activityContrib).isWithin(0.01).of(6.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun equalTest() {
|
@Test fun equalTest() {
|
||||||
val a1 = Iob().iobContrib(1.0).activityContrib(2.0)
|
val a1 = Iob().iobContrib(1.0).activityContrib(2.0)
|
||||||
val a2 = Iob().iobContrib(1.0).activityContrib(2.0)
|
val a2 = Iob().iobContrib(1.0).activityContrib(2.0)
|
||||||
val b = Iob().iobContrib(3.0).activityContrib(4.0)
|
val b = Iob().iobContrib(3.0).activityContrib(4.0)
|
||||||
Assertions.assertTrue(a1 == a2)
|
assertThat(a1).isEqualTo(a1)
|
||||||
Assertions.assertFalse(a1 == b)
|
assertThat(a1).isEqualTo(a2)
|
||||||
@Suppress("SENSELESS_COMPARISON")
|
assertThat(a1).isNotEqualTo(b)
|
||||||
Assertions.assertFalse(a1 == null)
|
assertThat(a1).isNotNull()
|
||||||
Assertions.assertFalse(a1 == Any())
|
assertThat(a1).isNotEqualTo(Any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hashCodeTest() {
|
@Test fun hashCodeTest() {
|
||||||
val a = Iob().iobContrib(1.0).activityContrib(2.0)
|
val a = Iob().iobContrib(1.0).activityContrib(2.0)
|
||||||
Assertions.assertNotEquals(0, a.hashCode().toLong())
|
assertThat(a.hashCode().toLong()).isNotEqualTo(0L)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue