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

Side by Side Diff: test/dart_codegen/expect/core/duration.dart

Issue 963593002: Disable formatting and add new-lines to make tests faster. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 part of dart.core; 1 part of dart.core;
2 2 class Duration implements Comparable<Duration> {static const int MICROSECONDS_P ER_MILLISECOND = 1000;
3 class Duration implements Comparable<Duration> { 3 static const int MILLISECONDS_PER_SECOND = 1000;
4 static const int MICROSECONDS_PER_MILLISECOND = 1000; 4 static const int SECONDS_PER_MINUTE = 60;
5 static const int MILLISECONDS_PER_SECOND = 1000; 5 static const int MINUTES_PER_HOUR = 60;
6 static const int SECONDS_PER_MINUTE = 60; 6 static const int HOURS_PER_DAY = 24;
7 static const int MINUTES_PER_HOUR = 60; 7 static const int MICROSECONDS_PER_SECOND = MICROSECONDS_PER_MILLISECOND * MILLI SECONDS_PER_SECOND;
8 static const int HOURS_PER_DAY = 24; 8 static const int MICROSECONDS_PER_MINUTE = MICROSECONDS_PER_SECOND * SECONDS_PE R_MINUTE;
9 static const int MICROSECONDS_PER_SECOND = 9 static const int MICROSECONDS_PER_HOUR = MICROSECONDS_PER_MINUTE * MINUTES_PER_ HOUR;
10 MICROSECONDS_PER_MILLISECOND * MILLISECONDS_PER_SECOND; 10 static const int MICROSECONDS_PER_DAY = MICROSECONDS_PER_HOUR * HOURS_PER_DAY;
11 static const int MICROSECONDS_PER_MINUTE = 11 static const int MILLISECONDS_PER_MINUTE = MILLISECONDS_PER_SECOND * SECONDS_PE R_MINUTE;
12 MICROSECONDS_PER_SECOND * SECONDS_PER_MINUTE; 12 static const int MILLISECONDS_PER_HOUR = MILLISECONDS_PER_MINUTE * MINUTES_PER_ HOUR;
13 static const int MICROSECONDS_PER_HOUR = 13 static const int MILLISECONDS_PER_DAY = MILLISECONDS_PER_HOUR * HOURS_PER_DAY;
14 MICROSECONDS_PER_MINUTE * MINUTES_PER_HOUR; 14 static const int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
15 static const int MICROSECONDS_PER_DAY = MICROSECONDS_PER_HOUR * HOURS_PER_DAY; 15 static const int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
16 static const int MILLISECONDS_PER_MINUTE = 16 static const int MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
17 MILLISECONDS_PER_SECOND * SECONDS_PER_MINUTE; 17 static const Duration ZERO = const Duration(seconds: 0);
18 static const int MILLISECONDS_PER_HOUR = 18 final int _duration;
19 MILLISECONDS_PER_MINUTE * MINUTES_PER_HOUR; 19 const Duration({
20 static const int MILLISECONDS_PER_DAY = MILLISECONDS_PER_HOUR * HOURS_PER_DAY; 20 int days : 0, int hours : 0, int minutes : 0, int seconds : 0, int millisecond s : 0, int microseconds : 0}
21 static const int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR; 21 ) : this._microseconds(days * MICROSECONDS_PER_DAY + hours * MICROSECONDS_PER_HO UR + minutes * MICROSECONDS_PER_MINUTE + seconds * MICROSECONDS_PER_SECOND + mil liseconds * MICROSECONDS_PER_MILLISECOND + microseconds);
22 static const int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY; 22 const Duration._microseconds(this._duration);
23 static const int MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY; 23 Duration operator +(Duration other) {
24 static const Duration ZERO = const Duration(seconds: 0); 24 return new Duration._microseconds(_duration + other._duration);
25 final int _duration;
26 const Duration({int days: 0, int hours: 0, int minutes: 0, int seconds: 0,
27 int milliseconds: 0, int microseconds: 0})
28 : this._microseconds(days * MICROSECONDS_PER_DAY +
29 hours * MICROSECONDS_PER_HOUR +
30 minutes * MICROSECONDS_PER_MINUTE +
31 seconds * MICROSECONDS_PER_SECOND +
32 milliseconds * MICROSECONDS_PER_MILLISECOND +
33 microseconds);
34 const Duration._microseconds(this._duration);
35 Duration operator +(Duration other) {
36 return new Duration._microseconds(_duration + other._duration);
37 } 25 }
38 Duration operator -(Duration other) { 26 Duration operator -(Duration other) {
39 return new Duration._microseconds(_duration - other._duration); 27 return new Duration._microseconds(_duration - other._duration);
40 } 28 }
41 Duration operator *(num factor) { 29 Duration operator *(num factor) {
42 return new Duration._microseconds((_duration * factor).round()); 30 return new Duration._microseconds((_duration * factor).round());
43 } 31 }
44 Duration operator ~/(int quotient) { 32 Duration operator ~/(int quotient) {
45 if (quotient == 0) throw new IntegerDivisionByZeroException(); 33 if (quotient == 0) throw new IntegerDivisionByZeroException();
46 return new Duration._microseconds(_duration ~/ quotient); 34 return new Duration._microseconds(_duration ~/ quotient);
47 } 35 }
48 bool operator <(Duration other) => this._duration < other._duration; 36 bool operator <(Duration other) => this._duration < other._duration;
49 bool operator >(Duration other) => this._duration > other._duration; 37 bool operator >(Duration other) => this._duration > other._duration;
50 bool operator <=(Duration other) => this._duration <= other._duration; 38 bool operator <=(Duration other) => this._duration <= other._duration;
51 bool operator >=(Duration other) => this._duration >= other._duration; 39 bool operator >=(Duration other) => this._duration >= other._duration;
52 int get inDays => _duration ~/ Duration.MICROSECONDS_PER_DAY; 40 int get inDays => _duration ~/ Duration.MICROSECONDS_PER_DAY;
53 int get inHours => _duration ~/ Duration.MICROSECONDS_PER_HOUR; 41 int get inHours => _duration ~/ Duration.MICROSECONDS_PER_HOUR;
54 int get inMinutes => _duration ~/ Duration.MICROSECONDS_PER_MINUTE; 42 int get inMinutes => _duration ~/ Duration.MICROSECONDS_PER_MINUTE;
55 int get inSeconds => _duration ~/ Duration.MICROSECONDS_PER_SECOND; 43 int get inSeconds => _duration ~/ Duration.MICROSECONDS_PER_SECOND;
56 int get inMilliseconds => _duration ~/ Duration.MICROSECONDS_PER_MILLISECOND; 44 int get inMilliseconds => _duration ~/ Duration.MICROSECONDS_PER_MILLISECOND;
57 int get inMicroseconds => _duration; 45 int get inMicroseconds => _duration;
58 bool operator ==(other) { 46 bool operator ==(other) {
59 if (other is! Duration) return false; 47 if (other is! Duration) return false;
60 return _duration == other._duration; 48 return _duration == other._duration;
61 } 49 }
62 int get hashCode => _duration.hashCode; 50 int get hashCode => _duration.hashCode;
63 int compareTo(Duration other) => _duration.compareTo(other._duration); 51 int compareTo(Duration other) => _duration.compareTo(other._duration);
64 String toString() { 52 String toString() {
65 String sixDigits(int n) { 53 String sixDigits(int n) {
66 if (n >= 100000) return "$n"; 54 if (n >= 100000) return "$n";
67 if (n >= 10000) return "0$n"; 55 if (n >= 10000) return "0$n";
68 if (n >= 1000) return "00$n"; 56 if (n >= 1000) return "00$n";
69 if (n >= 100) return "000$n"; 57 if (n >= 100) return "000$n";
70 if (n >= 10) return "0000$n"; 58 if (n >= 10) return "0000$n";
71 return "00000$n"; 59 return "00000$n";
72 } 60 }
73 String twoDigits(int n) { 61 String twoDigits(int n) {
74 if (n >= 10) return "$n"; 62 if (n >= 10) return "$n";
75 return "0$n"; 63 return "0$n";
76 } 64 }
77 if (inMicroseconds < 0) { 65 if (inMicroseconds < 0) {
78 return "-${-this}"; 66 return "-${-this}
79 } 67 ";
80 String twoDigitMinutes = twoDigits(((__x11) => DDC$RT.cast(__x11, num, int,
81 "CastGeneral", """line 258, column 40 of dart:core/duration.dart: """,
82 __x11 is int, true))(inMinutes.remainder(MINUTES_PER_HOUR)));
83 String twoDigitSeconds = twoDigits(((__x12) => DDC$RT.cast(__x12, num, int,
84 "CastGeneral", """line 259, column 40 of dart:core/duration.dart: """,
85 __x12 is int, true))(inSeconds.remainder(SECONDS_PER_MINUTE)));
86 String sixDigitUs = sixDigits(((__x13) => DDC$RT.cast(__x13, num, int,
87 "CastGeneral", """line 261, column 19 of dart:core/duration.dart: """,
88 __x13 is int,
89 true))(inMicroseconds.remainder(MICROSECONDS_PER_SECOND)));
90 return "$inHours:$twoDigitMinutes:$twoDigitSeconds.$sixDigitUs";
91 } 68 }
92 bool get isNegative => _duration < 0; 69 String twoDigitMinutes = twoDigits(((__x11) => DDC$RT.cast(__x11, num, int, "Ca stGeneral", """line 258, column 40 of dart:core/duration.dart: """, __x11 is int , true))(inMinutes.remainder(MINUTES_PER_HOUR)));
93 Duration abs() => new Duration._microseconds(_duration.abs()); 70 String twoDigitSeconds = twoDigits(((__x12) => DDC$RT.cast(__x12, num, int, "Ca stGeneral", """line 259, column 40 of dart:core/duration.dart: """, __x12 is int , true))(inSeconds.remainder(SECONDS_PER_MINUTE)));
94 Duration operator -() => new Duration._microseconds(-_duration); 71 String sixDigitUs = sixDigits(((__x13) => DDC$RT.cast(__x13, num, int, "CastGen eral", """line 261, column 19 of dart:core/duration.dart: """, __x13 is int, tru e))(inMicroseconds.remainder(MICROSECONDS_PER_SECOND)));
72 return "$inHours:$twoDigitMinutes:$twoDigitSeconds.$sixDigitUs";
95 } 73 }
74 bool get isNegative => _duration < 0;
75 Duration abs() => new Duration._microseconds(_duration.abs());
76 Duration operator -() => new Duration._microseconds(-_duration);
77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698