Bug fix for negative numbers limit

Code clean up
This commit is contained in:
2023-02-27 18:44:26 +00:00
parent 9525d9d85f
commit 20e152505f
6 changed files with 6 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
package com.example.sumtest.robots
import androidx.test.espresso.matcher.ViewMatchers.Visibility.*
import androidx.test.espresso.matcher.ViewMatchers.Visibility.GONE
import androidx.test.espresso.matcher.ViewMatchers.Visibility.VISIBLE
import com.example.sumtest.R
fun sumTest(func: SumTestRobot.() -> Unit) = SumTestRobot().apply { func() }

View File

@@ -1,6 +1,5 @@
package com.example.sumtest.steps
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.Lifecycle.State.RESUMED
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.IdlingRegistry

View File

@@ -3,7 +3,6 @@ package com.example.sumtest
import android.os.Handler
import android.os.Looper
import androidx.lifecycle.ViewModel
import com.example.sumtest.utils.BasicIdlingResource
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
@@ -60,7 +59,7 @@ class SumViewModel : ViewModel() {
return Error.InvalidInput
}
if (firstAsInt > 1000 || secondAsInt > 1000) {
if (firstAsInt > 1000 || secondAsInt > 1000 || firstAsInt < -1000 || secondAsInt < -1000) {
return Error.Overflow
}

View File

@@ -1,4 +1,4 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- Base application theme. -->
<style name="Theme.Sumtest" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->

View File

@@ -1,4 +1,4 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- Base application theme. -->
<style name="Theme.Sumtest" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->

View File

@@ -1,9 +1,8 @@
package com.example.sumtest
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*