From 1f22720c3f6bf28a44ee0e3a9a9abd52e9debe64 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 1 Dec 2007 15:25:24 +0300 Subject: Fixed the floating point number tests on Windows. mysql-test/r/insert.result: Fixed the test cases. mysql-test/t/cast.test: We need to do replace_result because warnings are printed by another procedure. mysql-test/t/insert.test: Windows implements a different rounding rules in printf("%g"), thus we still need to do replace_result. sql/field.cc: Limit the precision to avoid garbage past the significant digits. --- mysql-test/t/cast.test | 2 ++ mysql-test/t/insert.test | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index fecb8677d51..316b79efe4d 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -177,6 +177,8 @@ select cast(1.0e+300 as signed int); CREATE TABLE t1 (f1 double); INSERT INTO t1 SET f1 = -1.0e+30 ; INSERT INTO t1 SET f1 = +1.0e+30 ; +# Expected result is +-1e+30, but Windows returns +-1e+030. +--replace_result 1e+030 1e+30 SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1; DROP TABLE t1; diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index cf67935768a..3c150d0c3f6 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -386,7 +386,9 @@ INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3); INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2); INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0); INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0); - +# Expected results are "12.2" and "1.2e+78", but Windows returns "12.3" and +# "1.3e+78" due to different rounding rules +--replace_result 12.3 12.2 1.3e+78 1.2e+78 SELECT * FROM t1; DROP TABLE t1; -- cgit v1.2.1