How to use var2 method in ng-mocks

Best JavaScript code snippet using ng-mocks

11.13.2-3.js

Source:11.13.2-3.js Github

copy

Full Screen

1/* The contents of this file are subject to the Netscape Public2 * License Version 1.1 (the "License"); you may not use this file3 * except in compliance with the License. You may obtain a copy of4 * the License at http://www.mozilla.org/NPL/5 *6 * Software distributed under the License is distributed on an "AS7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or8 * implied. See the License for the specific language governing9 * rights and limitations under the License.10 *11 * The Original Code is Mozilla Communicator client code, released March12 * 31, 1998.13 *14 * The Initial Developer of the Original Code is Netscape Communications15 * Corporation. Portions created by Netscape are16 * Copyright (C) 1998 Netscape Communications Corporation. All17 * Rights Reserved.18 *19 * Contributor(s): 20 * 21 */22 /**23 File Name: 11.13.2-4.js24 ECMA Section: 11.13.2 Compound Assignment: %=25 Description:26 *= /= %= += -= <<= >>= >>>= &= ^= |=27 11.13.2 Compound assignment ( op= )28 The production AssignmentExpression :29 LeftHandSideExpression @ = AssignmentExpression, where @ represents one of30 the operators indicated above, is evaluated as follows:31 1. Evaluate LeftHandSideExpression.32 2. Call GetValue(Result(1)).33 3. Evaluate AssignmentExpression.34 4. Call GetValue(Result(3)).35 5. Apply operator @ to Result(2) and Result(4).36 6. Call PutValue(Result(1), Result(5)).37 7. Return Result(5).38 Author: christine@netscape.com39 Date: 12 november 199740*/41 var SECTION = "11.13.2-3";42 var VERSION = "ECMA_1";43 startTest();44 var testcases = getTestCases();45 writeHeaderToLog( SECTION + " Compound Assignment: +=");46 test();47function getTestCases() {48 var array = new Array();49 var item = 0;50 // If either operand is NaN, result is NaN51 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") );52 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") );53 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") );54 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") );55 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") );56 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") );57 // if the dividend is infinity or the divisor is zero or both, the result is NaN58 array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );59 array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );60 array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );61 array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );62 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );63 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );64 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );65 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );66 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );67 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );68 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );69 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );70 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") );71 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") );72 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") );73 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") );74 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") );75 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") );76 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") );77 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") );78 // if the dividend is finite and the divisor is an infinity, the result equals the dividend.79 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );80 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );81 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );82 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );83 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );84 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );85 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );86 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );87 // if the dividend is a zero and the divisor is finite, the result is the same as the dividend88 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") );89 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") );90 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") );91 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") );92 // string cases93 array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") );94 array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1", 0, eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") );95/*96 array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") );97 array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );98 array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") );99 array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") );100 array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );101 // boolean cases102 array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") );103 array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") );104 // object cases105 array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") );106 array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") );107 array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") );108 array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") );109*/110 return ( array );111}112function test() {113 for ( tc=0; tc < testcases.length; tc++ ) {114 testcases[tc].passed = writeTestCaseResult(115 testcases[tc].expect,116 testcases[tc].actual,117 testcases[tc].description +" = "+118 testcases[tc].actual );119 testcases[tc].reason %= ( testcases[tc].passed ) ? "" : "wrong value ";120 }121 stopTest();122 return ( testcases );...

Full Screen

Full Screen

11.13.2-2.js

Source:11.13.2-2.js Github

copy

Full Screen

1/* The contents of this file are subject to the Netscape Public2 * License Version 1.1 (the "License"); you may not use this file3 * except in compliance with the License. You may obtain a copy of4 * the License at http://www.mozilla.org/NPL/5 *6 * Software distributed under the License is distributed on an "AS7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or8 * implied. See the License for the specific language governing9 * rights and limitations under the License.10 *11 * The Original Code is Mozilla Communicator client code, released March12 * 31, 1998.13 *14 * The Initial Developer of the Original Code is Netscape Communications15 * Corporation. Portions created by Netscape are16 * Copyright (C) 1998 Netscape Communications Corporation. All17 * Rights Reserved.18 *19 * Contributor(s): 20 * 21 */22 /**23 File Name: 11.13.2-2js24 ECMA Section: 11.13.2 Compound Assignment: /=25 Description:26 *= /= %= += -= <<= >>= >>>= &= ^= |=27 11.13.2 Compound assignment ( op= )28 The production AssignmentExpression :29 LeftHandSideExpression @ = AssignmentExpression, where @ represents one of30 the operators indicated above, is evaluated as follows:31 1. Evaluate LeftHandSideExpression.32 2. Call GetValue(Result(1)).33 3. Evaluate AssignmentExpression.34 4. Call GetValue(Result(3)).35 5. Apply operator @ to Result(2) and Result(4).36 6. Call PutValue(Result(1), Result(5)).37 7. Return Result(5).38 Author: christine@netscape.com39 Date: 12 november 199740*/41 var SECTION = "11.13.2-2";42 var VERSION = "ECMA_1";43 startTest();44 var testcases = getTestCases();45 writeHeaderToLog( SECTION + " Compound Assignment: /=");46 test();47function getTestCases() {48 var array = new Array();49 var item = 0;50 // NaN cases51 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") );52 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") );53 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") );54 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") );55 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") );56 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") );57 // number cases58 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") );59 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") );60 array[item++] = new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2", 25.5, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") );61 // special division cases62 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );63 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );64 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );65 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );66 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );67 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );68 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );69 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );70 array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );71 array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );72 array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );73 array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );74 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") );75 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") );76 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") );77 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") );78 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") );79 array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") );80 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") );81 array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") );82 // string cases83 array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1", 100, eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") );84 array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1", 100, eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") );85/*86 array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") );87 array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );88 array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") );89 array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") );90 array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );91 // boolean cases92 array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") );93 array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") );94 // object cases95 array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") );96 array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") );97 array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") );98 array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") );99*/100 return ( array );101}102function test() {103 for ( tc=0; tc < testcases.length; tc++ ) {104 testcases[tc].passed = writeTestCaseResult(105 testcases[tc].expect,106 testcases[tc].actual,107 testcases[tc].description +" = "+108 testcases[tc].actual );109 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";110 }111 stopTest();112 return ( testcases );...

Full Screen

Full Screen

11.13.2-4.js

Source:11.13.2-4.js Github

copy

Full Screen

1/* The contents of this file are subject to the Netscape Public2 * License Version 1.1 (the "License"); you may not use this file3 * except in compliance with the License. You may obtain a copy of4 * the License at http://www.mozilla.org/NPL/5 *6 * Software distributed under the License is distributed on an "AS7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or8 * implied. See the License for the specific language governing9 * rights and limitations under the License.10 *11 * The Original Code is Mozilla Communicator client code, released March12 * 31, 1998.13 *14 * The Initial Developer of the Original Code is Netscape Communications15 * Corporation. Portions created by Netscape are16 * Copyright (C) 1998 Netscape Communications Corporation. All17 * Rights Reserved.18 *19 * Contributor(s): 20 * 21 */22 /**23 File Name: 11.13.2-4.js24 ECMA Section: 11.13.2 Compound Assignment:+=25 Description:26 *= /= %= += -= <<= >>= >>>= &= ^= |=27 11.13.2 Compound assignment ( op= )28 The production AssignmentExpression :29 LeftHandSideExpression @ = AssignmentExpression, where @ represents one of30 the operators indicated above, is evaluated as follows:31 1. Evaluate LeftHandSideExpression.32 2. Call GetValue(Result(1)).33 3. Evaluate AssignmentExpression.34 4. Call GetValue(Result(3)).35 5. Apply operator @ to Result(2) and Result(4).36 6. Call PutValue(Result(1), Result(5)).37 7. Return Result(5).38 Author: christine@netscape.com39 Date: 12 november 199740*/41 var SECTION = "11.13.2-4";42 var VERSION = "ECMA_1";43 startTest();44 var testcases = getTestCases();45 writeHeaderToLog( SECTION + " Compound Assignment: +=");46 test();47function getTestCases() {48 var array = new Array();49 var item = 0;50 // If either operand is NaN, result is NaN51 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") );52 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") );53 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") );54 array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") );55 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") );56 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") );57 // the sum of two Infinities the same sign is the infinity of that sign58 // the sum of two Infinities of opposite sign is NaN59 array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );60 array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );61 array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );62 array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );63 // the sum of an infinity and a finite value is equal to the infinite operand64 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );65 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );66 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );67 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );68 // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +069 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") );70 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") );71 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") );72 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") );73 // the sum of a zero and a nonzero finite value is eqal to the nonzero operand74 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") );75 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") );76 array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") );77 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") );78 // the sum of a zero and a nozero finite value is equal to the nonzero operand.79 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") );80 array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") );81 // the sum of two nonzero finite values of the same magnitude and opposite sign is +082 array[item++] = new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") );83 array[item++] = new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") );84/*85 array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") );86 array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );87 array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") );88 array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") );89 array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );90 // boolean cases91 array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") );92 array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") );93 // object cases94 array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") );95 array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") );96 array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") );97 array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") );98*/99 return ( array );100}101function test() {102 for ( tc=0; tc < testcases.length; tc++ ) {103 testcases[tc].passed = writeTestCaseResult(104 testcases[tc].expect,105 testcases[tc].actual,106 testcases[tc].description +" = "+107 testcases[tc].actual );108 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";109 }110 stopTest();111 return ( testcases );...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var var2 = ngMocks.var2;2var var2 = ngMocks.var2;3var var2 = ngMocks.var2;4var var2 = ngMocks.var2;5var var2 = ngMocks.var2;6var var2 = ngMocks.var2;7var var2 = ngMocks.var2;8var var2 = ngMocks.var2;9var var2 = ngMocks.var2;10var var2 = ngMocks.var2;11var var2 = ngMocks.var2;12var var2 = ngMocks.var2;13var var2 = ngMocks.var2;14var var2 = ngMocks.var2;15var var2 = ngMocks.var2;16var var2 = ngMocks.var2;17var var2 = ngMocks.var2;18var var2 = ngMocks.var2;19var var2 = ngMocks.var2;20var var2 = ngMocks.var2;21var var2 = ngMocks.var2;22var var2 = ngMocks.var2;

Full Screen

Using AI Code Generation

copy

Full Screen

1import { var2 } from 'ng-mocks';2import { var2 } from 'ng-mocks';3import { var2 } from 'ng-mocks';4import { var2 } from 'ng-mocks';5import { var2 } from 'ng-mocks';6import { var2 } from 'ng-mocks';7import { var2 } from 'ng-mocks';8import { var2 } from 'ng-mocks';9import { var2 } from 'ng-mocks';10import { var2 } from 'ng-mocks';11import { var2 } from 'ng-mocks';12import { var2 } from 'ng-mocks';13import { var2 } from 'ng-mocks';14import { var2 } from 'ng-mocks';15import { var2 } from 'ng-mocks';16import { var2 } from 'ng-mocks';17import { var2 } from 'ng-mocks';18import { var2 } from 'ng-mocks';19import { var2 } from 'ng-mocks';20import { var2 } from 'ng

Full Screen

Using AI Code Generation

copy

Full Screen

1import { var2 } from 'ng-mocks';2describe('Test', () => {3 it('should work', () => {4 const mock = var2({5 });6 expect(mock).toEqual('bar');7 });8});9import { var2 } from 'ng-mocks';10describe('Test', () => {11 it('should work', () => {12 const mock = var2({13 });14 expect(mock).toEqual('bar');15 });16});17import { var2 } from 'ng-mocks';18describe('Test', () => {19 it('should work', () => {20 const mock = var2({21 });22 expect(mock).toEqual('bar');23 });24});25import { var2 } from 'ng-mocks';26describe('Test', () => {27 it('should work', () => {28 const mock = var2({29 });30 expect(mock).toEqual('bar');31 });32});33import { var2 } from 'ng-mocks';34describe('Test', () => {35 it('should work', () => {36 const mock = var2({37 });38 expect(mock).toEqual('bar');39 });40});41import { var2 } from 'ng-mocks';42describe('Test', () => {43 it('should work', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1var ngMocks = require('ng-mocks');2var myModule = require('./myModule');3var myModuleMock = ngMocks.module(myModule.name, myModule.config);4describe('test', function() {5 var $rootScope, $scope;6 beforeEach(function() {7 ngMocks.module(myModuleMock.name);8 ngMocks.inject(function(_$rootScope_) {9 $rootScope = _$rootScope_;10 $scope = $rootScope.$new();11 });12 });13 it('should test', function() {14 });15});

Full Screen

Using AI Code Generation

copy

Full Screen

1var var2 = require('ng-mocks').var2;2describe('test', function() {3 it('should work', function() {4 var2('test', 'test');5 });6});7var var2 = require('ng-mocks').var2;8describe('test', function() {9 it('should work', function() {10 var2('test', 'test');11 });12});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful