mirror of https://github.com/rusefi/lua.git
More generic pattern when testing 'string.format'
The result of 'string.format("%a", 0.0)' can have multiple zeros after the dot.
This commit is contained in:
parent
5f83fb6582
commit
6f1c033d72
|
@ -309,8 +309,8 @@ do print("testing 'format %a %A'")
|
||||||
matchhexa(n)
|
matchhexa(n)
|
||||||
end
|
end
|
||||||
|
|
||||||
assert(string.find(string.format("%A", 0.0), "^0X0%.?0?P%+?0$"))
|
assert(string.find(string.format("%A", 0.0), "^0X0%.?0*P%+?0$"))
|
||||||
assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0?p%+?0$"))
|
assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0*p%+?0$"))
|
||||||
|
|
||||||
if not _port then -- test inf, -inf, NaN, and -0.0
|
if not _port then -- test inf, -inf, NaN, and -0.0
|
||||||
assert(string.find(string.format("%a", 1/0), "^inf"))
|
assert(string.find(string.format("%a", 1/0), "^inf"))
|
||||||
|
|
Loading…
Reference in New Issue