mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Test isFailedToday
This commit is contained in:
@@ -80,6 +80,16 @@ class HabitTest : BaseUnitTest() {
|
|||||||
assertTrue(h.isCompletedToday())
|
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
|
@Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun test_isCompleted_numerical() {
|
fun test_isCompleted_numerical() {
|
||||||
@@ -109,6 +119,35 @@ class HabitTest : BaseUnitTest() {
|
|||||||
assertTrue(h.isCompletedToday())
|
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
|
@Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testURI() {
|
fun testURI() {
|
||||||
|
|||||||
Reference in New Issue
Block a user