fix test assertion for float ranges (and re-enable test)

This commit is contained in:
Irmen de Jong 2021-09-12 18:53:12 +02:00
parent 2cbf2d2226
commit 5145296486

View File

@ -4,7 +4,6 @@ import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestFactory import org.junit.jupiter.api.TestFactory
import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.DynamicTest.dynamicTest import org.junit.jupiter.api.DynamicTest.dynamicTest
import kotlin.test.* import kotlin.test.*
import prog8tests.helpers.* import prog8tests.helpers.*
@ -105,7 +104,6 @@ class TestCompilerOnRanges {
@TestFactory @TestFactory
@Disabled("#55")
fun floatArrayInitializerWithRange() = mapCombinations( fun floatArrayInitializerWithRange() = mapCombinations(
dim1 = listOf("", "42", "41"), // sizeInDecl dim1 = listOf("", "42", "41"), // sizeInDecl
dim2 = listOf("%option enable_floats", ""), // optEnableFloats dim2 = listOf("%option enable_floats", ""), // optEnableFloats
@ -113,6 +111,7 @@ class TestCompilerOnRanges {
dim4 = listOf(false, true), // optimize dim4 = listOf(false, true), // optimize
combine4 = { sizeInDecl, optEnableFloats, platform, optimize -> combine4 = { sizeInDecl, optEnableFloats, platform, optimize ->
val displayName = val displayName =
"test failed for: " +
when (sizeInDecl) { when (sizeInDecl) {
"" -> "no" "" -> "no"
"42" -> "correct" "42" -> "correct"
@ -130,11 +129,10 @@ class TestCompilerOnRanges {
} }
} }
""") """)
if ((sizeInDecl == "42") && (optEnableFloats != "")){ if (optEnableFloats != "" && (sizeInDecl=="" || sizeInDecl=="42"))
result.assertSuccess() result.assertSuccess()
} else { else
result.assertFailure() result.assertFailure()
}
} }
} }
) )