| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //-------------------------------------------------------------------------------------------------------
- // Copyright (C) Microsoft. All rights reserved.
- // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
- //-------------------------------------------------------------------------------------------------------
- /*
- *******************************UNIT TEST FOR SWITCH CASE OPTIMIZATION*******************************
- * Test with two switch statements containing empty case statements and repetition.
- */
- function f(x)
- {
- /* Empty cases*/
- switch(x)
- {
- case 'abc':
- case 'def':
- case 'ghi':
- WScript.Echo('empty Cases');
- break;
- case 'stu':
- WScript.Echo('stu');
- break;
- default:
- WScript.Echo('Default cases');
- break;
- }
- /*Repeated empty cases*/
- switch(x)
- {
- case 'abc':
- case 'abc':
- case 'abc':
- WScript.Echo('abc');
- break;
- case 'def':
- WScript.Echo('first def');
- break;
- case 'def':
- WScript.Echo('second def');
- break;
- default:
- WScript.Echo('default');
- break;
- }
- }
- f('stu');
- f('stu');
- f('vxy');
- f('z');
- f('x');
- f('abc');
- f('def');
- f('ghi');
- f('jkl');
- f('mno');
- f('pqr');
- f('saf');
|