OLD | NEW |
| (Empty) |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Flags: --expose-natives-as natives | |
6 // Test the MaxSimple and MinSimple internal methods in runtime.js | |
7 | |
8 var MaxSimple = natives.ImportNow("MaxSimple"); | |
9 var MinSimple = natives.ImportNow("MinSimple"); | |
10 | |
11 function checkEvaluations(target) { | |
12 var evaluations = 0; | |
13 var observedNumber = { | |
14 valueOf: function() { | |
15 evaluations++; | |
16 return 0; | |
17 } | |
18 }; | |
19 target(observedNumber, observedNumber); | |
20 return evaluations; | |
21 } | |
22 | |
23 assertEquals(1, MaxSimple(-1, 1)); | |
24 assertEquals(2, checkEvaluations(MaxSimple)); | |
25 | |
26 assertEquals(-1, MinSimple(-1, 1)); | |
27 assertEquals(2, checkEvaluations(MinSimple)); | |
OLD | NEW |