Commit bb41d530 authored by unknown's avatar unknown

Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0


sql/opt_sum.cc:
  Auto merged
parents 9adfd2e8 26dfae65
This directory contains all of the test cases for the MySQL Test Suite
marked up in XML.
To convert these test cases from XML into 'mysqltest' format, one needs
an XSL translator installed on their system. At MySQL, we use Sablotron
(http://www.gingerall.com/). Once installed, conversion happens with a
command like this:
sabcmd xsl/mysqltest.xsl < tests/sel000001.xml > sel000001.test
The file 'sel000001.test' contains the plain text conversion that is
to be fed into the 'mysqltest' program.
Below is an example of a test case marked up in XML; illustrating all
of the XML mark-up currently supported in our 'mysqltest.xsl' stylesheet.
----------------------------------------------------
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000001">
<version value="3.22"/>
<version value="3.23"/>
<description>This test will monkey around trying to kill mysqld.</description>
<connect name="Test_Connect1"
host="MyHostName"
user="Matt"
pass="MattPass"
db="MyDB"
port="3306"
sock="MyDB.sock"
/>
<connection name="Test_Connect1">
<resultfile name="sel000001.result">
<sql>SELECT y FROM foo WHERE bar='2'</sql>
</resultfile>
<sql>INSERT INTO foo VALUES (y='2') WHERE bar='1'</sql>
</connection>
</test>
----------------------------------------------------
The converted (mysqltest format) output of this source XML file looks
like:
----------------------------------------------------
# sel000001
#
# Versions
# --------
# 3.22
# 3.23
#
# Description
# -----------
# This test will monkey around trying to kill mysqld.
#
connect(Test_Connect1, MyHostName, Matt, MattPass, MyDB, 3306, MyDB.sock)
connection Test_Connect1
INSERT INTO foo VALUES (y='2') WHERE bar='1';
@sel000001.result SELECT y FROM foo WHERE bar='2';
----------------------------------------------------
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000001">
<version value="3.22"/>
<version value="3.23"/>
<description>This test is just a simple select.</description>
<description>Testing WHERE clause.</description>
<sql>DROP TABLE IF EXISTS t</sql>
<sql>CREATE TABLE t (s CHAR(20) PRIMARY KEY, id INT)</sql>
<sql>INSERT INTO t VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77)</sql>
<resultfile name="r/3.23/sel000001.result">
<sql>SELECT s, id FROM t WHERE s = 'mouse'</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000002">
<version value="3.22"/>
<version value="3.23"/>
<description>This test is just a simple select.</description>
<sql>DROP TABLE IF EXISTS t</sql>
<sql>CREATE TABLE t (n INT)</sql>
<sql>INSERT INTO t VALUES (1), (2), (3)</sql>
<resultfile name="r/3.23/sel000002.result">
<sql>SELECT * FROM t</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000003">
<version value="3.22"/>
<version value="3.23"/>
<description>This test is just a simple select.</description>
<description>Testing count() function and GROUP BY clause.</description>
<sql>DROP TABLE IF EXISTS t</sql>
<sql>CREATE TABLE t (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score))</sql>
<sql>INSERT INTO t VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10)</sql>
<resultfile name="r/3.23/sel000003.result">
<sql>SELECT COUNT(*) as n, score FROM t GROUP BY score</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000004">
<version value="3.22"/>
<version value="3.23"/>
<description>Simple arithmetic.</description>
<description>Testing MOD(), SIGN(), and arithmetic grouping.</description>
<resultfile name="r/3.23/sel000004.result">
<sql>SELECT 1+1,1-1,1+1*2,8/5,8%5,MOD(8,5),MOD(8,5)|0,-(1+1)*-2,SIGN(-5)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000005">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric functions.</description>
<description>Testing FLOOR(), CEILING(), ROUND().</description>
<resultfile name="r/3.23/sel000005.result">
<sql>SELECT FLOOR(5.5),FLOOR(-5.5),CEILING(5.5),CEILING(-5.5),ROUND(5.5),ROUND(-5.5)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000006">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric functions.</description>
<description>Testing ROUND(); hundreths precision.</description>
<resultfile name="r/3.23/sel000006.result">
<sql>SELECT ROUND(5.64,1),ROUND(5.64,2),ROUND(5.64,-1),ROUND(5.64,-2)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000007">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric functions.</description>
<description>Testing TRUNCATE().</description>
<resultfile name="r/3.23/sel000007.result">
<sql>SELECT TRUNCATE(52.64,1),TRUNCATE(52.64,2),TRUNCATE(52.64,-1),TRUNCATE(52.64,-2)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000008">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric functions.</description>
<description>Testing ABS(), LOG(), LOG10(), EXP(), SQRT(), POW(), RAND(), POWER().</description>
<resultfile name="r/3.23/sel000008.result">
<sql>SELECT ABS(-10),LOG(EXP(10)),EXP(LOG(SQRT(10))*2),POW(10,LOG10(10)),RAND(999999),RAND(),POWER(2,4)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000009">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric functions.</description>
<description>Testing PI(), SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN().</description>
<resultfile name="r/3.23/sel000009.result">
<sql>SELECT PI(),SIN(PI()/2),COS(PI()/2),TAN(PI()),COT(1),ASIN(1),ACOS(0),ATAN(1)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000010">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric bitwise comparisons.</description>
<description>Testing |, &amp;, BIT_COUNT().</description>
<resultfile name="r/3.23/sel000010.result">
<sql>SELECT 1 | (1+1),5 &amp; 3,BIT_COUNT(7)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000011">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric bitmoving comparisons.</description>
<description>Testing &lt;&lt;, >>.</description>
<resultfile name="r/3.23/sel000011.result">
<sql>SELECT 1 &lt;&lt; 32,1 &lt;&lt; 63, 1 &lt;&lt; 64, 4 >> 2, 4 >> 63, 1&lt;&lt; 63 >> 60</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000012">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric floating point.</description>
<resultfile name="r/3.23/sel000012.result">
<sql>SELECT 10,10.0,10.,.1e+2,100.0e-1</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000013">
<version value="3.22"/>
<version value="3.23"/>
<description>Numeric floating point.</description>
<resultfile name="r/3.23/sel000013.result">
<sql>SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000014">
<version value="3.22"/>
<version value="3.23"/>
<description>Numerics.</description>
<description>Testing pos/neg and zero padding.</description>
<resultfile name="r/3.23/sel000014.result">
<sql>SELECT 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000015">
<version value="3.22"/>
<version value="3.23"/>
<description>Numerics.</description>
<description>Testing big numbers.</description>
<resultfile name="r/3.23/sel000015.result">
<sql>SELECT 922337203685477580,92233720368547758000</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000016">
<version value="3.22"/>
<version value="3.23"/>
<description>Numerics.</description>
<description>Testing big negative numbers.</description>
<resultfile name="r/3.23/sel000016.result">
<sql>SELECT -922337203685477580,-92233720368547758000</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000017">
<version value="3.22"/>
<version value="3.23"/>
<description>Numerics.</description>
<description>Testing big pos/neg numbers.</description>
<resultfile name="r/3.23/sel000017.result">
<sql>SELECT 9223372036854775807,-009223372036854775808</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000018">
<version value="3.22"/>
<version value="3.23"/>
<description>Numerics.</description>
<description>Testing big pos/neg numbers.</description>
<resultfile name="r/3.23/sel000018.result">
<sql>SELECT +9999999999999999999,-9999999999999999999</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000019">
<version value="3.22"/>
<version value="3.23"/>
<description>Numerics.</description>
<description>Testing DEGREES(), RADIANS().</description>
<resultfile name="r/3.23/sel000019.result">
<sql>SELECT DEGREES(PI()),RADIANS(360)</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000020">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; STRCMP(), =, >, >=, &lt;=, !=.</description>
<resultfile name="r/3.23/sel000020.result">
<sql>SELECT 0=0,1>0,1>=1,1&lt;0,1&lt;=0,1!=0,STRCMP("abc","abcd"),STRCMP("b","a"),STRCMP("a","a")</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000021">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; =, >, >=, &lt;=, &lt;>.</description>
<resultfile name="r/3.23/sel000021.result">
<sql>SELECT "a"&lt;"b","a"&lt;="b","b">="a","b">"a","a"="A","a"&lt;>"b"</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000022">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; =, >, &lt;=.</description>
<resultfile name="r/3.23/sel000022.result">
<sql>SELECT "a "="A", "A "="a", "a " &lt;= "A b"</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000023">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; LIKE, NOT LIKE, '%'.</description>
<resultfile name="r/3.23/sel000023.result">
<sql>SELECT "abc" LIKE "a%", "abc" NOT LIKE "%d%", "a%" LIKE "a\%","abc%" LIKE "a%\%","abcd" LIKE "a%b_%d", "a" LIKE "%%a","abcde" LIKE "a%_e","abc" LIKE "abc%"</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000024">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; LIKE, '%'.</description>
<resultfile name="r/3.23/sel000024.result">
<sql>SELECT "a" LIKE "%%b","a" LIKE "%%ab","ab" LIKE "a\%", "ab" LIKE "_", "ab" LIKE "ab_", "abc" LIKE "%_d", "abc" LIKE "abc%d"</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000025">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; LIKE, ESCAPE, '%'.</description>
<resultfile name="r/3.23/sel000025.result">
<sql>SELECT '?' LIKE '|%', '?' LIKE '|%' ESCAPE '|', '%' LIKE '|%', '%' LIKE '|%' ESCAPE '|', '%' LIKE '%'</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000026">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; LIKE, '%'.</description>
<resultfile name="r/3.23/sel000026.result">
<sql>SELECT 'abc' LIKE '%c','abcabc' LIKE '%c', "ab" LIKE "", "ab" LIKE "a", "ab" LIKE "ab"</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000027">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; REGEXP.</description>
<resultfile name="r/3.23/sel000027.result">
<sql>SELECT "Det hr r svenska" REGEXP "h[[:alpha:]]+r", "aba" REGEXP "^(a|b)*$"</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000028">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; REGEXP, CONCAT().</description>
<resultfile name="r/3.23/sel000028.result">
<sql>SELECT "aba" REGEXP CONCAT("^","a")</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000029">
<version value="3.22"/>
<version value="3.23"/>
<description>Strings.</description>
<description>Testing string comparisons; NOT, AND, OR, !, &amp;&amp;, ||.</description>
<resultfile name="r/3.23/sel000029.result">
<sql>SELECT !0,NOT 0=1,!(0=0),1 AND 1,1 &amp;&amp; 0,0 OR 1,1 || NULL, 1=1 OR 1=1 AND 1=0</sql>
</resultfile>
</test>
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000030">
<version value="3.22"/>
<version value="3.23"/>
<description>Control flow.</description>
<description>Testing control flow; IF()</description>
<resultfile name="r/3.23/sel000030.result">
<sql>SELECT IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0</sql>
</resultfile>
</test>
XML Stylesheets for converting test cases in XML to other forms.
- mysqltest.xsl -> mysqltest format (text)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/"><xsl:apply-templates /></xsl:template>
<!-- Main Template -->
<xsl:template match="/test"># <xsl:apply-templates select="@name"/>
#
# Versions
# --------<xsl:apply-templates select="version"/>
#
# Description
# -----------<xsl:apply-templates select="description"/>
#
<xsl:apply-templates select="connect"/>
<xsl:apply-templates select="connection"/>
<xsl:apply-templates select="sql"/>
<xsl:apply-templates select="resultfile"/>
</xsl:template>
<!-- End Main Template -->
<xsl:template match="version">
# <xsl:apply-templates select="@value"/>
</xsl:template>
<xsl:template match="description">
# <xsl:apply-templates />
</xsl:template>
<xsl:template match="connect">
connect(<xsl:apply-templates select="@name"/>, <xsl:apply-templates select="@host"/>, <xsl:apply-templates select="@user"/>, <xsl:apply-templates select="@pass"/>, <xsl:apply-templates select="@db"/>, <xsl:apply-templates select="@port"/>, <xsl:apply-templates select="@sock"/>)
</xsl:template>
<xsl:template match="connection">
<xsl:text>
connection </xsl:text><xsl:apply-templates select="@name"/>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="sql"/>
<xsl:apply-templates select="resultfile"/>
</xsl:template>
<xsl:template match="resultfile">@<xsl:apply-templates select="@name"/><xsl:text> </xsl:text><xsl:apply-templates select="sql"/>
</xsl:template>
<xsl:template match="sql">
<xsl:apply-templates />;
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment