Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: tests/lib/profiler/metrics_test.dart

Issue 409213004: Initial backend for metrics in Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« runtime/lib/profiler.dart ('K') | « runtime/vm/service_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 //
5
6 import 'dart:profiler';
7 import 'package:expect/expect.dart';
8
9 testGauge() {
10 var gauge = new Gauge('test', 'alpha bravo');
11 Expect.equals(0.0, gauge.value);
12 Expect.equals('test', gauge.name);
13 Expect.equals('alpha bravo', gauge.description);
14 Expect.equals(null, gauge.min);
15 Expect.equals(null, gauge.max);
16 gauge.value = 44.0;
17 Expect.equals(44.0, gauge.value);
18 }
19
20 testGaugeRange() {
21 var gauge = new Gauge.range('test', 'alpha bravo', 1.0, 2.0);
22 Expect.equals(0.0, gauge.value);
23 Expect.equals('test', gauge.name);
24 Expect.equals('alpha bravo', gauge.description);
25 Expect.equals(1.0, gauge.min);
26 Expect.equals(2.0, gauge.max);
27
28 Expect.throws(() {
29 // min > max.
30 gauge = new Gauge.range('test', 'alpha bravo', 2.0, 1.0);
31 });
32
33 Expect.throws(() {
34 // min == max.
35 gauge = new Gauge.range('test', 'alpha bravo', 1.0, 1.0);
36 });
37
38 Expect.throws(() {
39 // min == max.
40 gauge = new Gauge.range('test', 'alpha bravo', 1.0, 1.0);
41 });
42
43 Expect.throws(() {
44 // min is null
45 gauge = new Gauge.range('test', 'alpha bravo', null, 1.0);
46 });
47
48 Expect.throws(() {
49 // min is not a double
50 gauge = new Gauge.range('test', 'alpha bravo', 'string', 1.0);
51 });
52
53 Expect.throws(() {
54 // max is null
55 gauge = new Gauge.range('test', 'alpha bravo', 1.0, null);
56 });
57
58 Expect.throws(() {
59 // max is not a double
60 gauge = new Gauge.range('test', 'alpha bravo', 1.0, 4);
61 });
62
63 Expect.equals(0.0, gauge.value);
64 Expect.equals('test', gauge.name);
65 Expect.equals('alpha bravo', gauge.description);
66 Expect.equals(1.0, gauge.min);
67 Expect.equals(2.0, gauge.max);
68 }
69
70 testCounter() {
71 var counter = new Counter('test', 'alpha bravo');
72 Expect.equals(0.0, counter.value);
73 Expect.equals('test', counter.name);
74 Expect.equals('alpha bravo', counter.description);
75 counter.add(1.0);
76 Expect.equals(1.0, counter.value);
77 }
78
79 main() {
80 testGauge();
81 testGaugeRange();
82 testCounter();
83 }
OLDNEW
« runtime/lib/profiler.dart ('K') | « runtime/vm/service_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698