List:Commits« Previous MessageNext Message »
From:Serge Kozlov Date:May 25 2009 8:03pm
Subject:bzr push into nuts branch (Serge.Kozlov:319 to 320) WL#4854
View as plain text  
  320 Serge Kozlov	2009-05-26
      WL#4854, final patch:
      1. Added support of random values for data types. Now matrix.pl can generate random values via subroutine get_random_value();
      2. Number of random values defined in config file.
      modified:
        suites/rep/data_types/config_eq.pl
        suites/rep/data_types/data_types.conf
        suites/rep/data_types/matrix.pl
        suites/rep/data_types_eq.pm

  319 Serge Kozlov	2009-05-25
      WL#4840, WL#4845, WL#4846:
      Data type matrix and test cases.
      added:
        suites/rep/data_types/
        suites/rep/data_types/config_eq.pl
        suites/rep/data_types/config_main.pl
        suites/rep/data_types/data_types.conf
        suites/rep/data_types/matrix.dat
        suites/rep/data_types/matrix.pl
        suites/rep/data_types_eq.pm
        suites/rep/data_types_main.pm

=== modified file 'suites/rep/data_types/config_eq.pl'
--- a/suites/rep/data_types/config_eq.pl	2009-05-25 09:52:14 +0000
+++ b/suites/rep/data_types/config_eq.pl	2009-05-25 20:02:11 +0000
@@ -7,6 +7,10 @@ BEGIN { }
 # Record matrix
 our $record= 0;
 
+# Number of test values for data type (it is included 
+# also ranges and values from data_types.conf)
+our $test_values_num= 50;
+
 # Paths to files
 our $data_types_config_file= "./suites/rep/data_types/data_types.conf";
 our $error_messages_file= $Parameters::build . "/sql/share/errmsg.txt";
@@ -18,11 +22,13 @@ our $server_options = [
 	"name" => "engine",
 	"affected" => "master,slave",
 	"values" => ["MyISAM", "InnoDB", "MEMORY"],
+#	"values" => ["MyISAM"],
     },
     {
 	"name" => "binlog_format",
 	"affected" => "master",
 	"values" => ["MIXED", "STATEMENT", "ROW"],
+#	"values" => ["MIXED"],
     },
 ];
 

=== modified file 'suites/rep/data_types/data_types.conf'
--- a/suites/rep/data_types/data_types.conf	2009-05-25 09:52:14 +0000
+++ b/suites/rep/data_types/data_types.conf	2009-05-25 20:02:11 +0000
@@ -1,151 +1,167 @@
 [BIT]
 group: numeric
-values: 0b0000000000000000000000000000000000000000000000000000000000000000, 0b1111111111111111111111111111111111111111111111111111111111111111
+ranges: 0b0000000000000000000000000000000000000000000000000000000000000000..0b1111111111111111111111111111111111111111111111111111111111111111
 
 [TINYINT SIGNED]
 group: numeric
-values: -128, 0, 127
+ranges: -128..127
+values: 0
 
 [TINYINT UNSIGNED]
 group: numeric
-values: 0, 255
+ranges: 0..255
 
 [SMALLINT SIGNED]
 group: numeric
-values: -32768, 0, 32767
+ranges: -32768..32767
+values: 0
 
 [SMALLINT UNSIGNED]
 group: numeric
-values: 0, 65535
+ranges: 0..65535
 
 [MEDIUMINT SIGNED]
 group: numeric
-values: -8388608, 0, 8388607
+ranges: -8388608..8388607
+values: 0
 
 [MEDIUMINT UNSIGNED]
 group: numeric
-values: 0, 16777215
+ranges: 0..16777215
 
 [INT SIGNED]
 group: numeric
-values: -2147483648, 0, 2147483647
+ranges: -2147483648..2147483647
+values: 0
 
 [INT UNSIGNED]
 group: numeric
-values: 0, 4294967295
+ranges: 0..4294967295
 
 [BIGINT SIGNED]
 group: numeric
-values: -9223372036854775808, 0, 9223372036854775807
+ranges: -9223372036854775808..9223372036854775807
+values: 0
 
 [BIGINT UNSIGNED]
 group: numeric
-values: 0, 18446744073709551615
+ranges: 0..18446744073709551615
 
 [FLOAT SIGNED]
 group: numeric
-values: -3.402823466E+38, -1.175494351E-38, 0, 1.175494351E-38, 3.402823466E+38
+ranges: -3.402823466E+38..-1.175494351E-38, 0, 1.175494351E-38..3.402823466E+38
 
 [FLOAT UNSIGNED]
 group: numeric
-values: 0, 1.175494351E-38, 3.402823466E+38
+ranges: 0, 1.175494351E-38..3.402823466E+38
 
 [DOUBLE SIGNED]
 group: numeric
