summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/round.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/round.test
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/round.test')
-rw-r--r--mysql-test/main/round.test145
1 files changed, 145 insertions, 0 deletions
diff --git a/mysql-test/main/round.test b/mysql-test/main/round.test
new file mode 100644
index 00000000..4ba65c08
--- /dev/null
+++ b/mysql-test/main/round.test
@@ -0,0 +1,145 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (sint8 tinyint not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('127.4');
+INSERT IGNORE INTO t1 VALUES ('127.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('-127.4');
+INSERT INTO t1 VALUES ('-127.5');
+INSERT INTO t1 VALUES ('-128.4');
+INSERT IGNORE INTO t1 VALUES ('-128.5');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (uint8 tinyint unsigned not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('127.4');
+INSERT INTO t1 VALUES ('127.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('255.4');
+INSERT IGNORE INTO t1 VALUES ('255.5');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (sint16 smallint not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('32767.4');
+INSERT IGNORE INTO t1 VALUES ('32767.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('-32767.4');
+INSERT INTO t1 VALUES ('-32767.5');
+INSERT INTO t1 VALUES ('-32768.4');
+INSERT IGNORE INTO t1 VALUES ('-32768.5');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (uint16 smallint unsigned not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('32767.4');
+INSERT INTO t1 VALUES ('32767.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('65535.4');
+INSERT IGNORE INTO t1 VALUES ('65535.5');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (sint24 mediumint not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('8388607.4');
+INSERT IGNORE INTO t1 VALUES ('8388607.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('-8388607.4');
+INSERT INTO t1 VALUES ('-8388607.5');
+INSERT INTO t1 VALUES ('-8388608.4');
+INSERT IGNORE INTO t1 VALUES ('-8388608.5');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (uint24 mediumint unsigned not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('8388607.4');
+INSERT INTO t1 VALUES ('8388607.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('16777215.4');
+INSERT IGNORE INTO t1 VALUES ('16777215.5');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (sint64 bigint not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('9223372036854775807.4');
+INSERT IGNORE INTO t1 VALUES ('9223372036854775807.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('-9223372036854775807.4');
+INSERT INTO t1 VALUES ('-9223372036854775807.5');
+INSERT INTO t1 VALUES ('-9223372036854775808.4');
+INSERT IGNORE INTO t1 VALUES ('-9223372036854775808.5');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (uint64 bigint unsigned not null);
+INSERT INTO t1 VALUES ('0.1');
+INSERT INTO t1 VALUES ('0.5');
+INSERT INTO t1 VALUES ('9223372036854775807.4');
+INSERT INTO t1 VALUES ('9223372036854775807.5');
+INSERT INTO t1 VALUES ('-0.1');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
+INSERT INTO t1 VALUES ('18446744073709551615.4');
+INSERT IGNORE INTO t1 VALUES ('18446744073709551615.5');
+INSERT INTO t1 VALUES ('1844674407370955161.0');
+INSERT INTO t1 VALUES ('1844674407370955161.1');
+INSERT INTO t1 VALUES ('1844674407370955161.2');
+INSERT INTO t1 VALUES ('1844674407370955161.3');
+INSERT INTO t1 VALUES ('1844674407370955161.4');
+INSERT INTO t1 VALUES ('1844674407370955161.5');
+INSERT INTO t1 VALUES ('1844674407370955161.0e1');
+INSERT INTO t1 VALUES ('1844674407370955161.1e1');
+INSERT INTO t1 VALUES ('1844674407370955161.2e1');
+INSERT INTO t1 VALUES ('1844674407370955161.3e1');
+INSERT INTO t1 VALUES ('1844674407370955161.4e1');
+INSERT INTO t1 VALUES ('1844674407370955161.5e1');
+INSERT INTO t1 VALUES ('18446744073709551610e-1');
+INSERT INTO t1 VALUES ('18446744073709551611e-1');
+INSERT INTO t1 VALUES ('18446744073709551612e-1');
+INSERT INTO t1 VALUES ('18446744073709551613e-1');
+INSERT INTO t1 VALUES ('18446744073709551614e-1');
+INSERT INTO t1 VALUES ('18446744073709551615e-1');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (str varchar(128), sint64 bigint not null default 0);
+INSERT INTO t1 (str) VALUES ('1.5');
+INSERT INTO t1 (str) VALUES ('1.00005e4');
+INSERT INTO t1 (str) VALUES ('1.0005e3');
+INSERT INTO t1 (str) VALUES ('1.005e2');
+INSERT INTO t1 (str) VALUES ('1.05e1');
+INSERT INTO t1 (str) VALUES ('1.5e0');
+INSERT INTO t1 (str) VALUES ('100005e-1');
+INSERT INTO t1 (str) VALUES ('100050e-2');
+INSERT INTO t1 (str) VALUES ('100500e-3');
+INSERT INTO t1 (str) VALUES ('105000e-4');
+INSERT INTO t1 (str) VALUES ('150000e-5');
+UPDATE t1 SET sint64=str;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+