Skip to content

Commit d5cdd8a

Browse files
Hacks similar to contest 2023 ones (#2676)
1 parent 79cf54b commit d5cdd8a

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ enum class RuntimeExceptionTestsBehaviour(
612612
// Get is mandatory because of the initialization order of the inheritors.
613613
// Otherwise, in some cases we could get an incorrect value
614614
companion object : CodeGenerationSettingBox {
615-
override val defaultItem: RuntimeExceptionTestsBehaviour get() = FAIL
615+
override val defaultItem: RuntimeExceptionTestsBehaviour get() = PASS
616616
override val allItems: List<RuntimeExceptionTestsBehaviour> = values().toList()
617617
}
618618
}

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/CgAbstractRenderer.kt

+6-11
Original file line numberDiff line numberDiff line change
@@ -408,19 +408,14 @@ abstract class CgAbstractRenderer(
408408

409409
val isBlockTooLarge = workaround(LONG_CODE_FRAGMENTS) { block.size > LARGE_CODE_BLOCK_SIZE }
410410

411-
if (isBlockTooLarge) {
412-
print("/*")
413-
println(" This block of code is ${block.size} lines long and could lead to compilation error")
414-
}
415-
416-
withIndent {
417-
for (statement in block) {
418-
statement.accept(this)
411+
if (!isBlockTooLarge) {
412+
withIndent {
413+
for (statement in block) {
414+
statement.accept(this)
415+
}
419416
}
420417
}
421418

422-
if (isBlockTooLarge) println("*/")
423-
424419
print("}")
425420

426421
if (printNextLine) println()
@@ -982,6 +977,6 @@ abstract class CgAbstractRenderer(
982977
/**
983978
* @see [LONG_CODE_FRAGMENTS]
984979
*/
985-
private const val LARGE_CODE_BLOCK_SIZE: Int = 1000
980+
private const val LARGE_CODE_BLOCK_SIZE: Int = 150
986981
}
987982
}

utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/utils/StringUtils.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ import java.nio.file.FileSystems
44

55

66
fun String.toRelativeRawPath(): String {
7-
return "os.path.dirname(__file__) + r'${FileSystems.getDefault().separator}${this}'"
7+
val dirname = "os.path.dirname(__file__)"
8+
if (this.isEmpty()) {
9+
return dirname
10+
}
11+
return "$dirname + r'${FileSystems.getDefault().separator}${this}'"
812
}

0 commit comments

Comments
 (0)