Skip to content

Commit

Permalink
[WIP] Dev sync
Browse files Browse the repository at this point in the history
  • Loading branch information
zishkaz committed Aug 7, 2024
1 parent 8d8ed58 commit 979e1e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion usvm-ts/src/main/kotlin/org/usvm/TSExprResolver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TSExprResolver(
fun resolveLValue(value: EtsValue): ULValue<*, *>? =
when (value) {
is EtsParameterRef,
is EtsLocal -> simpleValueResolver.resolveLocal(value)
is EtsLocal, -> simpleValueResolver.resolveLocal(value)

Check warning

Code scanning / detekt

Rule to mandate/forbid trailing commas at declaration sites Warning

Expected a newline between the trailing comma and "->"
else -> error("Unexpected value: $value")
}

Expand Down
15 changes: 8 additions & 7 deletions usvm-ts/src/test/kotlin/org/usvm/util/TSMethodTestRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ open class TSMethodTestRunner : TestRunner<TSTest, MethodDescriptor, EtsType?, T
)
}

/*
For now type checks are disabled for development purposes
See https://github.com/UnitTestBot/usvm/issues/203
*/
override val checkType: (EtsType?, EtsType?) -> Boolean
get() = { _, _ -> true }

override val typeTransformer: (Any?) -> EtsType
get() = {
// Both KClass and TSObject instances come here
Expand All @@ -108,13 +116,6 @@ open class TSMethodTestRunner : TestRunner<TSTest, MethodDescriptor, EtsType?, T
}
}

/*
For now type checks are disabled for development purposes
TODO: implement
*/
override val checkType: (EtsType?, EtsType?) -> Boolean
get() = { _, _ -> true }

private fun getProject(fileName: String): EtsFile {
val jsonWithoutExtension = "/ir/$fileName.json"
val sampleFilePath = javaClass.getResourceAsStream(jsonWithoutExtension)
Expand Down
3 changes: 2 additions & 1 deletion usvm-ts/src/test/kotlin/org/usvm/util/TSTestResolver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class TSTestResolver {
val model = state.models.first()
when (val methodResult = state.methodResult) {

Check warning

Code scanning / detekt

Braces do not comply with the specified policy Warning test

Inconsistent braces, make sure all branches either have or don't have braces.
is TSMethodResult.Success -> {
val returnValue = resolveExpr(model.eval(methodResult.value), method.returnType)
val valueToResolve = model.eval(methodResult.value)
val returnValue = resolveExpr(valueToResolve, method.returnType)
val params = method.parameters.mapIndexed { idx, param ->
val lValue = URegisterStackLValue(typeToSort(param.type), idx)
val expr = model.read(lValue)
Expand Down

0 comments on commit 979e1e5

Please sign in to comment.