js/src/tests/ecma_2/Statements/dowhile-003.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:3061f7be8719
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
7 /**
8 * File Name: dowhile-003
9 * ECMA Section:
10 * Description: do...while statements
11 *
12 * Test do while, when the while expression is a JavaScript Number object.
13 *
14 *
15 * Author: christine@netscape.com
16 * Date: 11 August 1998
17 */
18 var SECTION = "dowhile-003";
19 var VERSION = "ECMA_2";
20 var TITLE = "do...while with a labeled continue statement";
21
22 startTest();
23 writeHeaderToLog( SECTION + " "+ TITLE);
24
25 DoWhile( new DoWhileObject( 1, 1, 0 ));
26 DoWhile( new DoWhileObject( 1000, 1000, 0 ));
27 DoWhile( new DoWhileObject( 1001, 1001, 0 ));
28 DoWhile( new DoWhileObject( 1002, 1001, 1 ));
29 DoWhile( new DoWhileObject( -1, 1001, -1002 ));
30
31 test();
32
33 function DoWhileObject( value, iterations, endvalue ) {
34 this.value = value;
35 this.iterations = iterations;
36 this.endvalue = endvalue;
37 }
38
39 function DoWhile( object ) {
40 var i = 0;
41
42 do {
43 object.value = --object.value;
44 i++;
45 if ( i > 1000 )
46 break;
47 } while( object.value );
48
49 new TestCase(
50 SECTION,
51 "loop iterations",
52 object.iterations,
53 i
54 );
55
56 new TestCase(
57 SECTION,
58 "object.value",
59 object.endvalue,
60 Number( object.value )
61 );
62
63 }

mercurial