Debian Codegraph @

rhino/testsrc/tests/ecma_2/Statements/dowhile-003.js

raw symbols SCIP
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 gTestfile = 'dowhile-003.js';
7
8 /**
9 * File Name: dowhile-003
10 * ECMA Section:
11 * Description: do...while statements
12 *
13 * Test do while, when the while expression is a JavaScript Number object.
14 *
15 *
16 * Author: [email protected]
17 * Date: 11 August 1998
18 */
19 var SECTION = "dowhile-003";
20 var VERSION = "ECMA_2";
21 var TITLE = "do...while with a labeled continue statement";
22
23 startTest();
24 writeHeaderToLog( SECTION + " "+ TITLE);
25
26 DoWhile( new DoWhileObject( 1, 1, 0 ));
27 DoWhile( new DoWhileObject( 1000, 1000, 0 ));
28 DoWhile( new DoWhileObject( 1001, 1001, 0 ));
29 DoWhile( new DoWhileObject( 1002, 1001, 1 ));
30 DoWhile( new DoWhileObject( -1, 1001, -1002 ));
31
32 test();
33
34 function DoWhileObject( value, iterations, endvalue ) {
35 this.value = value;
36 this.iterations = iterations;
37 this.endvalue = endvalue;
38 }
39
40 function DoWhile( object ) {
41 var i = 0;
42
43 do {
44 object.value = --object.value;
45 i++;
46 if ( i > 1000 )
47 break;
48 } while( object.value );
49
50 new TestCase(
51 SECTION,
52 "loop iterations",
53 object.iterations,
54 i
55 );
56
57 new TestCase(
58 SECTION,
59 "object.value",
60 object.endvalue,
61 Number( object.value )
62 );
63
64 }