OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011, 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 // Test number types. | |
5 | |
6 #library("NumbersTest.dart"); | |
7 #import("dart:coreimpl"); | |
8 | |
9 class NumbersTest { | |
10 static double testMain() { | |
11 var one = 1; | |
12 Expect.equals(true, one is Object); | |
13 Expect.equals(true, one is num); | |
14 Expect.equals(true, one is int); | |
15 Expect.equals(true, one is Smi); | |
16 Expect.equals(false, one is double); | |
17 Expect.equals(false, one is Double); | |
18 | |
19 var two = 2.0; | |
20 Expect.equals(true, two is Object); | |
21 Expect.equals(true, two is num); | |
22 Expect.equals(false, two is int); | |
23 Expect.equals(false, two is Smi); | |
24 Expect.equals(true, two is double); | |
25 Expect.equals(true, two is Double); | |
26 | |
27 var result = one + two; | |
28 Expect.equals(true, result is Object); | |
29 Expect.equals(true, result is num); | |
30 Expect.equals(false, result is int); | |
31 Expect.equals(false, result is Smi); | |
32 Expect.equals(true, result is double); | |
33 Expect.equals(true, result is Double); | |
34 | |
35 Expect.equals(3.0, result); | |
36 return result; | |
37 } | |
38 } | |
39 | |
40 | |
41 main() { | |
42 NumbersTest.testMain(); | |
43 } | |
OLD | NEW |