| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 assertEquals(1, a++ && 1); | 102 assertEquals(1, a++ && 1); |
| 103 assertEquals(44, a); | 103 assertEquals(44, a); |
| 104 assertEquals(1, ++b.x && 1); | 104 assertEquals(1, ++b.x && 1); |
| 105 assertEquals(43, b.x); | 105 assertEquals(43, b.x); |
| 106 assertEquals(1, (b.x++) && 1); | 106 assertEquals(1, (b.x++) && 1); |
| 107 assertEquals(44, b.x); | 107 assertEquals(44, b.x); |
| 108 assertEquals(1, ++b[c] && 1); | 108 assertEquals(1, ++b[c] && 1); |
| 109 assertEquals(45, b[c]); | 109 assertEquals(45, b[c]); |
| 110 assertEquals(1, b[c]++ && 1); | 110 assertEquals(1, b[c]++ && 1); |
| 111 assertEquals(46, b[c]); | 111 assertEquals(46, b[c]); |
| 112 |
| 113 // Test count operations with parameters. |
| 114 function f(x) { x++; return x; } |
| 115 assertEquals(43, f(42)); |
| 116 |
| 117 function g(x) { ++x; return x; } |
| 118 assertEquals(43, g(42)); |
| 119 |
| 120 function h(x) { var y = x++; return y; } |
| 121 assertEquals(42, h(42)); |
| 122 |
| 123 function k(x) { var y = ++x; return y; } |
| 124 assertEquals(43, k(42)); |
| 125 |
| 126 // Test count operation in a test context. |
| 127 function countTestPost(i) { var k = 0; while (i--) { k++; } return k; } |
| 128 assertEquals(10, countTestPost(10)); |
| 129 |
| 130 function countTestPre(i) { var k = 0; while (--i) { k++; } return k; } |
| 131 assertEquals(9, countTestPre(10)); |
| OLD | NEW |