From c91657c5295d93739285e9ff59f3649320eb2d46 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Sat, 17 Feb 2024 09:43:14 +0530 Subject: [PATCH] unit tests for lower and uppper bounds --- .../presentation/hemocube/HemoCubeFragment.kt | 2 +- .../example/hpostesting/HemoCubeFragmentTest.kt | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index 5de50c2..4d702a8 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -970,7 +970,7 @@ class HemoCubeFragment : Fragment() { return "Sickle Cell Trait" if (ratio in 0.31..0.36) return "Positive for Sickle Cell. HPLC for Confirmation" - if (ratio in 0.37..0.56) + if (ratio in 0.36..0.56) return "Sickle Cell Disease" } else { return "Invalid" diff --git a/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt b/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt index 9fb9b0c..dee8880 100644 --- a/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt +++ b/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt @@ -338,12 +338,19 @@ class HemoCubeFragmentTest { } @Test - fun testDeviceRatioClassificationSickleCellTrait() { + fun testDeviceRatioClassificationSickleCellTraitLowerBound() { val ratio = 0.251 val result = hemoCubeFragment.deviceRatioClassification(ratio) assertEquals("Sickle Cell Trait", result) } + @Test + fun testDeviceRatioClassificationSickleCellTraitUpperBound() { + val ratio = 0.309 + val result = hemoCubeFragment.deviceRatioClassification(ratio) + assertEquals("Sickle Cell Trait", result) + } + @Test fun testDeviceRatioClassificationPositiveForSickleCell() { val ratio = 0.359 @@ -351,6 +358,13 @@ class HemoCubeFragmentTest { assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result) } + @Test + fun testDeviceRatioClassificationSickleCellDiseaseLowerBound() { + val ratio = 0.361 + val result = hemoCubeFragment.deviceRatioClassification(ratio) + assertEquals("Sickle Cell Disease", result) + } + @Test fun testDeviceRatioClassificationSickleCellDisease() { val ratio = 0.45