Test isFailedToday
This commit is contained in:
parent
f8c7abfff4
commit
13e57b5026
@ -80,6 +80,16 @@ class HabitTest : BaseUnitTest() {
|
||||
assertTrue(h.isCompletedToday())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun test_isFailed() {
|
||||
val h = modelFactory.buildHabit()
|
||||
assertFalse(h.isFailedToday())
|
||||
h.originalEntries.add(Entry(getToday(), Entry.NO))
|
||||
h.recompute()
|
||||
assertTrue(h.isFailedToday())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun test_isCompleted_numerical() {
|
||||
@ -109,6 +119,35 @@ class HabitTest : BaseUnitTest() {
|
||||
assertTrue(h.isCompletedToday())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun test_isFailedNumerical() {
|
||||
val h = modelFactory.buildHabit()
|
||||
h.type = HabitType.NUMERICAL
|
||||
h.targetType = NumericalHabitType.AT_LEAST
|
||||
h.targetValue = 100.0
|
||||
assertTrue(h.isFailedToday())
|
||||
h.originalEntries.add(Entry(getToday(), 200000))
|
||||
h.recompute()
|
||||
assertFalse(h.isFailedToday())
|
||||
h.originalEntries.add(Entry(getToday(), 100000))
|
||||
h.recompute()
|
||||
assertFalse(h.isFailedToday())
|
||||
h.originalEntries.add(Entry(getToday(), 50000))
|
||||
h.recompute()
|
||||
assertTrue(h.isFailedToday())
|
||||
h.targetType = NumericalHabitType.AT_MOST
|
||||
h.originalEntries.add(Entry(getToday(), 200000))
|
||||
h.recompute()
|
||||
assertTrue(h.isFailedToday())
|
||||
h.originalEntries.add(Entry(getToday(), 100000))
|
||||
h.recompute()
|
||||
assertFalse(h.isFailedToday())
|
||||
h.originalEntries.add(Entry(getToday(), 50000))
|
||||
h.recompute()
|
||||
assertFalse(h.isFailedToday())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testURI() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user