| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 | 5 |
| 6 import 'dart:profiler'; | 6 import 'dart:profiler'; |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 | 8 |
| 9 testGauge1() { | 9 testGauge1() { |
| 10 var gauge = new Gauge('test', 'alpha bravo', 0.0, 100.0); | 10 var gauge = new Gauge('test', 'alpha bravo', 0.0, 100.0); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 testGauge2() { | 26 testGauge2() { |
| 27 var gauge = new Gauge('test', 'alpha bravo', 1.0, 2.0); | 27 var gauge = new Gauge('test', 'alpha bravo', 1.0, 2.0); |
| 28 Expect.equals(1.0, gauge.min); | 28 Expect.equals(1.0, gauge.min); |
| 29 Expect.equals(2.0, gauge.max); | 29 Expect.equals(2.0, gauge.max); |
| 30 Expect.equals(gauge.min, gauge.value); | 30 Expect.equals(gauge.min, gauge.value); |
| 31 Expect.equals('test', gauge.name); | 31 Expect.equals('test', gauge.name); |
| 32 Expect.equals('alpha bravo', gauge.description); | 32 Expect.equals('alpha bravo', gauge.description); |
| 33 | 33 |
| 34 Expect.throws(() { | 34 Expect.throws(() { |
| 35 // min > max. | 35 // min > max. |
| 36 gauge = new Gauge.range('test', 'alpha bravo', 2.0, 1.0); | 36 gauge = new Gauge('test', 'alpha bravo', 2.0, 1.0); |
| 37 }); | 37 }); |
| 38 | 38 |
| 39 Expect.throws(() { | 39 Expect.throws(() { |
| 40 // min == max. | 40 // min == max. |
| 41 gauge = new Gauge.range('test', 'alpha bravo', 1.0, 1.0); | 41 gauge = new Gauge('test', 'alpha bravo', 1.0, 1.0); |
| 42 }); | 42 }); |
| 43 | 43 |
| 44 Expect.throws(() { | 44 Expect.throws(() { |
| 45 // min is null | 45 // min is null |
| 46 gauge = new Gauge.range('test', 'alpha bravo', null, 1.0); | 46 gauge = new Gauge('test', 'alpha bravo', null, 1.0); |
| 47 }); | 47 }); |
| 48 | 48 |
| 49 Expect.throws(() { | 49 Expect.throws(() { |
| 50 // min is not a double | 50 // min is not a double |
| 51 gauge = new Gauge.range('test', 'alpha bravo', 'string', 1.0); | 51 gauge = new Gauge('test', 'alpha bravo', 'string', 1.0); |
| 52 }); | 52 }); |
| 53 | 53 |
| 54 Expect.throws(() { | 54 Expect.throws(() { |
| 55 // max is null | 55 // max is null |
| 56 gauge = new Gauge.range('test', 'alpha bravo', 1.0, null); | 56 gauge = new Gauge('test', 'alpha bravo', 1.0, null); |
| 57 }); | 57 }); |
| 58 | 58 |
| 59 Expect.throws(() { | 59 Expect.throws(() { |
| 60 // max is not a double | 60 // max is not a double |
| 61 gauge = new Gauge.range('test', 'alpha bravo', 1.0, 4); | 61 gauge = new Gauge('test', 'alpha bravo', 1.0, 4); |
| 62 }); | 62 }); |
| 63 } | 63 } |
| 64 | 64 |
| 65 testCounter() { | 65 testCounter() { |
| 66 var counter = new Counter('test', 'alpha bravo'); | 66 var counter = new Counter('test', 'alpha bravo'); |
| 67 Expect.equals(0.0, counter.value); | 67 Expect.equals(0.0, counter.value); |
| 68 Expect.equals('test', counter.name); | 68 Expect.equals('test', counter.name); |
| 69 Expect.equals('alpha bravo', counter.description); | 69 Expect.equals('alpha bravo', counter.description); |
| 70 counter.value = 1.0; | 70 counter.value = 1.0; |
| 71 Expect.equals(1.0, counter.value); | 71 Expect.equals(1.0, counter.value); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 main() { | 109 main() { |
| 110 testGauge1(); | 110 testGauge1(); |
| 111 testGauge2(); | 111 testGauge2(); |
| 112 testCounter(); | 112 testCounter(); |
| 113 testCustomCounter(); | 113 testCustomCounter(); |
| 114 testMetricNameCollision(); | 114 testMetricNameCollision(); |
| 115 testBadName(); | 115 testBadName(); |
| 116 } | 116 } |
| OLD | NEW |