Skip to content

Commit

Permalink
travis db tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ifsnop committed Sep 12, 2014
1 parent 14cee4d commit 420ae16
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
- mysql -e 'create database mysqldump;'

script:
- php src/Ifsnop/Mysqldump/Mysqldump.php
- cd tests && ./test.sh
1 change: 0 additions & 1 deletion tests/.gitkeep

This file was deleted.

57 changes: 24 additions & 33 deletions tests/tests.sql → tests/original.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,16 @@ CREATE TABLE `test000` (
`col15` double DEFAULT NULL,
`col27` varchar(6) DEFAULT NULL
);
INSERT INTO `test000` VALUES (1,
1,
-128,
255,
-9223372036854775808,
18446744073709551615,
-2.2250738585072014e-308,
"0abcde");


INSERT INTO `test000` VALUES (1,0x01,-128,255,-9223372036854775808,18446744073709551615,-2.2250738585072014e-308,'0abcde');

DROP TABLE IF EXISTS `test001`;
CREATE TABLE `test001` (
`id` int,
`col` bit(1) DEFAULT NULL
);
INSERT INTO `test001` VALUES (1,NULL);
INSERT INTO `test001` VALUES (2,0);
INSERT INTO `test001` VALUES (3,1);
INSERT INTO `test001` VALUES (2,0x00);
INSERT INTO `test001` VALUES (3,0x01);

DROP TABLE IF EXISTS `test002`;
CREATE TABLE `test002` (
Expand All @@ -58,18 +49,18 @@ CREATE TABLE `test010` (
`col` bigint DEFAULT NULL
);
INSERT INTO `test010` VALUES (1,NULL);
INSERT INTO `test010` VALUES (2,9223372036854775808);
INSERT INTO `test010` VALUES (3, 0);
INSERT INTO `test010` VALUES (4, 9223372036854775807);
INSERT INTO `test010` VALUES (2,-9223372036854775808);
INSERT INTO `test010` VALUES (3,0);
INSERT INTO `test010` VALUES (4,9223372036854775807);

DROP TABLE IF EXISTS `test011`;
CREATE TABLE `test011` (
`id` int,
`col` bigint UNSIGNED DEFAULT NULL
);
INSERT INTO `test011` VALUES (1,NULL);
INSERT INTO `test011` VALUES (3, 0);
INSERT INTO `test011` VALUES (4, 18446744073709551615);
INSERT INTO `test011` VALUES (3,0);
INSERT INTO `test011` VALUES (4,18446744073709551615);


DROP TABLE IF EXISTS `test015`;
Expand All @@ -78,11 +69,11 @@ CREATE TABLE `test015` (
`col` double DEFAULT NULL
);
INSERT INTO `test015` VALUES (1,NULL);
INSERT INTO `test015` VALUES (2, -1.7976931348623157e308);
INSERT INTO `test015` VALUES (3, -2.2250738585072014e-308);
INSERT INTO `test015` VALUES (2,-1.7976931348623157e308);
INSERT INTO `test015` VALUES (3,-2.2250738585072014e-308);
INSERT INTO `test015` VALUES (4,0);
INSERT INTO `test015` VALUES (5, 2.2250738585072014e-308);
INSERT INTO `test015` VALUES (6, 1.7976931348623157e308);
INSERT INTO `test015` VALUES (5,2.2250738585072014e-308);
INSERT INTO `test015` VALUES (6,1.7976931348623157e308);


DROP TABLE IF EXISTS `test027`;
Expand All @@ -91,30 +82,30 @@ CREATE TABLE `test027` (
`col` varchar(6) DEFAULT NULL
);
INSERT INTO `test027` VALUES (1,NULL);
INSERT INTO `test027` VALUES (2, '');
INSERT INTO `test027` VALUES (3, '0');
INSERT INTO `test027` VALUES (4, '2e308');
INSERT INTO `test027` VALUES (5, '999.99');
INSERT INTO `test027` VALUES (6, '-2e-30');
INSERT INTO `test027` VALUES (7, '-99.99');
INSERT INTO `test027` VALUES (8, '0');
INSERT INTO `test027` VALUES (9, '0abcde');
INSERT INTO `test027` VALUES (10, '123');
INSERT INTO `test027` VALUES (2,'');
INSERT INTO `test027` VALUES (3,'0');
INSERT INTO `test027` VALUES (4,'2e308');
INSERT INTO `test027` VALUES (5,'999.99');
INSERT INTO `test027` VALUES (6,'-2e-30');
INSERT INTO `test027` VALUES (7,'-99.99');
INSERT INTO `test027` VALUES (8,'0');
INSERT INTO `test027` VALUES (9,'0abcde');
INSERT INTO `test027` VALUES (10,'123');

DROP TABLE IF EXISTS `test029`;
CREATE TABLE `test029` (
`id` int,
`col` blob NOT NULL
);
INSERT INTO `test029` VALUES (1,0x000102030405060708090A0B0C0D0E0F);
INSERT INTO `test029` VALUES (1,'');
INSERT INTO `test029` VALUES (2,'');

DROP TABLE IF EXISTS `test033`;
CREATE TABLE `test033` (
`id` int,
`col` text NOT NULL
);
INSERT INTO `test033` VALUES (1,0x000102030405060708090A0B0C0D0E0F);
INSERT INTO `test033` VALUES (1,'test test test');


DROP VIEW IF EXISTS `test100`;
Expand All @@ -133,5 +124,5 @@ CREATE TABLE `test200` (
CREATE TRIGGER before_test200_insert
BEFORE insert ON `test200`
FOR EACH ROW set NEW.col = NEW.col + 1;
INSERT INTO `test200` VALUES (1,1);

-- INSERT INTO `test200` VALUES (1,1); -- trigger tests
19 changes: 19 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
mysql -uroot < original.sql
mysqldump -uroot test001 --extended-insert=false --hex-blob=true > mysqldump.sql

cat original.sql | grep ^INSERT > original.filtered.sql
cat mysqldump.sql | grep ^INSERT > mysqldump.filtered.sql

diff original.filtered.sql mysqldump.filtered.sql

ret=$?

rm original.filtered.sql
rm mysqldump.filtered.sql
rm mysqldump.sql

echo $ret




0 comments on commit 420ae16

Please sign in to comment.