From cfaafe5af11d61e7a0ba92680de2274bfdf3bc43 Mon Sep 17 00:00:00 2001 From: Boku Kihara Date: Thu, 30 May 2024 19:44:33 +0900 Subject: [PATCH] Fixed tests to handle zero matching in OTP 27 Starting from OTP 27, `0.0` no longer matches `-0.0`, so several tests need explicit `-` signs. Also added `+` signs to suppress warnings requiring explicit `+0.0` for matching. --- test/construction/float.erl | 26 +++++++++++++------------- test/construction/float_yaml11.erl | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/construction/float.erl b/test/construction/float.erl index 05b3fcb..fc44945 100644 --- a/test/construction/float.erl +++ b/test/construction/float.erl @@ -41,7 +41,7 @@ schema_failsafe_float_json_simple_test_() -> ?_assertMatch( [ [ - 0.0, "+0", 0.0, + +0.0, "+0", +0.0, 123.0, "+123", -123.0, 12.34, "+12.34", -12.34, 1.2e+11, "+12e10", -1.2e+11, @@ -69,7 +69,7 @@ schema_failsafe_float_simple_test_() -> ?_assertMatch( [ [ - 0.0, 0.0, 0.0, + +0.0, +0.0, -0.0, 123.0, 123.0, -123.0, 12.34, 12.34, -12.34, 1.2e+11, 1.2e+11, -1.2e+11, @@ -97,13 +97,13 @@ schema_failsafe_float_ext_simple_test_() -> ?_assertMatch( [ [ - 0.0, 0.0, 0.0, + +0.0, +0.0, -0.0, "123", "+123", "-123", 12.34, 12.34, -12.34, "12e10", "+12e10", "-12e10", "1.2e11", 1.2e+11, 1.2e-11, "1.0e10", "1.0E10", - ".", 0.1, 0.0, 1.0, 1000.0, + ".", 0.1, +0.0, 1.0, 1000.0, 685230.15, 685230.15, -685230.15, '+inf', '+inf', '-inf', 'nan', '+inf', '+inf', ".iNF", @@ -263,14 +263,14 @@ schema_failsafe_float_json_detailed_test_() -> {yamerl_float,yamerl_node_float_json, "tag:yaml.org,2002:float", [{line,1},{column,4}], - 0.0}, + +0.0}, {yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str", [{line,2},{column,3}], "+0"}, {yamerl_float,yamerl_node_float_json, "tag:yaml.org,2002:float", [{line,3},{column,3}], - 0.0}, + +0.0}, {yamerl_float,yamerl_node_float_json, "tag:yaml.org,2002:float", [{line,5},{column,4}], @@ -414,13 +414,13 @@ schema_failsafe_float_detailed_test_() -> [ {yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float", [{line,1},{column,4}], - 0.0}, + +0.0}, {yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float", [{line,2},{column,3}], - 0.0}, + +0.0}, {yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float", [{line,3},{column,3}], - 0.0}, + -0.0}, {yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float", [{line,5},{column,4}], 123.0}, @@ -549,15 +549,15 @@ schema_failsafe_float_ext_detailed_test_() -> {yamerl_float,yamerl_node_float_ext, "tag:yaml.org,2002:float", [{line,1},{column,4}], - 0.0}, + +0.0}, {yamerl_float,yamerl_node_float_ext, "tag:yaml.org,2002:float", [{line,2},{column,3}], - 0.0}, + +0.0}, {yamerl_float,yamerl_node_float_ext, "tag:yaml.org,2002:float", [{line,3},{column,3}], - 0.0}, + -0.0}, {yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str", [{line,5},{column,4}], "123"}, @@ -615,7 +615,7 @@ schema_failsafe_float_ext_detailed_test_() -> {yamerl_float,yamerl_node_float_ext, "tag:yaml.org,2002:float", [{line,26},{column,4}], - 0.0}, + +0.0}, {yamerl_float,yamerl_node_float_ext, "tag:yaml.org,2002:float", [{line,27},{column,3}], diff --git a/test/construction/float_yaml11.erl b/test/construction/float_yaml11.erl index 72588e5..3aea1b8 100644 --- a/test/construction/float_yaml11.erl +++ b/test/construction/float_yaml11.erl @@ -18,7 +18,7 @@ schema_failsafe_float_ext_simple_test_() -> "12e10", "+12e10", "-12e10", "1.2e11", 1.2e+11, 1.2e-11, "1.0e10", "1.0E10", - ".", 0.1, 0.0, 1.0, 1000.0, + ".", 0.1, +0.0, 1.0, 1000.0, 685230.15, 685230.15, -685230.15, '+inf', '+inf', '-inf', 'nan', '+inf', '+inf', ".iNF", @@ -88,7 +88,7 @@ schema_failsafe_float_ext_detailed_test_() -> {yamerl_float,yamerl_node_float_ext, "tag:yaml.org,2002:float", [{line,20},{column,4}], - 0.0}, + +0.0}, {yamerl_float,yamerl_node_float_ext, "tag:yaml.org,2002:float", [{line,21},{column,3}],