mirror of
https://github.com/hmalik144/sumtest.git
synced 2025-12-10 03:05:27 +00:00
Bug fix for negative numbers limit
Code clean up
This commit is contained in:
@@ -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() }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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. -->
|
||||
|
||||
@@ -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. -->
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user