Skip to content

Commit

Permalink
Update test integ
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricereix authored and hurl-bot committed Dec 14, 2023
1 parent 112d0e9 commit 9f0894e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
30 changes: 21 additions & 9 deletions integration/hurl/tests_ok/predicates_number.hurl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# testing predicates
# on the number types: integer and float
# on the number types: integer, float and big integer
GET http://localhost:8000/predicates-number

HTTP 200
Expand All @@ -25,17 +25,29 @@ jsonpath "$.float" != null

# 0.1 in 64-bit floating-point format is really 0.10000000000000000555111512312578270211815834045410
# both 0.1 and 0.100000000000000005 have the same 64-bit float value
jsonpath "$.float2" == 0.1
jsonpath "$.float2" == 0.10000000000000000555111512312578270211815834045410
jsonpath "$.float2" == 0.100000000000000005
jsonpath "$.float2" < 0.1000000000000001
jsonpath "$.float3" == 0.1
jsonpath "$.float3" == 0.100000000000000005
jsonpath "$.small_float1" isFloat
jsonpath "$.small_float1" == 0.1
jsonpath "$.small_float1" == 0.10000000000000000555111512312578270211815834045410
jsonpath "$.small_float1" == 0.100000000000000005
jsonpath "$.small_float1" > 0.0999999940395355224609375000000000000000
jsonpath "$.small_float2" == 0.1

# 1000000000000000000000.5 is really 1000000000000000000000.0 if 64-bit float
jsonpath "$.big_float1" isFloat
jsonpath "$.big_float1" == 1000000000000000000000.0
jsonpath "$.big_float1" == 1000000000000000000000.5
jsonpath "$.big_float2" == 1000000000000000000000.0

jsonpath "$.big_integer" == 1000000000000000000000
jsonpath "$.big_integer" isInteger

{
"integer": 1,
"float": 1.0,
"float2": 0.1,
"float3": 0.100000000000000005
"small_float1": 0.1,
"small_float2": 0.100000000000000005,
"big_float1": 1000000000000000000000.0,
"big_float2": 1000000000000000000000.5,
"big_integer": 1000000000000000000000
}

7 changes: 5 additions & 2 deletions integration/hurl/tests_ok/predicates_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ def predicates_number():
"""{
"integer": 1,
"float": 1.0,
"float2": 0.1,
"float3": 0.100000000000000005
"small_float1": 0.1,
"small_float2": 0.100000000000000005,
"big_float1": 1000000000000000000000.0,
"big_float2": 1000000000000000000000.5,
"big_integer": 1000000000000000000000
}""",
mimetype="application/json",
)

0 comments on commit 9f0894e

Please sign in to comment.