Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015, 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 import "package:async_helper/async_helper.dart"; | |
| 7 import 'memory_compiler.dart'; | |
| 8 | |
| 9 const MEMORY_SOURCE_FILES = const { | |
| 10 'main.dart': ''' | |
| 11 main() { | |
| 12 print(12300000); | |
| 13 print(1234567890123456789012345); | |
| 14 print(double.MAX_FINITE); | |
| 15 }'''}; | |
| 16 | |
| 17 void main() { | |
| 18 OutputCollector collector = new OutputCollector(); | |
| 19 var compiler = compilerFor(MEMORY_SOURCE_FILES, outputProvider: collector); | |
| 20 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { | |
| 21 // Check that we use the shorter exponential representations. | |
| 22 String jsOutput = collector.getOutput('', 'js'); | |
| 23 | |
| 24 Expect.isTrue(jsOutput.contains('1.23e+7')); // Shorter than 12300000. | |
|
sra1
2015/02/20 17:02:54
123e5 would be better
floitsch
2015/02/20 20:23:20
https://codereview.chromium.org/938323003
| |
| 25 Expect.isTrue(jsOutput.contains('1.2345678901234568e+24')); | |
| 26 Expect.isTrue(jsOutput.contains('1.7976931348623157e+308')); | |
| 27 Expect.isFalse(jsOutput.contains('12300000')); | |
| 28 Expect.isFalse(jsOutput.contains('1234567890123456789012345')); | |
| 29 // The decimal expansion of double.MAX_FINITE has 308 digits. We only check | |
| 30 // for its prefix. | |
| 31 Expect.isFalse(jsOutput.contains('179769313486231570814527423731')); | |
| 32 })); | |
| 33 } | |
| OLD | NEW |