Skip to content

Commit

Permalink
feat(CompareCommand): Add the SEMANTIC_DIFF as a new compare method
Browse files Browse the repository at this point in the history
The new compare method `SEMANTIC_DIFF` can be used for comparing the
ORT results on the object level. Currently, it only checks whether
the provided ORT results are equal. There will a improved comparison
of the results in the upcoming commit(s).

Signed-off-by: Onur Demirci <[email protected]>
  • Loading branch information
bs-ondem committed Nov 27, 2023
1 parent ef3aa81 commit 9597966
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion plugins/commands/compare/src/main/kotlin/CompareCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,27 @@ class CompareCommand : OrtCommand(

throw ProgramResult(1)
}

CompareMethod.SEMANTIC_DIFF -> {
echo(
"The '${CompareMethod.SEMANTIC_DIFF}' compare method is not fully implemented. Some properties" +
" may not be taken into account in the comparison."
)

if (resultA == resultB) {
echo("The ORT results are the same.")
throw ProgramResult(0)
}

throw ProgramResult(1)
}
}
}
}

private enum class CompareMethod {
TEXT_DIFF
TEXT_DIFF,
SEMANTIC_DIFF
}

private class InvariantInstantSerializer : StdSerializer<Instant>(Instant::class.java) {
Expand Down

0 comments on commit 9597966

Please sign in to comment.