~drizzle-trunk/drizzle/development

813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
1
#
2
# Tests for the WEEKDAY() function
3
#
4
# The Drizzle WEEKDAY() function differs from the MySQL WEEKDAY()
5
# function in these ways:
6
#
7
#  * Does not accept invalid parameters.  This results in an error
8
#    in Drizzle.
9
#
10
11
# WEEKDAY() on a NULL should produce
12
# a NULL.
13
SELECT WEEKDAY(NULL);
14
15
# 
16
# Test improper argument list 
17
#
18
# 1 arg is required.
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
19
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION # Wrong parameter count...
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
20
SELECT WEEKDAY();
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
21
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION # Wrong parameter count...
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
22
SELECT WEEKDAY(1, 0);
23
24
# 
25
# Test invalid dates passed to WEEKDAY
26
# produce an error, not a NULL or anything
27
# else...
28
#
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
29
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
30
SELECT WEEKDAY("xxx");
31
32
# Indy, bad dates!
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
33
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
34
SELECT WEEKDAY("0000-00-00"); # No 0000-00-00 dates!...
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
35
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
36
SELECT WEEKDAY("0000-01-01"); # No zero year parts
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
37
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
38
SELECT WEEKDAY("0001-00-01"); # No zero month parts
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
39
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
40
SELECT WEEKDAY("0001-01-00"); # No zero day parts
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
41
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
42
SELECT WEEKDAY("2000-02-30"); # No Feb 30th!
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
43
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
44
SELECT WEEKDAY("1900-02-29"); # Not a leap YEAR since not divisible evenly by 400...
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
45
--error ER_INVALID_DATETIME_VALUE
813.1.21 by Jay Pipes
Fixes the WEEKDAY() function use the new temporal system and enable proper error throwing on bad datetimes. Adds test case for the WEEKDAY() function.
46
SELECT WEEKDAY('1976-15-15'); # No 15th month!
47
48
# A good date, which should output 0
49
SELECT WEEKDAY("2009-01-12");
50
51
# A good date, which should output 3 
52
# Test of 2 digit year conversion...shouldn't mess with weekday functionality
53
SELECT WEEKDAY("70-12-31");
54
55
# A good date, which should output 4
56
SELECT WEEKDAY("99-12-31");
57
58
# A good date, which should output 1
59
SELECT WEEKDAY("69-12-31");
60
61
# A good date, which should output 0
62
SELECT WEEKDAY("0001-12-31");
63
64
# A good date, which should output 4
65
SELECT WEEKDAY("9999-12-31");
66
67
# A good date in the common USA format, should output 4
68
SELECT WEEKDAY('07/31/2009');