File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
main/kotlin/eu/afse/jsonlogic
test/kotlin/eu/afse/jsonlogic Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ class JsonLogic {
230
230
231
231
private fun compareStrict (a : Comparable <* >? , b : Comparable <* >? ) = when {
232
232
a is Number && b is Number -> compareValues(a.toDouble(), b.toDouble())
233
- a is String && b is String -> compareValues(a.doubleValue , b.doubleValue )
233
+ a is String && b is String -> compareValues(a.unStringify , b.unStringify )
234
234
else -> - 1
235
235
}
236
236
Original file line number Diff line number Diff line change @@ -154,4 +154,13 @@ class JsonLogicTests {
154
154
val result = jsonLogic.apply (mapOf (" pow" to listOf (3 ,2 )))
155
155
assertEquals(" 9.0" , result)
156
156
}
157
+
158
+ @Test
159
+ fun stringComparisonBug () {
160
+ val jsonLogic = JsonLogic ()
161
+ val logic = mapOf (" ===" to listOf (mapOf (" var" to listOf (" a" )), " two" ))
162
+ val data = mapOf (" a" to " one" )
163
+ val result = jsonLogic.apply (logic, data)
164
+ assertEquals(" false" , result)
165
+ }
157
166
}
You can’t perform that action at this time.
0 commit comments