-values: -1.7976931348623157e+308, -2.2250738585072014E-308, 0, 2.2250738585072014E-308, 1.7976931348623157e+308
+ranges: -1.7976931348623157E+308..-2.2250738585072014E-308, 0, 2.2250738585072014E-308..1.7976931348623157e+308
 
 [DOUBLE UNSIGNED]
 group: numeric
-values: 0, 2.2250738585072014E-308, 1.7976931348623157e+308
+ranges: 0, 2.2250738585072014E-308..1.7976931348623157e+308
 
 [DATETIME]
 group: datetime
-values: '1000-01-01 00:00:00', '9999-12-31 23:59:59'
+ranges: '1000-01-01 00:00:00'..'9999-12-31 23:59:59'
 
 [DATE]
 group: datetime
-values: '1000-01-01', '9999-12-31'
+ranges: '1000-01-01'..'9999-12-31'
 
 [TIME]
 group: datetime
-values: '-838:59:59', '838:59:59'
+ranges: '-838:59:59'..'838:59:59'
 
 [TIMESTAMP]
 group: datetime
-values: '1970-01-01 00:00:01', '2038-01-09 03:14:07'
+ranges: '1970-01-01 00:00:01'..'2038-01-09 03:14:07'
 
 [YEAR(2)]
 group: datetime
-values: '00', '69', '70', '99'
+ranges: '00'..'99'
+values: '69', '70'
 
 [YEAR(4)]
 group: datetime
-values: '1901', '2155'
+ranges: '1901'..'2155'
 
 [CHAR(255)]
 group: string
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: @test_data
 
 [VARCHAR(255)]
 group: string
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: @test_data
 
 [BINARY(255)]
 group: binary
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: @test_data
 
 [VARBINARY(255)]
 group: binary
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: @test_data
 
 [TINYBLOB]
 group: binary
 engines: innodb, myisam
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: @test_data
 
 [BLOB]
 group: binary
 engines: innodb, myisam
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: REPEAT(@test_data,200)
 
 [MEDIUMBLOB]
 group: binary
 engines: innodb, myisam
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: REPEAT(@test_data,1000)
 
 #[LONGBLOB]
 #group: string
 #engines: innodb, myisam
 #query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
-#values: REPEAT(@test_data,65000)
+#ranges: REPEAT(@test_data,65000)
 
 [TINYTEXT]
 group: string
 engines: innodb, myisam
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: @test_data
 
 [TEXT]
 group: string
 engines: innodb, myisam
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: REPEAT(@test_data,200)
 
 [MEDIUMTEXT]
 group: string
 engines: innodb, myisam
 query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
+ranges: 'a'..'b'
 values: REPEAT(@test_data,1000)
 
 #[LONGTEXT]
 #group: string
 #engines: innodb, myisam
 #query_before: SET @test_data = CHAR(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255)
-#values: REPEAT(@test_data,66000)
+#ranges: REPEAT(@test_data,66000)

=== modified file 'suites/rep/data_types/matrix.pl'
--- a/suites/rep/data_types/matrix.pl	2009-05-25 09:52:14 +0000
+++ b/suites/rep/data_types/matrix.pl	2009-05-25 20:02:11 +0000
@@ -5,6 +5,7 @@ BEGIN {}
 use strict;
 use warnings;
 use Storable;
+use Time::Local;
 use My::Nuts::Library::Kernel::Server;
 use My::Nuts::Library::Kernel::Manager;
 use My::Nuts::Library::Kernel::Result;
@@ -44,6 +45,25 @@ sub get_data_types()
 	{
 	    $section= "$1";
 	}
