OLD | NEW |
1 dart_library.library('BenchmarkBase', null, /* Imports */[ | 1 dart_library.library('BenchmarkBase', null, /* Imports */[ |
2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
3 'dart/core' | 3 'dart/core' |
4 ], /* Lazy imports */[ | 4 ], /* Lazy imports */[ |
5 ], function(exports, dart, core) { | 5 ], function(exports, dart, core) { |
6 'use strict'; | 6 'use strict'; |
7 let dartx = dart.dartx; | 7 let dartx = dart.dartx; |
8 class Expect extends core.Object { | 8 class Expect extends core.Object { |
9 static equals(expected, actual) { | 9 static equals(expected, actual) { |
10 if (!dart.equals(expected, actual)) { | 10 if (!dart.equals(expected, actual)) { |
11 throw `Values not equal: ${expected} vs ${actual}`; | 11 throw `Values not equal: ${expected} vs ${actual}`; |
12 } | 12 } |
13 } | 13 } |
14 static listEquals(expected, actual) { | 14 static listEquals(expected, actual) { |
15 if (expected[dartx.length] != actual[dartx.length]) { | 15 if (expected[dartx.length] != actual[dartx.length]) { |
16 throw `Lists have different lengths: ${expected[dartx.length]} vs ${actu
al[dartx.length]}`; | 16 throw `Lists have different lengths: ${expected[dartx.length]} vs ${actu
al[dartx.length]}`; |
17 } | 17 } |
18 for (let i = 0; dart.notNull(i) < dart.notNull(actual[dartx.length]); i =
dart.notNull(i) + 1) { | 18 for (let i = 0; dart.notNull(i) < dart.notNull(actual[dartx.length]); i =
dart.notNull(i) + 1) { |
19 Expect.equals(expected[dartx.get](i), actual[dartx.get](i)); | 19 Expect.equals(expected[dartx.get](i), actual[dartx.get](i)); |
20 } | 20 } |
21 } | 21 } |
22 fail(message) { | 22 fail(message) { |
23 throw message; | 23 throw message; |
24 } | 24 } |
25 } | 25 } |
26 dart.setSignature(Expect, { | 26 dart.setSignature(Expect, { |
27 methods: () => ({fail: [core.Object, [core.Object]]}), | 27 methods: () => ({fail: [dart.dynamic, [dart.dynamic]]}), |
28 statics: () => ({ | 28 statics: () => ({ |
29 equals: [dart.void, [core.Object, core.Object]], | 29 equals: [dart.void, [dart.dynamic, dart.dynamic]], |
30 listEquals: [dart.void, [core.List, core.List]] | 30 listEquals: [dart.void, [core.List, core.List]] |
31 }), | 31 }), |
32 names: ['equals', 'listEquals'] | 32 names: ['equals', 'listEquals'] |
33 }); | 33 }); |
34 class BenchmarkBase extends core.Object { | 34 class BenchmarkBase extends core.Object { |
35 BenchmarkBase(name) { | 35 BenchmarkBase(name) { |
36 this.name = name; | 36 this.name = name; |
37 } | 37 } |
38 run() {} | 38 run() {} |
39 warmup() { | 39 warmup() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 measure: [core.double, []], | 86 measure: [core.double, []], |
87 report: [dart.void, []] | 87 report: [dart.void, []] |
88 }), | 88 }), |
89 statics: () => ({measureFor: [core.double, [core.Function, core.int]]}), | 89 statics: () => ({measureFor: [core.double, [core.Function, core.int]]}), |
90 names: ['measureFor'] | 90 names: ['measureFor'] |
91 }); | 91 }); |
92 // Exports: | 92 // Exports: |
93 exports.Expect = Expect; | 93 exports.Expect = Expect; |
94 exports.BenchmarkBase = BenchmarkBase; | 94 exports.BenchmarkBase = BenchmarkBase; |
95 }); | 95 }); |
OLD | NEW |