aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2023-01-12 15:40:34 -0500
committerGitHub <noreply@github.com>2023-01-12 15:40:34 -0500
commit3992a13f24fec116cd4d0920dfd51abaf76a207e (patch)
treeca6cd05671c8dc4d2255673576688c4de022e68e /games/devtest/mods
parent5f2925c59cb3b6fa580e565e2d5a4dad3c400eeb (diff)
downloadminetest-3992a13f24fec116cd4d0920dfd51abaf76a207e.tar.xz
Improve `MetaDataRef:{get,set}_float` precision (#13130)
Diffstat (limited to 'games/devtest/mods')
-rw-r--r--games/devtest/mods/unittests/metadata.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/games/devtest/mods/unittests/metadata.lua b/games/devtest/mods/unittests/metadata.lua
index 2246469ed..6b0dcf04a 100644
--- a/games/devtest/mods/unittests/metadata.lua
+++ b/games/devtest/mods/unittests/metadata.lua
@@ -63,6 +63,13 @@ local function test_metadata(meta)
assert(meta:get_float("h") > 1)
assert(meta:get_string("i") == "${f}")
+ meta:set_float("j", 1.23456789)
+ assert(meta:get_float("j") == 1.23456789)
+ meta:set_float("j", -1 / 0)
+ assert(meta:get_float("j") == -1 / 0)
+ meta:set_float("j", 0 / 0)
+ assert(core.is_nan(meta:get_float("j")))
+
meta:from_table()
assert(next(meta:to_table().fields) == nil)
assert(#meta:get_keys() == 0)