+	elsif (/^ranges *\:\ *(.+\.\..+\,.+)/ || /^ranges *\:\ *(.+\,.+\.\..+)/)
+	{
+	    my $ta= $1;
+	    foreach my $te ( split / *\, */, $ta )
+	    {
+		if ($te =~ m/(.+) *\.\. *(.+)/i)
+		{
+		    push(@{$types->{$section}->{"ranges"}}, [$1, $2]);
+		}
+		else
+		{
+		    push(@{$types->{$section}->{"ranges"}}, [$te]);
+		}
+	    }
+	}
+	elsif (/^ranges *\:\ *(.+) *\.\. *(.+)/)
+	{
+	    push(@{$types->{$section}->{"ranges"}}, [$1, $2]);	
+	}
 	elsif (/^values *\:\ *(.+\,.+)/)
 	{
 	    $types->{$section}->{"values"}= [(split /\,\ +/, $1)];
@@ -93,12 +113,34 @@ sub generate_matrix()
 	    {
 		foreach my $null_to ( @$types_null )
 		{
-		    my @values_from = @{$types->{$type_from}->{"values"}};
+		    my @values_from = ();
+		    if ($types->{$type_from}->{"values"})
+		    {
+			@values_from = @{$types->{$type_from}->{"values"}};
+		    }
+		    if ($types->{$type_from}->{"ranges"})
+		    {
+			foreach my $te (@{$types->{$type_from}->{"ranges"}})
+			{
+			    push(@values_from, @{$te});
+			}
+		    }
 		    if ($null_from =~ m/^NULL$/)
 		    {
 			unshift(@values_from, "NULL");
 		    }
-		    my @values_to = @{$types->{$type_to}->{"values"}};
+		    my @values_to = ();
+		    if ($types->{$type_to}->{"values"})
+		    {
+			@values_to = @{$types->{$type_to}->{"values"}};
+		    }
+		    if ($types->{$type_to}->{"ranges"})
+		    {
+			foreach my $te (@{$types->{$type_to}->{"ranges"}})
+			{
+			    push(@values_to, @{$te});
+			}
+		    }
 		    if ($null_to =~ m/^NULL$/)
 		    {
 			unshift(@values_to, "NULL");
@@ -140,6 +182,148 @@ sub generate_matrix()
     return $matrix;
 }
 
+sub get_random_value
+{
+    my $params= shift;
+    my $type= $params->{"data_type"};
+    my $range= $params->{"range"};
+    my $limit;
+    my $min;
+    my $max;
+    my $value= $range->[0];
+    if ($type =~ m/^(tinyint|smallint|mediumint|int|bigint).+/i)
+    {	
+	$limit= $range->[1];
+	if ($range->[0] =~ m/^\-(.+)$/)
+	{
+	    $limit= $limit + $1;
+	}
+	$value= int(rand($limit));
+	if ($range->[0] =~ m/^\-(.+)$/)
+	{
+	    $value= $value - $1;
+	}
+    }
+    elsif ($type =~ m/^bit.*/i)
+    {
+	if (length($range->[0]) == length($range->[1]) && $range->[0] =~ m/^0b/ && $range->[1] =~ m/^0b(.+)$/)
+	{
+	    $value= "0b";
+	    foreach my $idx (2..(length($range->[0])-1))
+	    {
+		if (substr($range->[0], $idx, 1) eq substr($range->[1], $idx, 1))
+		{
+		    $value .= $range->[0];
+		}
+		elsif (rand(2) >= 1) 
+		{
+		    $value .= "1";
+		}
+		else
+		{
+		    $value .= "0";
+		}
+	    }
+	}
+    }
+    elsif ($type =~ m/^(char|varchar|binary|varbinary|tinyblob|blob|mediumblob|longblobtinytext|text|mediumtext|longtext)/i)
+    {
+	$limit= int(rand(10))+10;
+	$value= "CONCAT(" ;
+	foreach (1..$limit)
+	{
+	    $value .= "CHAR(".int(rand(256))."),";
+	}
+	$value .= ")";
+	$value =~ s/\,\)/)/g;
+    }
+    elsif ($type =~ m/^(date|datetime|timestamp) *$/i)
+    {
+	$value = 
+	"-" . sprintf("%02d", int(rand(12))+1)
+	. "-" . sprintf("%02d", int(rand(28))+1)
+	. " " . sprintf("%02d", int(rand(24)))
+	. ":" . sprintf("%02d", int(rand(60)))
+	. ":" . sprintf("%02d", int(rand(60)));
+	if (($range->[0] . $range->[1]) =~ m/^\'([0-9]{4})\-.+\'([0-9]{4})\-/i)
+	{
+	    $min= $1;
+	    $max= $2-1;
+	    $value= sprintf("%04d", int(rand($max-$min))+$min) . $value;
+	}
+	if ($type =~ m/^date$/i)
+	{
+	    $value= substr($value, 0, 10);
+	}
+	$value= "'" . $value . "'";		
+    }
+    elsif ($type =~ m/^time$/i)
+    {
+	$value = 
+	":" . sprintf("%02d", int(rand(60)))
+	. ":" . sprintf("%02d", int(rand(60)));
+	if (($range->[0] . $range->[1]) =~ m/^\'\-([0-9]+).+\'([0-9]+)/i)
+	{
+	    $min= $1;
+	    $max= $2-1;
+	    $value= (int(rand($max+$min))-$min) . $value;
+	}
+	$value= "'" . $value . "'";		
+    }
+    elsif ($type =~ m/^(float|double).*/i)
+    {
+	if ($range->[0] =~ /^[0-9]+/ && $range->[1] =~ /^[0-9]+/)
+	{
+	    if ($range->[0] =~ m/e\-(.+)$/i)
+	    {
+		$min= $1 + 2;
+	    }
+	    if ($range->[1] =~ m/e\+(.+)$/i)
+	    {
+		$max= $1 - 2;
+	    }
+	    $value = int(rand($min+$max)) - $min;
+	    if ($value >= 0)
+	    {
+		$value= "+" . $value;
+	    }
+	    $value = sprintf("%.2f", rand()) . "E" . $value;
+	}
+	elsif ($range->[0] =~ /^\-/ && $range->[1] =~ /^\-/)
+	{
+	    if ($range->[0] =~ m/e\+(.+)$/i)
+	    {
+		$max= $1 - 2;
+	    }
+	    if ($range->[1] =~ m/e\-(.+)$/i)
+	    {
+		$min= $1 + 2;
+	    }
+	    $value = int(rand($min+$max)) - $min;
+	    if ($value >= 0)
+	    {
+		$value= "+" . $value;
+	    }
+	    $value = "-" . sprintf("%1.2f", rand()) . "E" . $value;
+	}
+    }    
+    elsif ($type =~ m/^year.*/i)
+    {
+	$min= $range->[0];
+	$max= $range->[1];
+	$min =~ s/\'//g;
+	$max =~ s/\'//g;
+	$limit= $max - $min;
+	$value= int(rand($limit)) + $min;
+	if ($value < 10)
+	{
+	    $value= "0" . $value;
+	}
+	$value= "'" . $value . "'";	
+    }
+    return $value;
+}
+
 sub get_server_options()
 {
     my $params= shift;
@@ -432,6 +616,7 @@ sub test_matrix()
 		    my $i= 1;
 		    foreach my $test_value (@$values_from)
 		    {
+			#print " --> ".$test_value."\n";
 			sql ( $master, "INSERT INTO t_test VALUES ($i, $test_value, \"$counter. $i. $type_from -> $type_to\");");				
 			sql ( $master, "INSERT INTO t_orig VALUES ($i, $test_value, \"$counter. $i. $type_from -> $type_to\");");				
 			$i++;
@@ -548,7 +733,7 @@ sub test_matrix()
 sub vnote
 {
     my $text= shift;
-    print $text . "\n";
+#    print $text . "\n";
     note($text);
 }
 
@@ -562,5 +747,3 @@ sub exit_from_test
 return 1;
 
 END {}
-
-

=== modified file 'suites/rep/data_types_eq.pm'
--- a/suites/rep/data_types_eq.pm	2009-05-25 09:52:14 +0000
+++ b/suites/rep/data_types_eq.pm	2009-05-25 20:02:11 +0000
@@ -26,6 +26,51 @@ sub prepare
     # Read config file for data types
     $types= rep::data_types::matrix::get_data_types($rep::data_types::config::data_types_config_file);
     rep::data_types::matrix::vnote(scalar(keys %$types) . " data types found");
+    # Add random values
+    my $rand_counter= 0;
+    foreach my $stype (sort keys %$types)
+    {
+	my $need_num= $rep::data_types::config::test_values_num;
+	if ($types->{$stype}->{"values"})
+	{
+	    $need_num= $need_num - scalar(@{$types->{$stype}->{"values"}});
+	}
+	if ($types->{$stype}->{"ranges"})
+	{
+	    my $is_real_range= 0;
+	    foreach my $srange (@{$types->{$stype}->{"ranges"}})
+	    {
+		$need_num= $need_num - scalar(@{$srange});		
+		if (scalar(@{$srange}) > 1)
+		{
+		    $is_real_range= 1;
+		}
+	    }
+	    if ($is_real_range == 1)
+	    {
+		my $cur_pos= 0;
+		while ($need_num > 0)
+		{
+		    if ($cur_pos == scalar(@{$types->{$stype}->{"ranges"}}))
+		    {
+			$cur_pos= 0;
+		    }
+		    if (scalar(@{$types->{$stype}->{"ranges"}->[$cur_pos]}) > 1)
+		    {
+			my $new_value= rep::data_types::matrix::get_random_value({"data_type"=>$stype, "range"=> $types->{$stype}->{"ranges"}->[$cur_pos]});
+			if (defined $new_value)
+			{
+			    push(@{$types->{$stype}->{"values"}}, $new_value);			
+			    $need_num--;
+			    $rand_counter++;
+			}
+		    }
+		    $cur_pos++;
+		}
+	    }	    
+	}
+    }
+    rep::data_types::matrix::vnote("generated " . $rand_counter. " additional random values");
     # Generate array of pairs of types (matrix)
     $matrix= rep::data_types::matrix::generate_matrix(
 	{

Thread
bzr push into nuts branch (Serge.Kozlov:319 to 320) WL#4854Serge Kozlov25 May