Skip to content

Commit

Permalink
count removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Tan108 committed Apr 4, 2024
1 parent ce36abf commit 3bb1ba9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
16 changes: 6 additions & 10 deletions src/main/kotlin/com/featurevisor/testRunner/Matrix.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ fun getFeatureAssertionsFromMatrix(
): List<FeatureAssertion> {
if (assertionWithMatrix.matrix == null) {
val assertion = assertionWithMatrix.copy()
assertion.description = "Assertion #${ nextCount()}: (${assertion.environment}) ${
assertion.description ?: "at ${getAtValue(assertion.at)}%"
}"
assertion.description =
"Assertion #${aIndex + 1}: (${assertion.environment}) ${assertion.description ?: "at ${getAtValue(assertion.at)}%"}"
return listOf(assertion)
}

Expand All @@ -103,9 +102,8 @@ fun getFeatureAssertionsFromMatrix(

for (combination in combinations) {
val assertion = applyCombinationToFeatureAssertion(combination, assertionWithMatrix)
assertion.description = "Assertion #${ nextCount()}: (${assertion.environment}) ${
assertion.description ?: "at ${getAtValue(assertion.at)}%"
}"
assertion.description =
"Assertion #${aIndex + 1}: (${assertion.environment}) ${assertion.description ?: "at ${getAtValue(assertion.at)}%"}"
assertions.add(assertion)
}

Expand Down Expand Up @@ -151,18 +149,16 @@ fun getSegmentAssertionsFromMatrix(
): List<SegmentAssertion> {
if (assertionWithMatrix.matrix == null) {
val assertion = assertionWithMatrix.copy()
val assertionCount = nextCount()
assertion.description = "Assertion #${assertionCount}: ${assertion.description ?: "#${assertionCount}"}"
assertion.description = "Assertion #${aIndex + 1}: ${assertion.description ?: "#${aIndex + 1}"}"
return listOf(assertion)
}

val assertions = mutableListOf<SegmentAssertion>()
val combinations = getMatrixCombinations(assertionWithMatrix.matrix)

for (combination in combinations) {
val assertionCount = nextCount()
val assertion = applyCombinationToSegmentAssertion(combination, assertionWithMatrix)
assertion.description = "Assertion #${assertionCount}: ${assertion.description ?: "#${assertionCount}"}"
assertion.description = "Assertion #${aIndex + 1}: ${assertion.description ?: "#${aIndex + 1}"}"
assertions.add(assertion)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ fun startTest(option: TestProjectOption) {

private fun executeTest(filePath: String, dataFile: DataFile, option: TestProjectOption): ExecutionResult {
val test = parseTestFeatureAssertions(filePath)
setCount(0)

val executionResult = ExecutionResult(
passed = true,
Expand Down
11 changes: 0 additions & 11 deletions src/main/kotlin/com/featurevisor/testRunner/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ internal val json = Json {
isLenient = true
}

private var count = 0

internal fun nextCount(): Int {
count++
return count
}

internal fun setCount(counter:Int){
count = counter
}

internal fun printMessageInGreenColor(message: String) =
println("$ANSI_GREEN$message$ANSI_RESET")

Expand Down

0 comments on commit 3bb1ba9

Please sign in to comment.