Skip to content

Commit

Permalink
test(mtr): optimize func_sec_to_time.test and alter_table_v1.test(sto…
Browse files Browse the repository at this point in the history
  • Loading branch information
davidshiz authored and konghaiya committed Mar 7, 2023
1 parent 7a5bbc0 commit ea180f5
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
24 changes: 14 additions & 10 deletions mysql-test/suite/tianmu/r/alter_table_v1.result
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#
# Test of alter table
#
DROP DATABASE IF EXISTS alter_table_v1_test;
CREATE DATABASE alter_table_v1_test;
USE alter_table_v1_test;
create table t1 (bandID MEDIUMINT NOT NULL PRIMARY KEY, payoutID SMALLINT NOT NULL);
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
alter table t1 add column new_col int, order by payoutid,bandid;
Expand Down Expand Up @@ -52,30 +55,30 @@ i
4
drop table t1;
#
# 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1
# 'alter table t1 rename alter_table_v1_test1.t1' silently drops alter_table_v1_test1.t1
# if it exists
#
create table t1 (name char(15));
insert into t1 (name) values ("current");
create database mysqltest;
create table mysqltest.t1 (name char(15));
insert into mysqltest.t1 (name) values ("mysqltest");
create database alter_table_v1_test1;
create table alter_table_v1_test1.t1 (name char(25));
insert into alter_table_v1_test1.t1 (name) values ("alter_table_v1_test1");
select * from t1;
name
current
select * from mysqltest.t1;
select * from alter_table_v1_test1.t1;
name
mysqltest
alter table t1 rename mysqltest.t1;
alter_table_v1_test1
alter table t1 rename alter_table_v1_test1.t1;
ERROR 42S01: Table 't1' already exists
select * from t1;
name
current
select * from mysqltest.t1;
select * from alter_table_v1_test1.t1;
name
mysqltest
alter_table_v1_test1
drop table t1;
drop database mysqltest;
drop database alter_table_v1_test1;
#
# ALTER TABLE ... ENABLE/DISABLE KEYS
#
Expand Down Expand Up @@ -110,3 +113,4 @@ ERROR 42000: Incorrect table name ''
rename table t1 to ``;
ERROR 42000: Incorrect table name ''
drop table t1;
DROP DATABASE alter_table_v1_test;
4 changes: 4 additions & 0 deletions mysql-test/suite/tianmu/r/func_sec_to_time.result
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#
# SEC_TO_TIME(double_or_float)
#
DROP DATABASE IF EXISTS func_sec_to_time_test;
CREATE DATABASE func_sec_to_time_test;
USE func_sec_to_time_test;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (0.000025e-35);
INSERT INTO t1 VALUES (-1),(1);
Expand All @@ -16,3 +19,4 @@ a SEC_TO_TIME(a)
900 00:15:00.000000
1000000 277:46:40.000000
DROP TABLE t1;
DROP DATABASE func_sec_to_time_test;
26 changes: 18 additions & 8 deletions mysql-test/suite/tianmu/t/alter_table_v1.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
--echo # Test of alter table
--echo #

--disable_warnings
DROP DATABASE IF EXISTS alter_table_v1_test;
--enable_warnings

CREATE DATABASE alter_table_v1_test;
USE alter_table_v1_test;


create table t1 (bandID MEDIUMINT NOT NULL PRIMARY KEY, payoutID SMALLINT NOT NULL);
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
alter table t1 add column new_col int, order by payoutid,bandid;
Expand Down Expand Up @@ -33,23 +41,23 @@ select * from t1;
drop table t1;

--echo #
--echo # 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1
--echo # 'alter table t1 rename alter_table_v1_test1.t1' silently drops alter_table_v1_test1.t1
--echo # if it exists
--echo #

create table t1 (name char(15));
insert into t1 (name) values ("current");
create database mysqltest;
create table mysqltest.t1 (name char(15));
insert into mysqltest.t1 (name) values ("mysqltest");
create database alter_table_v1_test1;
create table alter_table_v1_test1.t1 (name char(25));
insert into alter_table_v1_test1.t1 (name) values ("alter_table_v1_test1");
select * from t1;
select * from mysqltest.t1;
select * from alter_table_v1_test1.t1;
--error ER_TABLE_EXISTS_ERROR
alter table t1 rename mysqltest.t1;
alter table t1 rename alter_table_v1_test1.t1;
select * from t1;
select * from mysqltest.t1;
select * from alter_table_v1_test1.t1;
drop table t1;
drop database mysqltest;
drop database alter_table_v1_test1;

--echo #
--echo # ALTER TABLE ... ENABLE/DISABLE KEYS
Expand Down Expand Up @@ -85,4 +93,6 @@ alter table t1 rename to ``;
rename table t1 to ``;
drop table t1;

# Clean UP
DROP DATABASE alter_table_v1_test;

10 changes: 10 additions & 0 deletions mysql-test/suite/tianmu/t/func_sec_to_time.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
--echo # SEC_TO_TIME(double_or_float)
--echo #

--disable_warnings
DROP DATABASE IF EXISTS func_sec_to_time_test;
--enable_warnings

CREATE DATABASE func_sec_to_time_test;
USE func_sec_to_time_test;

CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (0.000025e-35);
INSERT INTO t1 VALUES (-1),(1);
INSERT INTO t1 VALUES (-900),(900);
INSERT INTO t1 VALUES (-1000000),(1000000);
SELECT a, SEC_TO_TIME(a) FROM t1 ORDER BY 1;
DROP TABLE t1;

# Clean UP
DROP DATABASE func_sec_to_time_test;

0 comments on commit ea180f5

Please sign in to comment.