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

Side by Side Diff: tests/corelib_strong/double_floor_test.dart

Issue 2988573002: Migrate block 6 to Dart 2.0. (Closed)
Patch Set: Created 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2013, 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 import 'package:expect/expect.dart';
6
7 main() {
8 Expect.equals(0, 0.0.floor());
9 Expect.equals(0, double.MIN_POSITIVE.floor());
10 Expect.equals(0, (2.0 * double.MIN_POSITIVE).floor());
11 Expect.equals(0, (1.18e-38).floor());
12 Expect.equals(0, (1.18e-38 * 2).floor());
13 Expect.equals(0, 0.49999999999999994.floor());
14 Expect.equals(0, 0.5.floor());
15 Expect.equals(0, 0.9999999999999999.floor());
16 Expect.equals(1, 1.0.floor());
17 Expect.equals(1, 1.000000000000001.floor());
18 // The following numbers are on the border of 52 bits.
19 // For example: 4503599627370499 + 0.5 => 4503599627370500.
20 Expect.equals(4503599627370496, 4503599627370496.0.floor());
21 Expect.equals(4503599627370497, 4503599627370497.0.floor());
22 Expect.equals(4503599627370498, 4503599627370498.0.floor());
23 Expect.equals(4503599627370499, 4503599627370499.0.floor());
24
25 Expect.equals(9007199254740991, 9007199254740991.0.floor());
26 Expect.equals(9007199254740992, 9007199254740992.0.floor());
27 Expect.equals(
28 17976931348623157081452742373170435679807056752584499659891747680315726078 00285387605895586327668781715404589535143824642343213268894641827684675467035375 16986049910576551282076245490090389328944075868508455133942304583236903222948165 808559332123348274797826204144723168738177180919299881250404026184124858368,
29 double.MAX_FINITE.floor());
30
31 Expect.equals(-1, (-double.MIN_POSITIVE).floor());
32 Expect.equals(-1, (2.0 * -double.MIN_POSITIVE).floor());
33 Expect.equals(-1, (-1.18e-38).floor());
34 Expect.equals(-1, (-1.18e-38 * 2).floor());
35 Expect.equals(-1, (-0.49999999999999994).floor());
36 Expect.equals(-1, (-0.5).floor());
37 Expect.equals(-1, (-0.9999999999999999).floor());
38 Expect.equals(-1, (-1.0).floor());
39 Expect.equals(-2, (-1.000000000000001).floor());
40 Expect.equals(-4503599627370496, (-4503599627370496.0).floor());
41 Expect.equals(-4503599627370497, (-4503599627370497.0).floor());
42 Expect.equals(-4503599627370498, (-4503599627370498.0).floor());
43 Expect.equals(-4503599627370499, (-4503599627370499.0).floor());
44 Expect.equals(-9007199254740991, (-9007199254740991.0).floor());
45 Expect.equals(-9007199254740992, (-9007199254740992.0).floor());
46 Expect.equals(
47 -1797693134862315708145274237317043567980705675258449965989174768031572607 80028538760589558632766878171540458953514382464234321326889464182768467546703537 51698604991057655128207624549009038932894407586850845513394230458323690322294816 5808559332123348274797826204144723168738177180919299881250404026184124858368,
48 (-double.MAX_FINITE).floor());
49
50 Expect.isTrue(0.0.floor() is int);
51 Expect.isTrue(double.MIN_POSITIVE.floor() is int);
52 Expect.isTrue((2.0 * double.MIN_POSITIVE).floor() is int);
53 Expect.isTrue((1.18e-38).floor() is int);
54 Expect.isTrue((1.18e-38 * 2).floor() is int);
55 Expect.isTrue(0.49999999999999994.floor() is int);
56 Expect.isTrue(0.5.floor() is int);
57 Expect.isTrue(0.9999999999999999.floor() is int);
58 Expect.isTrue(1.0.floor() is int);
59 Expect.isTrue(1.000000000000001.floor() is int);
60 Expect.isTrue(4503599627370496.0.floor() is int);
61 Expect.isTrue(4503599627370497.0.floor() is int);
62 Expect.isTrue(4503599627370498.0.floor() is int);
63 Expect.isTrue(4503599627370499.0.floor() is int);
64 Expect.isTrue(9007199254740991.0.floor() is int);
65 Expect.isTrue(9007199254740992.0.floor() is int);
66 Expect.isTrue(double.MAX_FINITE.floor() is int);
67
68 Expect.isTrue((-double.MIN_POSITIVE).floor() is int);
69 Expect.isTrue((2.0 * -double.MIN_POSITIVE).floor() is int);
70 Expect.isTrue((-1.18e-38).floor() is int);
71 Expect.isTrue((-1.18e-38 * 2).floor() is int);
72 Expect.isTrue((-0.49999999999999994).floor() is int);
73 Expect.isTrue((-0.5).floor() is int);
74 Expect.isTrue((-0.9999999999999999).floor() is int);
75 Expect.isTrue((-1.0).floor() is int);
76 Expect.isTrue((-1.000000000000001).floor() is int);
77 Expect.isTrue((-4503599627370496.0).floor() is int);
78 Expect.isTrue((-4503599627370497.0).floor() is int);
79 Expect.isTrue((-4503599627370498.0).floor() is int);
80 Expect.isTrue((-4503599627370499.0).floor() is int);
81 Expect.isTrue((-9007199254740991.0).floor() is int);
82 Expect.isTrue((-9007199254740992.0).floor() is int);
83 Expect.isTrue((-double.MAX_FINITE).floor() is int);
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698