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 ee592d9..571e75e 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 @@ -41,7 +41,7 @@ class HemoCubeFragment : Fragment() { private var isUsingExistingBuffer = false private var isTestOngoing = false private var startListening = MutableLiveData(false) - val testingTrace = Firebase.performance.newTrace("testing_trace") + // val testingTrace = Firebase.performance.newTrace("testing_trace") override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?, @@ -238,7 +238,7 @@ class HemoCubeFragment : Fragment() { stringData.contains("#Buffer Completed") -> showStartSampleDialog() stringData.contains("#Sample Completed") -> { fetchResult() - testingTrace.stop() + // testingTrace.stop() } stringData.contains("RESULT") || resultData.contains("REND") -> { @@ -448,7 +448,7 @@ class HemoCubeFragment : Fragment() { } private fun startSampleProcess() { - testingTrace.start() + // testingTrace.start() hemoCubeViewModel.progressBar.postValue(true) (activity as HemocubeActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startSample, diff --git a/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt b/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt index 8a7e7b5..24bc293 100644 --- a/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt +++ b/app/src/test/java/com/example/hpostesting/HemoCubeFragmentTest.kt @@ -1,9 +1,8 @@ package com.example.hpostesting import android.content.SharedPreferences -import com.example.hpostesting.presentation.trueheme.TrueHemeFragment +import com.example.hpostesting.presentation.hemocube.HemoCubeFragment import junit.framework.TestCase.assertEquals -import junit.framework.TestCase.assertNull import org.junit.Before import org.junit.Test import org.mockito.ArgumentMatchers @@ -16,29 +15,12 @@ class HemoCubeFragmentTest { @Mock private lateinit var mockSharedPreferences: SharedPreferences - private lateinit var trueHemeFragment: TrueHemeFragment + private lateinit var hemoCubeFragment: HemoCubeFragment @Before fun setUp() { MockitoAnnotations.initMocks(this) - trueHemeFragment = TrueHemeFragment() - } - - @Test - fun `extractV2HardwareId to get device id`() { - // Arrange - Mockito.`when`( - mockSharedPreferences.getString( - ArgumentMatchers.anyString(), - ArgumentMatchers.anyString() - ) - ).thenReturn("dummy_value") - - // Act - val deviceId = trueHemeFragment.extractV2HardwareId("SNS HPP1-9000 SNE") - - // Assert - assertEquals("HPP1-9000", deviceId) + hemoCubeFragment = HemoCubeFragment() } @Test @@ -61,472 +43,4 @@ class HemoCubeFragmentTest { assertEquals("HPP1-0001", deviceId) } - @Test - fun `allReadingsComplete check`() { - // Arrange - val repeatReadingCount = 1 - val readingsPerSample = 1 - - // Act - val result = trueHemeFragment.allReadingsComplete(repeatReadingCount, readingsPerSample) - - // Assert - assertEquals(true, result) - assertEquals(trueHemeFragment.allReadingsComplete(0, 1), false) - } - - @Test - fun `extractV1HardwareId should return hardware ID when input contains SN`() { - // Arrange - val input = "Some text SN ABC123 some more text" - - // Act - val result = trueHemeFragment.extractV1HardwareId(input) - - // Assert - assertEquals("ABC123", result) - } - - @Test - fun `extractV1HardwareId should return null when input does not contain SN`() { - // Arrange - val input = "Some text without SN" - - // Act - val result = trueHemeFragment.extractV1HardwareId(input) - - // Assert - assertNull(result) - } - - @Test - fun `extractV1HardwareId should return null when input is empty`() { - // Arrange - val input = "" - - // Act - val result = trueHemeFragment.extractV1HardwareId(input) - - // Assert - assertNull(result) - } - - @Test - fun `extractV1HardwareId should return null when input is null`() { - // Arrange - val input: String? = null - - // Act - val result = input?.let { trueHemeFragment.extractV1HardwareId(it) } - - // Assert - assertNull(result) - } - - @Test - fun `extractV1HardwareId should return hardware ID when input contains SN in a specific format`() { - // Arrange - val input = """ - SN HCV-000-3001 - #BS - #BC - #SS - #SC - RESULT - LB1 20636.32 - LB2 15855.67 - LB3 21801.36 - LB4 18362.33 - LS1 17287 - LS2 14855.67 - LS3 15282.31 - LS4 9737.98 - REND - """.trimIndent() - - // Act - val result = trueHemeFragment.extractV1HardwareId(input) - - // Assert - assertEquals("HCV-000-3001", result) - } - - @Test - fun `extractV2HardwareId should return the correct hardware ID when it exists in the input`() { - // Arrange - val input = "SNS ABC123 SNE" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertEquals("ABC123", result) - } - - @Test - fun `extractV2HardwareId should return null when no hardware ID is found in the input`() { - // Arrange - val input = "No hardware ID in this input" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertNull(result) - } - - @Test - fun `extractV2HardwareId should handle whitespace around the hardware ID`() { - // Arrange - val input = "SNS XYZ789 SNE" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertEquals("XYZ789", result) - } - - @Test - fun `extractV2HardwareId should handle provided input string with HCV-000-3013`() { - // Arrange - val input = "SNS HCV-000-3013 SNE\n" + - "#SS1\n" + - "#SC1\n" + - "RESULT \n" + - "LB1 23411.00\n" + - "LB2 21417.00\n" + - "LB3 23869.00\n" + - "LB4 24967.00\n" + - "LS1 3401.00\n" + - "LS2 1107.00\n" + - "LS3 14410.00\n" + - "LS4 15047.00\n" + - "REND\n" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertEquals("HCV-000-3013", result) - } - - @Test - fun `extractV2HardwareId should handle provided input string with HPP1-4001`() { - // Arrange - val input = "SNS HPP1-4001 SNE#SS1\n" + - "#SC1\n" + - "RESULT\n" + - "LB1 23777\n" + - "LB2 24130\n" + - "LB3 23442\n" + - "LB4 23945\n" + - "LS1 2521\n" + - "LS2 973\n" + - "LS3 10252\n" + - "LS4 11017\n" + - "REND\n" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertEquals("HPP1-4001", result) - } - - @Test - fun `extractV2HardwareId should handle provided input string with HPP1-000-4001`() { - // Arrange - val input = "SNS HPP1-000-4001 SNE#SS1\n" + - "#SC1\n" + - "RESULT\n" + - "LB1 23777\n" + - "LB2 24130\n" + - "LB3 23442\n" + - "LB4 23945\n" + - "LS1 2521\n" + - "LS2 973\n" + - "LS3 10252\n" + - "LS4 11017\n" + - "REND\n" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertEquals("HPP1-000-4001", result) - } - - @Test - fun `extractV2HardwareId should handle provided input string with HPP-000-4001`() { - // Arrange - val input = "SNS HPP-000-4001 SNE#SS1\n" + - "#SC1\n" + - "RESULT\n" + - "LB1 23777\n" + - "LB2 24130\n" + - "LB3 23442\n" + - "LB4 23945\n" + - "LS1 2521\n" + - "LS2 973\n" + - "LS3 10252\n" + - "LS4 11017\n" + - "REND\n" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertEquals("HPP-000-4001", result) - } - - @Test - fun `extractV2HardwareId should handle provided input string with HPP-000-5001`() { - // Arrange - val input = "SNS HPP-000-5001 SNE#SS1\n" + - "#SC1\n" + - "RESULT\n" + - "LB1 23777\n" + - "LB2 24130\n" + - "LB3 23442\n" + - "LB4 23945\n" + - "LS1 2521\n" + - "LS2 973\n" + - "LS3 10252\n" + - "LS4 11017\n" + - "REND\n" - - // Act - val result = trueHemeFragment.extractV2HardwareId(input) - - // Assert - assertEquals("HPP-000-5001", result) - } - - @Test - fun testDeviceRatioClassificationNormalWithStartRange() { - val ratio = 0.16 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Normal", result) - } - - @Test - fun testDeviceRatioClassificationNormal() { - val ratio = 0.22 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Normal", result) - } - - @Test - fun testDeviceRatioClassificationNegativeBorderline() { - val ratio = 0.235 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Negative Borderline", result) - } - - @Test - fun testDeviceRatioClassificationSickleCellTraitLowerBound() { - val ratio = 0.251 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Sickle Cell Trait", result) - } - - @Test - fun testDeviceRatioClassificationSickleCellTraitUpperBound() { - val ratio = 0.309 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Sickle Cell Trait", result) - } - - @Test - fun testDeviceRatioClassificationPositiveForSickleCell() { - val ratio = 0.359 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result) - } - - @Test - fun testDeviceRatioClassificationSickleCellDiseaseLowerBound() { - val ratio = 0.361 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Sickle Cell Disease", result) - } - - @Test - fun testDeviceRatioClassificationSickleCellDisease() { - val ratio = 0.45 - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Sickle Cell Disease", result) - } - - @Test - fun testDeviceRatioClassificationInvalid() { - val ratio: Double? = null - val result = trueHemeFragment.deviceRatioClassification(ratio) - assertEquals("Invalid", result) - } - - @Test - fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineNormal() { - val result = - trueHemeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.5) - assertEquals("Borderline. Normal", result) - } - - @Test - fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait1() { - val result = - trueHemeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.2) - assertEquals("Borderline. Sickle Cell Trait", result) - } - - @Test - fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait2() { - val result = trueHemeFragment.findResultWithAdditionalMethods( - 0.5, - "Positive for Sickle Cell. HPLC for Confirmation", - 1.35 - ) - assertEquals("Borderline. Sickle Cell Trait", result) - } - - @Test - fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellDisease() { - val result = trueHemeFragment.findResultWithAdditionalMethods( - 0.5, - "Positive for Sickle Cell. HPLC for Confirmation", - 1.33 - ) - assertEquals("Borderline. Sickle Cell Disease", result) - } - - @Test - fun findResultWithAdditionalMethods_NormalDeviceRatio_ReturnsNormalBelowSlopeRatioThreshold() { - val result = trueHemeFragment.findResultWithAdditionalMethods(0.5, "Normal", 30.0) - assertEquals("Normal", result) - } - - @Test - fun findResultWithAdditionalMethods_NBL_ReturnsNBL() { - val result = trueHemeFragment.findResultWithAdditionalMethods( - 0.5, - "Negative Borderline, Repeat Test", - 70.0 - ) - assertEquals("Negative Borderline, Repeat Test", result) - } - - @Test - fun findResultWithAdditionalMethods_SCT_ReturnsSCT() { - val result = - trueHemeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Trait", 70.0) - assertEquals("Sickle Cell Trait", result) - } - - @Test - fun findResultWithAdditionalMethods_PBL_ReturnsPBL() { - val result = trueHemeFragment.findResultWithAdditionalMethods( - 0.5, - "Positive for Sickle Cell. HPLC for Confirmation", - 1.35 - ) - assertEquals("Borderline. Sickle Cell Trait", result) - } - - @Test - fun findResultWithAdditionalMethods_SCD_ReturnsSCD() { - val result = - trueHemeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Disease", 70.0) - assertEquals("Sickle Cell Disease", result) - } - - @Test - fun testReclassifyWithBorderlineMethod2_NegativeBorderlineToNormal() { - // Arrange - val deviceRatio = 0.1 - val deviceRatioClass = "Negative Borderline" - val led2Average = 0.2 - - // Act - val result = trueHemeFragment.reclassifyWithBorderlineMethod2( - deviceRatio, - deviceRatioClass, - led2Average - ) - - // Assert - assertEquals("Borderline. Normal", result) - } - - @Test - fun testReclassifyWithBorderlineMethod2_NegativeBorderlineToSCT() { - // Arrange - val deviceRatio = 0.1 - val deviceRatioClass = "Negative Borderline" - val led2Average = 0.14 - - // Act - val result = trueHemeFragment.reclassifyWithBorderlineMethod2( - deviceRatio, - deviceRatioClass, - led2Average - ) - - // Assert - assertEquals("Borderline. Sickle Cell Trait", result) - } - - @Test - fun testReclassifyWithBorderlineMethod2_PositiveSickleCell() { - // Arrange - val deviceRatio = 0.2 - val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation" - val led2Average = 0.18 - - // Act - val result = trueHemeFragment.reclassifyWithBorderlineMethod2( - deviceRatio, - deviceRatioClass, - led2Average - ) - - // Assert - assertEquals("Borderline. Sickle Cell Disease", result) - } - - @Test - fun testReclassifyWithBorderlineMethod2_PositiveSickleCellToSCT() { - // Arrange - val deviceRatio = 0.2 - val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation" - val led2Average = 0.195 - - // Act - val result = trueHemeFragment.reclassifyWithBorderlineMethod2( - deviceRatio, - deviceRatioClass, - led2Average - ) - - // Assert - assertEquals("Borderline. Sickle Cell Trait", result) - } - - @Test - fun testReclassifyWithBorderlineMethod2_PositiveSickleCellToSCD() { - // Arrange - val deviceRatio = 0.2 - val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation" - val led2Average = 0.189 - - // Act - val result = trueHemeFragment.reclassifyWithBorderlineMethod2( - deviceRatio, - deviceRatioClass, - led2Average - ) - - // Assert - assertEquals("Borderline. Sickle Cell Disease", result) - } } \ No newline at end of file diff --git a/app/src/test/java/com/example/hpostesting/TrueHemeFragmentTest.kt b/app/src/test/java/com/example/hpostesting/TrueHemeFragmentTest.kt index 15ca098..ad426ae 100644 --- a/app/src/test/java/com/example/hpostesting/TrueHemeFragmentTest.kt +++ b/app/src/test/java/com/example/hpostesting/TrueHemeFragmentTest.kt @@ -12,19 +12,15 @@ import org.mockito.Mockito import org.mockito.MockitoAnnotations class TrueHemeFragmentTest { - - @Mock - lateinit var mockContext: Context - @Mock private lateinit var mockSharedPreferences: SharedPreferences - private lateinit var fragment: TrueHemeFragment + private lateinit var trueHemeFragment: TrueHemeFragment @Before fun setUp() { MockitoAnnotations.initMocks(this) - fragment = TrueHemeFragment() + trueHemeFragment = TrueHemeFragment() } @Test @@ -38,7 +34,7 @@ class TrueHemeFragmentTest { ).thenReturn("dummy_value") // Act - val deviceId = fragment.extractV2HardwareId("SNS HPP1-9000 SNE") + val deviceId = trueHemeFragment.extractV2HardwareId("SNS HPP1-9000 SNE") // Assert TestCase.assertEquals("HPP1-9000", deviceId) @@ -71,11 +67,11 @@ class TrueHemeFragmentTest { val readingsPerSample = 1 // Act - val result = fragment.allReadingsComplete(repeatReadingCount, readingsPerSample) + val result = trueHemeFragment.allReadingsComplete(repeatReadingCount, readingsPerSample) // Assert TestCase.assertEquals(true, result) - TestCase.assertEquals(fragment.allReadingsComplete(0, 1), false) + TestCase.assertEquals(trueHemeFragment.allReadingsComplete(0, 1), false) } @Test @@ -84,7 +80,7 @@ class TrueHemeFragmentTest { val input = "Some text SN ABC123 some more text" // Act - val result = fragment.extractV1HardwareId(input) + val result = trueHemeFragment.extractV1HardwareId(input) // Assert TestCase.assertEquals("ABC123", result) @@ -96,7 +92,7 @@ class TrueHemeFragmentTest { val input = "Some text without SN" // Act - val result = fragment.extractV1HardwareId(input) + val result = trueHemeFragment.extractV1HardwareId(input) // Assert TestCase.assertNull(result) @@ -108,7 +104,7 @@ class TrueHemeFragmentTest { val input = "" // Act - val result = fragment.extractV1HardwareId(input) + val result = trueHemeFragment.extractV1HardwareId(input) // Assert TestCase.assertNull(result) @@ -120,7 +116,7 @@ class TrueHemeFragmentTest { val input: String? = null // Act - val result = input?.let { fragment.extractV1HardwareId(it) } + val result = input?.let { trueHemeFragment.extractV1HardwareId(it) } // Assert TestCase.assertNull(result) @@ -148,7 +144,7 @@ class TrueHemeFragmentTest { """.trimIndent() // Act - val result = fragment.extractV1HardwareId(input) + val result = trueHemeFragment.extractV1HardwareId(input) // Assert TestCase.assertEquals("HCV-000-3001", result) @@ -160,7 +156,7 @@ class TrueHemeFragmentTest { val input = "SNS ABC123 SNE" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertEquals("ABC123", result) @@ -172,7 +168,7 @@ class TrueHemeFragmentTest { val input = "No hardware ID in this input" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertNull(result) @@ -184,7 +180,7 @@ class TrueHemeFragmentTest { val input = "SNS XYZ789 SNE" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertEquals("XYZ789", result) @@ -208,7 +204,7 @@ class TrueHemeFragmentTest { "REND\n" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertEquals("HCV-000-3013", result) @@ -231,7 +227,7 @@ class TrueHemeFragmentTest { "REND\n" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertEquals("HPP1-4001", result) @@ -254,7 +250,7 @@ class TrueHemeFragmentTest { "REND\n" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertEquals("HPP1-000-4001", result) @@ -277,7 +273,7 @@ class TrueHemeFragmentTest { "REND\n" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertEquals("HPP-000-4001", result) @@ -300,51 +296,236 @@ class TrueHemeFragmentTest { "REND\n" // Act - val result = fragment.extractV2HardwareId(input) + val result = trueHemeFragment.extractV2HardwareId(input) // Assert TestCase.assertEquals("HPP-000-5001", result) } + @Test + fun testDeviceRatioClassificationNormalWithStartRange() { + val ratio = 0.16 + val result = trueHemeFragment.deviceRatioClassification(ratio) + TestCase.assertEquals("Normal", result) + } + @Test fun testDeviceRatioClassificationNormal() { - val ratio = 0.22//0.25 - val result = fragment.deviceRatioClassification(ratio) + val ratio = 0.22 + val result = trueHemeFragment.deviceRatioClassification(ratio) TestCase.assertEquals("Normal", result) } @Test fun testDeviceRatioClassificationNegativeBorderline() { - val ratio = 0.235//0.31 - val result = fragment.deviceRatioClassification(ratio) - TestCase.assertEquals("Negative Borderline", result)//, Repeat Test + val ratio = 0.235 + val result = trueHemeFragment.deviceRatioClassification(ratio) + TestCase.assertEquals("Negative Borderline", result) } @Test - fun testDeviceRatioClassificationSickleCellTrait() { - val ratio = 0.309//0.34 - val result = fragment.deviceRatioClassification(ratio) + fun testDeviceRatioClassificationSickleCellTraitLowerBound() { + val ratio = 0.251 + val result = trueHemeFragment.deviceRatioClassification(ratio) + TestCase.assertEquals("Sickle Cell Trait", result) + } + + @Test + fun testDeviceRatioClassificationSickleCellTraitUpperBound() { + val ratio = 0.309 + val result = trueHemeFragment.deviceRatioClassification(ratio) TestCase.assertEquals("Sickle Cell Trait", result) } @Test fun testDeviceRatioClassificationPositiveForSickleCell() { - val ratio = 0.359//0.37 - val result = fragment.deviceRatioClassification(ratio) + val ratio = 0.359 + val result = trueHemeFragment.deviceRatioClassification(ratio) TestCase.assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result) } + @Test + fun testDeviceRatioClassificationSickleCellDiseaseLowerBound() { + val ratio = 0.361 + val result = trueHemeFragment.deviceRatioClassification(ratio) + TestCase.assertEquals("Sickle Cell Disease", result) + } + @Test fun testDeviceRatioClassificationSickleCellDisease() { val ratio = 0.45 - val result = fragment.deviceRatioClassification(ratio) + val result = trueHemeFragment.deviceRatioClassification(ratio) TestCase.assertEquals("Sickle Cell Disease", result) } @Test fun testDeviceRatioClassificationInvalid() { val ratio: Double? = null - val result = fragment.deviceRatioClassification(ratio) + val result = trueHemeFragment.deviceRatioClassification(ratio) TestCase.assertEquals("Invalid", result) } + + @Test + fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineNormal() { + val result = + trueHemeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.5) + TestCase.assertEquals("Borderline. Normal", result) + } + + @Test + fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait1() { + val result = + trueHemeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.2) + TestCase.assertEquals("Borderline. Sickle Cell Trait", result) + } + + @Test + fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait2() { + val result = trueHemeFragment.findResultWithAdditionalMethods( + 0.5, + "Positive for Sickle Cell. HPLC for Confirmation", + 1.35 + ) + TestCase.assertEquals("Borderline. Sickle Cell Trait", result) + } + + @Test + fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellDisease() { + val result = trueHemeFragment.findResultWithAdditionalMethods( + 0.5, + "Positive for Sickle Cell. HPLC for Confirmation", + 1.33 + ) + TestCase.assertEquals("Borderline. Sickle Cell Disease", result) + } + + @Test + fun findResultWithAdditionalMethods_NormalDeviceRatio_ReturnsNormalBelowSlopeRatioThreshold() { + val result = trueHemeFragment.findResultWithAdditionalMethods(0.5, "Normal", 30.0) + TestCase.assertEquals("Normal", result) + } + + @Test + fun findResultWithAdditionalMethods_NBL_ReturnsNBL() { + val result = trueHemeFragment.findResultWithAdditionalMethods( + 0.5, + "Negative Borderline, Repeat Test", + 70.0 + ) + TestCase.assertEquals("Negative Borderline, Repeat Test", result) + } + + @Test + fun findResultWithAdditionalMethods_SCT_ReturnsSCT() { + val result = + trueHemeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Trait", 70.0) + TestCase.assertEquals("Sickle Cell Trait", result) + } + + @Test + fun findResultWithAdditionalMethods_PBL_ReturnsPBL() { + val result = trueHemeFragment.findResultWithAdditionalMethods( + 0.5, + "Positive for Sickle Cell. HPLC for Confirmation", + 1.35 + ) + TestCase.assertEquals("Borderline. Sickle Cell Trait", result) + } + + @Test + fun findResultWithAdditionalMethods_SCD_ReturnsSCD() { + val result = + trueHemeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Disease", 70.0) + TestCase.assertEquals("Sickle Cell Disease", result) + } + + @Test + fun testReclassifyWithBorderlineMethod2_NegativeBorderlineToNormal() { + // Arrange + val deviceRatio = 0.1 + val deviceRatioClass = "Negative Borderline" + val led2Average = 0.2 + + // Act + val result = trueHemeFragment.reclassifyWithBorderlineMethod2( + deviceRatio, + deviceRatioClass, + led2Average + ) + + // Assert + TestCase.assertEquals("Borderline. Normal", result) + } + + @Test + fun testReclassifyWithBorderlineMethod2_NegativeBorderlineToSCT() { + // Arrange + val deviceRatio = 0.1 + val deviceRatioClass = "Negative Borderline" + val led2Average = 0.14 + + // Act + val result = trueHemeFragment.reclassifyWithBorderlineMethod2( + deviceRatio, + deviceRatioClass, + led2Average + ) + + // Assert + TestCase.assertEquals("Borderline. Sickle Cell Trait", result) + } + + @Test + fun testReclassifyWithBorderlineMethod2_PositiveSickleCell() { + // Arrange + val deviceRatio = 0.2 + val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation" + val led2Average = 0.18 + + // Act + val result = trueHemeFragment.reclassifyWithBorderlineMethod2( + deviceRatio, + deviceRatioClass, + led2Average + ) + + // Assert + TestCase.assertEquals("Borderline. Sickle Cell Disease", result) + } + + @Test + fun testReclassifyWithBorderlineMethod2_PositiveSickleCellToSCT() { + // Arrange + val deviceRatio = 0.2 + val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation" + val led2Average = 0.195 + + // Act + val result = trueHemeFragment.reclassifyWithBorderlineMethod2( + deviceRatio, + deviceRatioClass, + led2Average + ) + + // Assert + TestCase.assertEquals("Borderline. Sickle Cell Trait", result) + } + + @Test + fun testReclassifyWithBorderlineMethod2_PositiveSickleCellToSCD() { + // Arrange + val deviceRatio = 0.2 + val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation" + val led2Average = 0.189 + + // Act + val result = trueHemeFragment.reclassifyWithBorderlineMethod2( + deviceRatio, + deviceRatioClass, + led2Average + ) + + // Assert + TestCase.assertEquals("Borderline. Sickle Cell Disease", result) + } } \ No newline at end of file