oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 1 | This test covers the correctness and behaviour of switch statements. |
| 2 | |
| 3 | On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| 4 | |
| 5 | |
oliver@apple.com | f9353c2 | 2012-05-07 22:52:52 +0000 | [diff] [blame] | 6 | PASS characterSwitch('A' + emptyString1) is "A" |
| 7 | PASS characterSwitch('A' + emptyString1 + emptyString2) is "A" |
| 8 | PASS characterSwitch(emptyString1 + emptyString2) is "default" |
abarth@webkit.org | e0a8b11 | 2010-08-05 23:52:00 +0000 | [diff] [blame] | 9 | PASS characterSwitch('\0') is "\0" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 10 | PASS characterSwitch('A') is "A" |
| 11 | PASS characterSwitch('a') is "a" |
| 12 | PASS characterSwitch('1') is "1" |
| 13 | PASS characterSwitch('-1') is "default" |
| 14 | PASS characterSwitch('B') is "B" |
| 15 | PASS characterSwitch('') is "default" |
| 16 | PASS characterSwitch({toString: function(){return 'B'}}) is "default" |
| 17 | PASS characterSwitch(0) is "default" |
barraclough@apple.com | bc798fd | 2009-01-22 04:28:05 +0000 | [diff] [blame] | 18 | PASS characterSwitch(-0) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 19 | PASS characterSwitch(1) is "default" |
barraclough@apple.com | 1dfe6f8 | 2009-02-27 03:32:17 +0000 | [diff] [blame] | 20 | PASS characterSwitch(1.1) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 21 | PASS characterSwitch(-1) is "default" |
| 22 | PASS characterSwitch(-1000000000) is "default" |
| 23 | PASS characterSwitch(1000000000) is "default" |
| 24 | PASS characterSwitch({}) is "default" |
abarth@webkit.org | e0a8b11 | 2010-08-05 23:52:00 +0000 | [diff] [blame] | 25 | PASS sparseCharacterSwitch('\0') is "\0" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 26 | PASS sparseCharacterSwitch('A') is "A" |
| 27 | PASS sparseCharacterSwitch('a') is "a" |
| 28 | PASS sparseCharacterSwitch('1') is "1" |
| 29 | PASS sparseCharacterSwitch('-1') is "default" |
| 30 | PASS sparseCharacterSwitch('B') is "B" |
| 31 | PASS sparseCharacterSwitch('') is "" |
| 32 | PASS sparseCharacterSwitch({toString: function(){return 'B'}}) is "default" |
| 33 | PASS sparseCharacterSwitch(0) is "default" |
barraclough@apple.com | bc798fd | 2009-01-22 04:28:05 +0000 | [diff] [blame] | 34 | PASS sparseCharacterSwitch(-0) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 35 | PASS sparseCharacterSwitch(1) is "default" |
barraclough@apple.com | 1dfe6f8 | 2009-02-27 03:32:17 +0000 | [diff] [blame] | 36 | PASS sparseCharacterSwitch(1.1) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 37 | PASS sparseCharacterSwitch(-1) is "default" |
| 38 | PASS sparseCharacterSwitch(-1000000000) is "default" |
| 39 | PASS sparseCharacterSwitch(1000000000) is "default" |
| 40 | PASS sparseCharacterSwitch({}) is "default" |
abarth@webkit.org | e0a8b11 | 2010-08-05 23:52:00 +0000 | [diff] [blame] | 41 | PASS stringSwitch('\0') is "\0" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 42 | PASS stringSwitch('A') is "A" |
| 43 | PASS stringSwitch('a') is "a" |
| 44 | PASS stringSwitch('1') is "1" |
| 45 | PASS stringSwitch('-1') is "-1" |
| 46 | PASS stringSwitch('B') is "B" |
| 47 | PASS stringSwitch('') is "" |
| 48 | PASS stringSwitch('some string') is "some string" |
| 49 | PASS stringSwitch({toString: function(){return 'some string'}}) is "default" |
| 50 | PASS stringSwitch('s') is "default" |
| 51 | PASS stringSwitch(0) is "default" |
barraclough@apple.com | bc798fd | 2009-01-22 04:28:05 +0000 | [diff] [blame] | 52 | PASS stringSwitch(-0) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 53 | PASS stringSwitch(1) is "default" |
barraclough@apple.com | 1dfe6f8 | 2009-02-27 03:32:17 +0000 | [diff] [blame] | 54 | PASS stringSwitch(1.1) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 55 | PASS stringSwitch(-1) is "default" |
| 56 | PASS stringSwitch(-1000000000) is "default" |
| 57 | PASS stringSwitch(1000000000) is "default" |
| 58 | PASS stringSwitch({}) is "default" |
abarth@webkit.org | e0a8b11 | 2010-08-05 23:52:00 +0000 | [diff] [blame] | 59 | PASS numberSwitch('\0') is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 60 | PASS numberSwitch('A') is "default" |
| 61 | PASS numberSwitch('a') is "default" |
| 62 | PASS numberSwitch('1') is "default" |
| 63 | PASS numberSwitch('-1') is "default" |
| 64 | PASS numberSwitch('B') is "default" |
| 65 | PASS numberSwitch('') is "default" |
| 66 | PASS numberSwitch('some string') is "default" |
| 67 | PASS numberSwitch({valueOf: function(){return 0}}) is "default" |
| 68 | PASS numberSwitch('s') is "default" |
| 69 | PASS numberSwitch(0) is 0 |
barraclough@apple.com | bc798fd | 2009-01-22 04:28:05 +0000 | [diff] [blame] | 70 | PASS numberSwitch(-0) is 0 |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 71 | PASS numberSwitch(1) is 1 |
barraclough@apple.com | 1dfe6f8 | 2009-02-27 03:32:17 +0000 | [diff] [blame] | 72 | PASS numberSwitch(1.1) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 73 | PASS numberSwitch(-1) is -1 |
| 74 | PASS numberSwitch(-1000000000) is "default" |
| 75 | PASS numberSwitch(1000000000) is "default" |
| 76 | PASS numberSwitch({}) is "default" |
abarth@webkit.org | e0a8b11 | 2010-08-05 23:52:00 +0000 | [diff] [blame] | 77 | PASS sparseNumberSwitch('\0') is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 78 | PASS sparseNumberSwitch('A') is "default" |
| 79 | PASS sparseNumberSwitch('a') is "default" |
| 80 | PASS sparseNumberSwitch('1') is "default" |
| 81 | PASS sparseNumberSwitch('-1') is "default" |
| 82 | PASS sparseNumberSwitch('B') is "default" |
| 83 | PASS sparseNumberSwitch('') is "default" |
| 84 | PASS sparseNumberSwitch('some string') is "default" |
| 85 | PASS sparseNumberSwitch({valueOf: function(){return 0}}) is "default" |
| 86 | PASS sparseNumberSwitch('s') is "default" |
| 87 | PASS sparseNumberSwitch(0) is 0 |
barraclough@apple.com | bc798fd | 2009-01-22 04:28:05 +0000 | [diff] [blame] | 88 | PASS sparseNumberSwitch(-0) is 0 |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 89 | PASS sparseNumberSwitch(1) is 1 |
barraclough@apple.com | 1dfe6f8 | 2009-02-27 03:32:17 +0000 | [diff] [blame] | 90 | PASS sparseNumberSwitch(1.1) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 91 | PASS sparseNumberSwitch(-1) is -1 |
| 92 | PASS sparseNumberSwitch(-1000000000) is -1000000000 |
| 93 | PASS sparseNumberSwitch(1000000000) is 1000000000 |
| 94 | PASS sparseNumberSwitch({}) is "default" |
abarth@webkit.org | e0a8b11 | 2010-08-05 23:52:00 +0000 | [diff] [blame] | 95 | PASS generalSwitch('\0') is "\0" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 96 | PASS generalSwitch('A') is "A" |
| 97 | PASS generalSwitch('a') is "a" |
| 98 | PASS generalSwitch('1') is "1" |
| 99 | PASS generalSwitch('-1') is "-1" |
| 100 | PASS generalSwitch('B') is "B" |
| 101 | PASS generalSwitch('') is "" |
| 102 | PASS generalSwitch('some string') is "some string" |
| 103 | PASS generalSwitch({valueOf: function(){return 0}}) is "default" |
| 104 | PASS generalSwitch('s') is "default" |
| 105 | PASS generalSwitch(0) is 0 |
barraclough@apple.com | bc798fd | 2009-01-22 04:28:05 +0000 | [diff] [blame] | 106 | PASS generalSwitch(-0) is 0 |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 107 | PASS generalSwitch(1) is 1 |
barraclough@apple.com | 1dfe6f8 | 2009-02-27 03:32:17 +0000 | [diff] [blame] | 108 | PASS generalSwitch(1.1) is "default" |
oliver@apple.com | 8007f46 | 2008-07-24 00:49:46 +0000 | [diff] [blame] | 109 | PASS generalSwitch(-1) is -1 |
| 110 | PASS generalSwitch(-1000000000) is -1000000000 |
| 111 | PASS generalSwitch(1000000000) is 1000000000 |
| 112 | PASS generalSwitch({}) is "default" |
| 113 | PASS successfullyParsed is true |
| 114 | |
| 115 | TEST COMPLETE |
| 116 | |