summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/ctype_big5.test23
-rw-r--r--mysql-test/t/ctype_cp1250_ch.test27
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test23
-rw-r--r--mysql-test/t/ctype_eucjpms.test26
-rw-r--r--mysql-test/t/ctype_euckr.test23
-rw-r--r--mysql-test/t/ctype_gb2312.test24
-rw-r--r--mysql-test/t/ctype_gbk.test27
-rw-r--r--mysql-test/t/ctype_latin1.test36
-rw-r--r--mysql-test/t/ctype_latin1_de.test37
-rw-r--r--mysql-test/t/ctype_latin2.test23
-rw-r--r--mysql-test/t/ctype_latin2_ch.test32
-rw-r--r--mysql-test/t/ctype_ldml.test16
-rw-r--r--mysql-test/t/ctype_sjis.test24
-rw-r--r--mysql-test/t/ctype_tis620.test26
-rw-r--r--mysql-test/t/ctype_uca.test37
-rw-r--r--mysql-test/t/ctype_ucs.test14
-rw-r--r--mysql-test/t/ctype_ujis.test27
-rw-r--r--mysql-test/t/ctype_utf16.test26
-rw-r--r--mysql-test/t/ctype_utf16_uca.test25
-rw-r--r--mysql-test/t/ctype_utf16le.test16
-rw-r--r--mysql-test/t/ctype_utf32.test27
-rw-r--r--mysql-test/t/ctype_utf32_uca.test24
-rw-r--r--mysql-test/t/ctype_utf8.test36
-rw-r--r--mysql-test/t/func_weight_string.test113
24 files changed, 705 insertions, 7 deletions
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index b024420dee3..afac3e4a435 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -145,3 +145,26 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names big5;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+
+set collation_connection=big5_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test
index a4c59f494a7..c4efae13c39 100644
--- a/mysql-test/t/ctype_cp1250_ch.test
+++ b/mysql-test/t/ctype_cp1250_ch.test
@@ -82,3 +82,30 @@ drop table t1;
--error 1649
set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators)
using cp1250);
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+--echo #
+--echo # Note:
+--echo # cp1250_czech_cs does not support WEIGHT_STRING in full extent
+--echo #
+
+set names cp1250 collate cp1250_czech_cs;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_chde.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_l2.inc
+--source include/weight_string_l12.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
+
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
index a83f48b1439..ca8853b9ea1 100644
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -162,3 +162,26 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names cp932;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_8140.inc
+
+set collation_connection=cp932_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_8140.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test
index fea48061c69..264d9156a0c 100644
--- a/mysql-test/t/ctype_eucjpms.test
+++ b/mysql-test/t/ctype_eucjpms.test
@@ -494,3 +494,29 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names eucjpms;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+--source include/weight_string_8EA1.inc
+--source include/weight_string_8FA2C3.inc
+
+set collation_connection=eucjpms_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+--source include/weight_string_8EA1.inc
+--source include/weight_string_8FA2C3.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_euckr.test b/mysql-test/t/ctype_euckr.test
index 3a88e8ac715..155b8ebed00 100644
--- a/mysql-test/t/ctype_euckr.test
+++ b/mysql-test/t/ctype_euckr.test
@@ -174,3 +174,26 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+set names euckr;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+
+set collation_connection=euckr_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
+
diff --git a/mysql-test/t/ctype_gb2312.test b/mysql-test/t/ctype_gb2312.test
index f092a0a501f..eab79adfe08 100644
--- a/mysql-test/t/ctype_gb2312.test
+++ b/mysql-test/t/ctype_gb2312.test
@@ -124,3 +124,27 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names gb2312;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+
+set collation_connection=gb2312_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test
index b9e25e97a3c..3b61f16a178 100644
--- a/mysql-test/t/ctype_gbk.test
+++ b/mysql-test/t/ctype_gbk.test
@@ -159,3 +159,30 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names gbk;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+--source include/weight_string_8140.inc
+--source include/weight_string_8EA1.inc
+
+set collation_connection=gbk_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+--source include/weight_string_8140.inc
+--source include/weight_string_8EA1.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index 5d1acf107d7..390325529e7 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -161,3 +161,39 @@ EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó';
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set @@collation_connection=latin1_swedish_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set @@collation_connection=latin1_bin;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set @@collation_connection=latin1_general_cs;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set @@collation_connection=binary;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set names latin1;
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test
index 1efbfa4a3ae..29a52c36db6 100644
--- a/mysql-test/t/ctype_latin1_de.test
+++ b/mysql-test/t/ctype_latin1_de.test
@@ -143,3 +143,40 @@ create table t1 (s1 char(5) character set latin1 collate latin1_german2_ci);
insert into t1 values (0xf6) /* this is o-umlaut */;
select * from t1 where length(s1)=1 and s1='oe';
drop table t1;
+
+--echo End of 5.1 tests
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set @@collation_connection=latin1_german2_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+select hex(weight_string('Ä'));
+select hex(weight_string('ä'));
+select hex(weight_string('Ö'));
+select hex(weight_string('ö'));
+select hex(weight_string('Ü'));
+select hex(weight_string('ü'));
+select hex(weight_string('S'));
+select hex(weight_string('s'));
+select hex(weight_string('ß'));
+select hex(weight_string('ä' as char(1)));
+select hex(weight_string('ö' as char(1)));
+select hex(weight_string('ü' as char(1)));
+select hex(weight_string('ß' as char(1)));
+select hex(weight_string('xä' as char(2)));
+select hex(weight_string('xö' as char(2)));
+select hex(weight_string('xü' as char(2)));
+select hex(weight_string('xß' as char(2)));
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_latin2.test b/mysql-test/t/ctype_latin2.test
index 676b472e7b8..91def43eb03 100644
--- a/mysql-test/t/ctype_latin2.test
+++ b/mysql-test/t/ctype_latin2.test
@@ -50,3 +50,26 @@ SELECT group_concat(a collate latin2_croatian_ci order by binary a) from t1 grou
drop table t1;
# End of 4.1 tests
+
+--echo End of 5.1 tests
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names latin2;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+
+set collation_connection=latin2_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_latin2_ch.test b/mysql-test/t/ctype_latin2_ch.test
index 3925d02659d..94d8fde5ec8 100644
--- a/mysql-test/t/ctype_latin2_ch.test
+++ b/mysql-test/t/ctype_latin2_ch.test
@@ -30,3 +30,35 @@ select * from t1 where tt like '%AA%';
# End of 4.1 tests
drop table t1;
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names latin2 collate latin2_czech_cs;
+--source include/ctype_pad_space.inc
+# We can not use ctype_filesort.inc because
+# order of SPACE and TAB is not strict
+#--source include/ctype_filesort.inc
+
+--echo #
+--echo # Note:
+--echo # latin2_czech_cs does not support WEIGHT_STRING in full extent
+--echo #
+--source include/weight_string.inc
+--source include/weight_string_chde.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_l2.inc
+--source include/weight_string_l3.inc
+--source include/weight_string_l4.inc
+--source include/weight_string_l12.inc
+--source include/weight_string_l14.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test
index bcb16334df4..4442cf9b35a 100644
--- a/mysql-test/t/ctype_ldml.test
+++ b/mysql-test/t/ctype_ldml.test
@@ -182,6 +182,8 @@ SHOW COLLATION LIKE 'utf8_phone_ci';
SET NAMES utf8;
# make sure utf8mb4_test_400_ci is Unicode-4.0.0 based
+SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci));
+SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci));
SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a));
SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a));
SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a));
@@ -233,12 +235,12 @@ INSERT INTO t1 VALUES ('lb-fv'),('lb-lv');
INSERT INTO t1 VALUES (_ucs2 0x3106),(_ucs2 0x3110), (_ucs2 0x3111), (_ucs2 0x3112);
INSERT INTO t1 VALUES (_ucs2 0x32A3), (_ucs2 0x3231);
INSERT INTO t1 VALUES (_ucs2 0x84D9), (_ucs2 0x98F5), (_ucs2 0x7CF3), (_ucs2 0x5497);
-SELECT a FROM t1 ORDER BY a, LENGTH(a), BINARY a;
+SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY a;
--echo #
--echo # WL#5624, the same test with UCS2
--echo #
ALTER TABLE t1 CONVERT TO CHARACTER SET ucs2 COLLATE ucs2_5624_1;
-SELECT a FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
+SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
DROP TABLE t1;
--echo #
@@ -266,7 +268,7 @@ SHOW WARNINGS;
SET NAMES utf8 COLLATE utf8_5624_4;
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
INSERT INTO t1 VALUES ('\\'),('u'),('x'),('X');
-SELECT a FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
+SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
DROP TABLE t1;
--echo #
@@ -278,7 +280,7 @@ INSERT INTO t1 VALUES (_ucs2 0x09FA), (_ucs2 0x09F8), (_ucs2 0x09F9), (_ucs2 0x0
INSERT INTO t1 VALUES (_ucs2 0x09DC), (_ucs2 0x09A109BC);
INSERT INTO t1 VALUES (_ucs2 0x09A2), (_ucs2 0x09DD), (_ucs2 0x09A209BC);
INSERT INTO t1 VALUES (_ucs2 0x09A3);
-SELECT HEX(CONVERT(a USING ucs2)), HEX(a)
+SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a)
FROM t1 ORDER BY a, BINARY a;
DROP TABLE t1;
@@ -319,9 +321,9 @@ INSERT INTO t1 VALUES
(_ucs2 0x099509CD0993),(_ucs2 0x099509CB),
(_ucs2 0x099509CD0994),(_ucs2 0x099509CC);
-SELECT HEX(CONVERT(a USING ucs2)), HEX(a)
+SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a)
FROM t1 ORDER BY a, BINARY(a);
-SELECT
+SELECT HEX(WEIGHT_STRING(a)) as wa,
GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a)
FROM t1 GROUP BY a ORDER BY a;
DROP TABLE t1;
@@ -341,7 +343,7 @@ INSERT INTO t1 VALUES ('J'),('K'),('L'),('M'),('N'),('O'),('P'),('Q'),('R');
INSERT INTO t1 VALUES ('S'),('T'),('U'),('V'),('W'),('X'),('Y'),('Z');
INSERT INTO t1 VALUES ('AA'),('AAA');
-SELECT a FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
+SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
DROP TABLE t1;
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
index f45e6ab9b54..4041af4d6ad 100644
--- a/mysql-test/t/ctype_sjis.test
+++ b/mysql-test/t/ctype_sjis.test
@@ -190,3 +190,27 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names sjis;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_8140.inc
+
+
+set collation_connection=sjis_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_8140.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index c49540de24b..8b373b2a03b 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -161,3 +161,29 @@ SET collation_connection='tis620_bin';
-- source include/ctype_like_escape.inc
# End of 4.1 tests
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names tis620;
+set collation_connection=tis620_thai_ci;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+select hex(weight_string(cast(0xE0A1 as char)));
+select hex(weight_string(cast(0xE0A1 as char) as char(1)));
+
+set collation_connection=tis620_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+select hex(weight_string(cast(0xE0A1 as char)));
+select hex(weight_string(cast(0xE0A1 as char) as char(1)));
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index bded2489f56..04a8abe6350 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -583,6 +583,43 @@ drop table t1;
--echo #
--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set collation_connection=ucs2_unicode_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set @@collation_connection=utf8_unicode_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set @@collation_connection=utf8_czech_ci;
+--source include/weight_string_chde.inc
+
+set @@collation_connection=ucs2_czech_ci;
+--source include/weight_string_chde.inc
+
+--echo #
+--echo # Bug#33077 weight of supplementary characters is not 0xfffd
+--echo #
+select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci));
+
+--echo #
+--echo # Bug#53064 garbled data when using utf8_german2_ci collation
+--echo #
+CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_german2_ci);
+INSERT INTO t1 VALUES ('a'),('ae'),('af');
+SELECT s1,hex(s1),hex(weight_string(s1)) FROM t1 ORDER BY s1;
+DROP TABLE t1;
+
+--echo #
--echo # WL#4013 Unicode german2 collation
--echo #
SET collation_connection=utf8_german2_ci;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 43e6daea285..268cf3a7adb 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -846,6 +846,20 @@ DROP TABLE t1;
--echo #
--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set collation_connection=ucs2_general_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set collation_connection=ucs2_bin;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+--echo #
--echo # Bug#59145 valgrind warnings for uninitialized values in my_strtoll10_mb2
--echo #
SET NAMES latin1;
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 4e1ee55e019..ede00a6647e 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1321,3 +1321,30 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names ujis;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+--source include/weight_string_8EA1.inc
+--source include/weight_string_8FA2C3.inc
+
+set collation_connection=ujis_bin;
+--source include/weight_string.inc
+--source include/weight_string_l1.inc
+--source include/weight_string_A1A1.inc
+--source include/weight_string_8EA1.inc
+--source include/weight_string_8FA2C3.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
index 07e6a68e36f..a05f119ca93 100644
--- a/mysql-test/t/ctype_utf16.test
+++ b/mysql-test/t/ctype_utf16.test
@@ -790,3 +790,29 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set collation_connection=utf16_general_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+select hex(weight_string(_utf16 0xD800DC00));
+select hex(weight_string(_utf16 0xD800DC01));
+--source include/weight_string_l1.inc
+
+set collation_connection=utf16_bin;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
+
diff --git a/mysql-test/t/ctype_utf16_uca.test b/mysql-test/t/ctype_utf16_uca.test
index a6295c82dec..22292413b3a 100644
--- a/mysql-test/t/ctype_utf16_uca.test
+++ b/mysql-test/t/ctype_utf16_uca.test
@@ -249,6 +249,7 @@ SET @test_collation='utf16_swedish_ci';
SET collation_connection='utf16_unicode_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_like_escape.inc
+-- source include/ctype_german.inc
--echo End of 4.1 tests
@@ -295,3 +296,27 @@ SET collation_connection=utf16_czech_ci;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set collation_connection=utf16_unicode_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+select hex(weight_string(_utf16 0xD800DC00 collate utf16_unicode_ci));
+select hex(weight_string(_utf16 0xD800DC01 collate utf16_unicode_ci));
+--source include/weight_string_l1.inc
+
+set @@collation_connection=utf16_czech_ci;
+--source include/weight_string_chde.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf16le.test b/mysql-test/t/ctype_utf16le.test
index d9637139774..a8326900847 100644
--- a/mysql-test/t/ctype_utf16le.test
+++ b/mysql-test/t/ctype_utf16le.test
@@ -726,5 +726,21 @@ DROP TABLE t1;
--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+SET NAMES utf8, collation_connection=utf16le_general_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+SELECT HEX(WEIGHT_STRING(_utf16le 0x00D800DC));
+SELECT HEX(WEIGHT_STRING(_utf16le 0x00D801DC));
+--source include/weight_string_l1.inc
+
+SET NAMES utf8, collation_connection=utf16le_bin;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+--echo #
--echo # End of 5.6 tests
--echo #
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
index e00ba04fcc4..2fbe452a716 100644
--- a/mysql-test/t/ctype_utf32.test
+++ b/mysql-test/t/ctype_utf32.test
@@ -875,3 +875,30 @@ SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)'))
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set collation_connection=utf32_general_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+select hex(weight_string(_utf32 0x10000));
+select hex(weight_string(_utf32 0x10001));
+--source include/weight_string_l1.inc
+
+set collation_connection=utf32_bin;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
+
+
diff --git a/mysql-test/t/ctype_utf32_uca.test b/mysql-test/t/ctype_utf32_uca.test
index 1d79fbe1616..786c9b6a64f 100644
--- a/mysql-test/t/ctype_utf32_uca.test
+++ b/mysql-test/t/ctype_utf32_uca.test
@@ -250,6 +250,7 @@ SET @test_collation='utf32_swedish_ci';
SET collation_connection='utf32_unicode_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_like_escape.inc
+-- source include/ctype_german.inc
--echo End of 4.1 tests
@@ -318,3 +319,26 @@ DROP TABLE t1,t2;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set collation_connection=utf32_unicode_ci;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+select hex(weight_string(_utf32 0x10000 collate utf32_unicode_ci));
+select hex(weight_string(_utf32 0x10001 collate utf32_unicode_ci));
+--source include/weight_string_l1.inc
+
+set @@collation_connection=utf32_czech_ci;
+--source include/weight_string_chde.inc
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 176d7e58c77..aa830894427 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1598,3 +1598,39 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # WL#3664 WEIGHT_STRING
+--echo #
+
+set names utf8;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+set @@collation_connection=utf8_bin;
+--source include/weight_string.inc
+--source include/weight_string_euro.inc
+--source include/weight_string_l1.inc
+
+--echo #
+--echo # Checking strnxfrm() with odd length
+--echo #
+set max_sort_length=5;
+select @@max_sort_length;
+create table t1 (a varchar(128) character set utf8 collate utf8_general_ci);
+insert into t1 values ('a'),('b'),('c');
+select * from t1 order by a;
+alter table t1 modify a varchar(128) character set utf8 collate utf8_bin;
+select * from t1 order by a;
+drop table t1;
+set max_sort_length=default;
+
+--echo #
+--echo # End of 5.6 tests
+--echo #
+
diff --git a/mysql-test/t/func_weight_string.test b/mysql-test/t/func_weight_string.test
new file mode 100644
index 00000000000..6c34ce1e460
--- /dev/null
+++ b/mysql-test/t/func_weight_string.test
@@ -0,0 +1,113 @@
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+set names latin1;
+
+#
+# If it's BLOB or BINARY or VARBINARY, then output = input.
+#
+select hex(weight_string(0x010203));
+
+#
+# "AS CHAR ( int )" causes padding on the right. The pad
+# character is always space, that is, 0x20 or 0x0020.
+# The padding occurs before the conversion to a weight.
+# The value of "int" is the number of characters, not the number of bytes.
+#
+select hex(weight_string('aa' as char(3)));
+
+#
+# The minimum value of 'int' is 1.
+#
+--error 1064
+select hex(weight_string('a' as char(-1)));
+--error 1064
+select hex(weight_string('a' as char(0)));
+select hex(weight_string('a' as char(1)));
+
+#
+# If 'int' is smaller than the length of 'string',
+# truncation will occur with no warning.
+#
+select hex(weight_string('ab' as char(1)));
+
+#
+# If "AS CHAR ( int )" is omitted, there is no padding and no truncation.
+#
+select hex(weight_string('ab'));
+
+#
+# "AS BINARY ( int )" is like CHAR(int) but causes padding of 0x00
+# so one doesn't have to use "CAST(string AS BINARY(int))".
+#
+select hex(weight_string('aa' as binary(3)));
+select hex(weight_string(cast('aa' as binary(3))));
+
+#
+# If and only if one specifies "LEVEL numeric-list" (not "range"),
+# one may follow any "number" with [ASC|DESC][REVERSE]
+#
+--error 1064
+select hex(weight_string('ab' level 1-1 ASC));
+--error 1064
+select hex(weight_string('ab' level 1-1 DESC));
+--error 1064
+select hex(weight_string('ab' level 1-1 REVERSE));
+
+#
+# If one says "DESC", then the weights come out NOTed
+# or negated for that level.
+# If one says "REVERSE", then the weights come out in
+# reverse order for that level, that is, starting with
+# the last character and ending with the first character.
+#
+select hex(weight_string('ab' level 1 ASC));
+select hex(weight_string('ab' level 1 DESC));
+select hex(weight_string('ab' level 1 REVERSE));
+select hex(weight_string('ab' level 1 DESC REVERSE));
+
+#
+# If the result length is less than or equal to the
+# maximum possible length for the VARBINARY data type,
+# then the result data type is VARBINARY. Otherwise
+# the result data type is BLOB.
+#
+create table t1 select weight_string('test') as w;
+show create table t1;
+drop table t1;
+create table t1 select weight_string(repeat('t',66000)) as w;
+show create table t1;
+drop table t1;
+
+#
+# If input is NULL, then output is NULL.
+#
+select weight_string(NULL);
+
+#
+# WEIGHT_STRING and REVERSE will not be a new reserved word.
+#
+select 1 as weight_string, 2 as reverse;
+
+#
+# Check that collation derivation is copied from the argument
+#
+select coercibility(weight_string('test'));
+select coercibility(weight_string('test' collate latin1_swedish_ci));
+
+#
+# Bug#33663 Character sets: weight_string function,
+# varchar column, wrong result
+#
+create table t1 (s1 varchar(5));
+insert into t1 values ('a'),(null);
+select hex(weight_string(s1)) from t1 order by s1;
+drop table t1;
+
+--echo #
+--echo # BUG#11898467 - SERVER CRASHES ON SELECT HEX(WEIGHT_STRING(STR AS [CHAR|BINARY](N))) IF N IS BIG
+--echo #
+SELECT HEX(WEIGHT_STRING('ab' AS CHAR(1000000000000000000)));
+SELECT HEX(WEIGHT_STRING('ab' AS BINARY(1000000000000000000)));
+