Set up new test suites for migrating the tests to NNBD.

- Copies corelib_2/a*    -> corelib/
- Copies language_2/ab*  -> language/
- Copies lib_2/math/     -> lib/math/
- Copies standalone_2/a* -> standalone/

And also copies over and renames all of the status files in those
directories.

Then it migrates those tests to be static error free in NNBD.

Finally, adds support to the test_runner for the new suites.

Note that this review is split into multiple patchsets. The first
patchset is a straight copy of the existing files. Then the later
patchsets have the interesting changes.

Change-Id: Icec2ff850a3aee30b653066ac184495d1e3814d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125467
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Robert Nystrom
2019-11-19 00:18:43 +00:00
committed by commit-bot@chromium.org
parent baa2d8125f
commit 582cec84f4
66 changed files with 4540 additions and 7 deletions
@@ -51,8 +51,6 @@ abstract class CompilerConfiguration {
bool get _isDebug => _configuration.mode.isDebug;
bool get _isProduct => _configuration.mode == Mode.product;
bool get _isHostChecked => _configuration.isHostChecked;
bool get _useSdk => _configuration.useSdk;
@@ -1051,8 +1049,6 @@ abstract class VMKernelCompilerMixin {
bool get _useSdk;
bool get _isProduct;
bool get _isAot;
bool get _enableAsserts;
@@ -34,10 +34,14 @@ final TEST_SUITE_DIRECTORIES = [
Path('tests/compiler/dart2js_extra'),
Path('tests/compiler/dart2js_native'),
Path('tests/compiler/dartdevc_native'),
Path('tests/corelib'),
Path('tests/corelib_2'),
Path('tests/kernel'),
Path('tests/language'),
Path('tests/language_2'),
Path('tests/lib'),
Path('tests/lib_2'),
Path('tests/standalone'),
Path('tests/standalone_2'),
Path('tests/ffi'),
Path('utils/tests/peg'),
@@ -255,7 +255,6 @@ class TimingPrinter extends EventListener {
class StatusFileUpdatePrinter extends EventListener {
final Map<String, List<String>> statusToConfigs = {};
final List<String> _failureSummary = [];
void done(TestCase test) {
if (test.unexpectedOutput) {
@@ -391,7 +390,6 @@ class TestFailurePrinter extends EventListener {
class PassingStdoutPrinter extends EventListener {
final Formatter _formatter;
final _failureSummary = <String>[];
PassingStdoutPrinter([this._formatter = Formatter.normal]);
+2 -1
View File
@@ -147,7 +147,8 @@ abstract class TestSuite {
// So, for now, until we have figured out how to manage those tests, we
// implicitly skip any test that does not require NNBD if run in a
// configuration that enables the NNBD experiment.
if (configuration.experiments.contains("non-nullable") &&
if (testFile.path.toString().contains("language_2") &&
configuration.experiments.contains("non-nullable") &&
!(testFile.requirements.contains(Feature.nnbd) ||
testFile.requirements.contains(Feature.nnbdWeak) ||
testFile.requirements.contains(Feature.nnbdStrong))) {
+96
View File
@@ -0,0 +1,96 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
apply(Function function, List? positional, Map<Symbol, dynamic>? named) {
return Function.apply(function, positional, named);
}
void throwsNSME(
Function function, List? positional, Map<Symbol, dynamic>? named) {
Expect.throwsNoSuchMethodError(() => apply(function, positional, named));
}
main() {
var c1 = () => 'c1';
var c2 = (a) => 'c2 $a';
var c3 = ([a = 1]) => 'c3 $a';
var c4 = ({a: 1}) => 'c4 $a';
var c5 = ({a: 1, b: 2}) => 'c5 $a $b';
var c6 = ({b: 1, a: 2}) => 'c6 $a $b';
var c7 = (x, {b: 1, a: 2}) => 'c7 $x $a $b';
var c8 = (x, y, [a = 2, b = 3]) => 'c8 $x $y $a $b';
Expect.equals('c1', apply(c1, null, null));
Expect.equals('c1', apply(c1, [], null));
Expect.equals('c1', apply(c1, [], {}));
Expect.equals('c1', apply(c1, null, {}));
throwsNSME(c1, [1], null);
throwsNSME(c1, [1], {#a: 2});
throwsNSME(c1, null, {#a: 2});
Expect.equals('c2 1', apply(c2, [1], null));
Expect.equals('c2 1', apply(c2, [1], {}));
throwsNSME(c2, null, null);
throwsNSME(c2, [], null);
throwsNSME(c2, null, {});
throwsNSME(c2, null, {#a: 1});
throwsNSME(c2, [2], {#a: 1});
Expect.equals('c3 1', apply(c3, null, null));
Expect.equals('c3 1', apply(c3, [], null));
Expect.equals('c3 2', apply(c3, [2], {}));
throwsNSME(c3, [1, 2], null);
throwsNSME(c3, null, {#a: 1});
Expect.equals('c4 1', apply(c4, [], null));
Expect.equals('c4 2', apply(c4, [], {#a: 2}));
Expect.equals('c4 1', apply(c4, null, null));
Expect.equals('c4 1', apply(c4, [], {}));
throwsNSME(c4, [1], {#a: 1});
throwsNSME(c4, [1], {});
throwsNSME(c4, [], {#a: 1, #b: 2});
Expect.equals('c5 1 2', apply(c5, [], null));
Expect.equals('c5 3 2', apply(c5, [], {#a: 3}));
Expect.equals('c5 1 2', apply(c5, null, null));
Expect.equals('c5 1 2', apply(c5, [], {}));
Expect.equals('c5 3 4', apply(c5, [], {#a: 3, #b: 4}));
Expect.equals('c5 4 3', apply(c5, [], {#b: 3, #a: 4}));
Expect.equals('c5 1 3', apply(c5, [], {#b: 3}));
throwsNSME(c5, [1], {#a: 1});
throwsNSME(c5, [1], {});
throwsNSME(c5, [], {#a: 1, #b: 2, #c: 3});
Expect.equals('c6 2 1', apply(c6, [], null));
Expect.equals('c6 3 1', apply(c6, [], {#a: 3}));
Expect.equals('c6 2 1', apply(c6, null, null));
Expect.equals('c6 2 1', apply(c6, [], {}));
Expect.equals('c6 3 4', apply(c6, [], {#a: 3, #b: 4}));
Expect.equals('c6 4 3', apply(c6, [], {#b: 3, #a: 4}));
Expect.equals('c6 2 3', apply(c6, [], {#b: 3}));
throwsNSME(c6, [1], {#a: 1});
throwsNSME(c6, [1], {});
throwsNSME(c6, [], {#a: 1, #b: 2, #c: 3});
Expect.equals('c7 7 2 1', apply(c7, [7], null));
Expect.equals('c7 7 3 1', apply(c7, [7], {#a: 3}));
Expect.equals('c7 7 2 1', apply(c7, [7], {}));
Expect.equals('c7 7 3 4', apply(c7, [7], {#a: 3, #b: 4}));
Expect.equals('c7 7 4 3', apply(c7, [7], {#b: 3, #a: 4}));
Expect.equals('c7 7 2 3', apply(c7, [7], {#b: 3}));
throwsNSME(c7, [], {#a: 1});
throwsNSME(c7, [], {});
throwsNSME(c7, [7], {#a: 1, #b: 2, #c: 3});
Expect.equals('c8 7 8 2 3', apply(c8, [7, 8], null));
Expect.equals('c8 7 8 2 3', apply(c8, [7, 8], {}));
Expect.equals('c8 7 8 3 3', apply(c8, [7, 8, 3], null));
Expect.equals('c8 7 8 3 4', apply(c8, [7, 8, 3, 4], null));
throwsNSME(c8, [], null);
throwsNSME(c8, [], {});
throwsNSME(c8, [1], null);
throwsNSME(c8, [7, 8, 9, 10, 11], null);
}
+34
View File
@@ -0,0 +1,34 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test [Function.apply] on user-defined classes that implement [noSuchMethod].
import "package:expect/expect.dart";
class F {
call([p1]) => "call";
noSuchMethod(Invocation invocation) => "NSM";
}
class G {
call() => '42';
noSuchMethod(Invocation invocation) => invocation;
}
class H {
call(required, {a}) => required + a;
}
main() {
Expect.equals('call', Function.apply(new F(), []));
Expect.equals('call', Function.apply(new F(), [1]));
Expect.throwsNoSuchMethodError(() => Function.apply(new F(), [1, 2]));
Expect.throwsNoSuchMethodError(() => Function.apply(new F(), [1, 2, 3]));
Expect.throwsNoSuchMethodError(() => Function.apply(new G(), [1], {#a: 42}));
// Test that [i] can be used to hit an existing method.
Expect.equals(43, new H().call(1, a: 42));
Expect.equals(43, Function.apply(new H(), [1], {#a: 42}));
}
+20
View File
@@ -0,0 +1,20 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
// Testing Function.apply calls work correctly for arities that are not
// otherwise present in the program (and thus might not have stubs
// generated).
class A {
foo(x, [y, z, a, b, c, d = 99, e, f, g, h, i, j]) => "$x $d";
}
main() {
var a = new A();
var clos = a.foo;
Expect.equals(Function.apply(clos, ["well"]), "well 99");
Expect.equals(Function.apply(clos, ["well", 0, 2, 4, 3, 6, 9, 10]), "well 9");
}
+23
View File
@@ -0,0 +1,23 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
// Testing that, when compiled to JS, Function.apply works correctly for
// functions with that will be invoked directly vs using .apply().
class A {
foo([a = 10, b = 20, c = 30, d = 40, e = 50]) => "$a $b $c $d $e";
}
main() {
var a = new A();
var clos = a.foo;
Expect.equals(Function.apply(clos, []), "10 20 30 40 50");
Expect.equals(Function.apply(clos, [11]), "11 20 30 40 50");
Expect.equals(Function.apply(clos, [11, 21]), "11 21 30 40 50");
Expect.equals(Function.apply(clos, [11, 21, 31]), "11 21 31 40 50");
Expect.equals(Function.apply(clos, [11, 21, 31, 41]), "11 21 31 41 50");
Expect.equals(Function.apply(clos, [11, 21, 31, 41, 51]), "11 21 31 41 51");
}
@@ -0,0 +1,21 @@
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
import "symbol_map_helper.dart";
// Testing Function.apply calls correctly with generic type arguments.
// This test is not testing error handling, only that correct parameters
// cause a correct call.
test0<T extends num>(T i, T j, {required T a}) => i + j + a;
main() {
test(res, func, list, map) {
map = symbolMapToStringMap(map);
Expect.equals(res, Function.apply(func, list, map));
}
test(42, test0, [10, 15], {"a": 17});
}
+78
View File
@@ -0,0 +1,78 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
import "symbol_map_helper.dart";
// Testing Function.apply calls correctly.
// This test is not testing error handling, only that correct parameters
// cause a correct call.
int test0() => 42;
int test0a({required int a}) => 37 + a;
int test1(int i) => i + 1;
int test1a(int i, {required int a}) => i + a;
int test2(int i, int j) => i + j;
int test2a(int i, int j, {required int a}) => i + j + a;
class C {
int x = 10;
int foo(int y) => this.x + y;
}
class Callable {
int call(int x, int y) => x + y;
}
@pragma('dart2js:noInline')
@pragma('dart2js:assumeDynamic')
confuse(x) => x;
main() {
testMap(res, func, map) {
Expect.equals(res, Function.apply(func, null, map));
Expect.equals(res, Function.apply(func, [], map));
}
testList(res, func, list) {
Expect.equals(res, Function.apply(func, list));
Expect.equals(res, Function.apply(func, list, null));
Expect.equals(res, Function.apply(func, list, new Map<Symbol, dynamic>()));
}
testListTyped(res, Function func, list) => testList(res, func, list);
test(res, func, list, map) {
Expect.equals(res, Function.apply(func, list, map));
}
testList(42, test0, null);
testList(42, test0, []);
testMap(42, test0a, {#a: 5});
testList(42, test1, [41]);
test(42, test1a, [20], {#a: 22});
testList(42, test2, [20, 22]);
test(42, test2a, [10, 15], {#a: 17});
// Test that "this" is correct when calling closurized functions.
var cfoo = new C().foo;
testList(42, cfoo, [32]);
// Test that apply works even with a different name.
var app = confuse(Function.apply);
Expect.equals(42, app(test2, [22, 20]));
// Test that apply can itself be applied.
Expect.equals(
42,
Function.apply(Function.apply, [
test2,
[17, 25]
]));
// Test that apply works on callable objects when it is passed to a method
// that expects Function (and not dynamic).
Expect.throws(() => testList(42, new Callable(), [13, 29])); //# 01: ok
testListTyped(42, new Callable(), [13, 29]); //# 02: ok
}
+61
View File
@@ -0,0 +1,61 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dartdevk ]
regexp/lookbehind_test/01: Skip # Flaky in uncatchable way. Issue 36280
[ $mode == debug ]
regexp/pcre_test: Slow # Issue 22008
[ $arch == x64 && $system == windows ]
stopwatch_test: Skip # Flaky test due to expected performance behaviour.
[ $builder_tag == obfuscated && $runtime == dart_precompiled ]
apply_generic_function_test: SkipByDesign # Function.apply with named args
apply_test: Skip # Uses new Symbol via symbolMapToStringMap helper
dynamic_nosuchmethod_test: SkipByDesign # Expects names in NSM
error_stack_trace1_test: SkipByDesign # Expects unobfuscated stack trace
type_tostring_test: SkipByDesign # Expects names in Type.toString()
[ $compiler != dart2analyzer && $compiler != dart2js && $compiler != dartdevc && $compiler != dartdevk ]
bigint_js_test: SkipByDesign # JavaScript-specific test
[ $compiler == dart2js && $runtime != none ]
regexp/pcre_test: Slow # Issue 21593
# We no longer expect Dart2 tests to run with the standalone VM without the new
# common front end, but for now we get better coverage by still running them in
# checked mode, which is mostly Dart2-compatible.
[ $compiler == none && !$checked && ($runtime == dart_precompiled || $runtime == vm) ]
*: SkipByDesign
[ $runtime != none && ($compiler == dart2js || $compiler == dartdevc || $compiler == dartdevk) ]
int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
[ $arch == simarm || $arch == simarm64 ]
bigint_parse_radix_test: Skip # Issue 31659
bigint_test: Skip # Issue 31659
[ $compiler == dartdevc || $compiler == dartdevk ]
bigint_test/03: SkipSlow # modPow is very slow
bigint_test/15: SkipSlow # modPow is very slow
int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
uri_parse_test: Slow
uri_test: Slow
[ $compiler == dartkb || $compiler == dartkp ]
bigint_parse_radix_test: Slow # --no_intrinsify
bigint_test/03: SkipSlow # --no_intrinsify
bigint_test/15: SkipSlow # --no_intrinsify
[ $runtime == dart_precompiled || $runtime == vm ]
regexp/global_test: Skip # Issue 21709
regexp/pcre_test: Slow
[ $hot_reload || $hot_reload_rollback ]
bigint_parse_radix_test: Skip # Issue 31659. Issue 34361.
bigint_test: Skip # Issue 31659
integer_parsed_mul_div_vm_test: Slow # Slow
@@ -0,0 +1,27 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Regression test for dart2js that used to be confused when inlining
// method that always aborts in a switch case.
import "package:expect/expect.dart";
foo() {
throw 42;
}
main() {
var exception;
try {
switch (42) {
case 42:
foo();
foo();
break;
}
} catch (e) {
exception = e;
}
Expect.equals(42, exception);
}
@@ -0,0 +1,16 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
// TODO(rnystrom): This test should be renamed since now it's just about
// testing that constructing an abstract class generates an error.
abstract class A {
A() {}
}
void main() {
/*@compile-error=unspecified*/ new A();
}
+32
View File
@@ -0,0 +1,32 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class A {
bool operator ==(other);
const A();
}
class B implements A {
const B();
}
class C extends A {
const C();
}
class Invalid {
bool operator ==(other) => false;
const Invalid();
}
class D implements Invalid {
const D();
}
main() {
print(const {A(): 1});
print(const {B(): 2});
print(const {C(): 3});
print(const {D(): 4});
}
@@ -0,0 +1,38 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Regression test for dart2js that used to duplicate some `Object`
// methods to handle `noSuchMethod`.
import "package:expect/expect.dart";
import "compiler_annotations.dart";
abstract //# 01: compile-time error
class Foo {
noSuchMethod(im) => 42;
}
@DontInline()
returnFoo() {
(() => 42)();
return new Foo();
}
class Bar {
operator ==(other) => false;
}
var a = [false, true, new Object(), new Bar()];
main() {
if (a[0] as bool) {
// This `==` call will make the compiler create a selector with an
// exact `TypeMask` of `Foo`. Since `Foo` is abstract, such a call
// cannot happen, but we still used to generate a `==` method on
// the `Object` class to handle `noSuchMethod`.
print(returnFoo() == 42);
} else {
Expect.isFalse(a[2] == 42);
}
}
@@ -0,0 +1,31 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart test program for constructors and initializers.
// Exercises issue 2282, factory constructors in abstract classes should
// not emit a static type warning
class B extends A1 {
B() {}
method() {}
}
abstract class A1 {
A1() {}
method(); // Abstract.
factory A1.make() {
return new B();
}
}
class A2 {
// Intentionally abstract method.
method(); //# 00: compile-time error
A2.make() {}
}
main() {
new A1.make();
new A2.make(); //# 00: continued
}
+66
View File
@@ -0,0 +1,66 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
class A {
int get x => 100;
}
abstract class B extends A {
int _x = 0;
int get x;
set x(int v) {
_x = v;
}
}
class C extends B {
int get x => super.x;
}
class GetterConcrete {
var _foo;
get foo => _foo;
set foo(x) => _foo = x;
var _bar;
get bar => _bar;
set bar(x) => _bar = x;
}
class AbstractGetterOverride1 extends GetterConcrete {
get foo;
set bar(x);
}
class AbstractGetterOverride2 extends Object with GetterConcrete {
get foo;
set bar(x);
}
void main() {
B b = new C();
b.x = 42;
Expect.equals(b._x, 42);
Expect.equals(b.x, 100);
/// Tests that overriding either the getter or setter with an abstract member
/// has no effect.
/// Regression test for https://github.com/dart-lang/sdk/issues/29914
var c1 = AbstractGetterOverride1()
..foo = 123
..bar = 456;
Expect.equals(c1.foo, 123);
Expect.equals(c1.bar, 456);
var c2 = AbstractGetterOverride2()
..foo = 123
..bar = 456;
Expect.equals(c2.foo, 123);
Expect.equals(c2.bar, 456);
}
+25
View File
@@ -0,0 +1,25 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
// Test to ensure that an abstract getter is not mistaken for a field.
class Foo {
// Intentionally abstract:
get i; //# 01: compile-time error
}
class Bar {}
checkIt(f) {
Expect.throwsNoSuchMethodError(() => f.i = 'hi'); // //# 01: continued
Expect.throwsNoSuchMethodError(() => print(f.i)); // //# 01: continued
Expect.throwsNoSuchMethodError(() => print(f.i())); // //# 01: continued
}
main() {
checkIt(new Foo());
checkIt(new Bar());
}
+45
View File
@@ -0,0 +1,45 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
// Checks that abstract instance methods are correctly resolved.
int get length => throw "error: top-level getter called";
set height(x) {
throw "error: top-level setter called";
}
width() {
throw "error: top-level function called";
}
abstract class A {
int get length; // Abstract instance getter.
set height(int x); // Abstract instance setter.
int width(); // Abstract instance method.
// Must resolve to non-abstract length getter in subclass.
get useLength => length;
// Must resolve to non-abstract height setter in subclass.
setHeight(x) => height = x;
// Must resolve to non-abstract width() method in subclass.
useWidth() => width();
}
class A1 extends A {
int length; // Implies a length getter.
int? height; // Implies a height setter.
int width() => 345;
A1(this.length);
}
main() {
var a = new A1(123);
Expect.equals(123, a.useLength);
a.setHeight(234);
Expect.equals(234, a.height);
Expect.equals(345, a.useWidth());
print([a.useLength, a.height, a.useWidth()]);
}
@@ -0,0 +1,25 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
class A {
noSuchMethod(_) {
Expect.fail('Should not reach here');
}
}
class B extends A {
operator ==(other);
}
class C extends B {}
var a = [new C()];
main() {
C c = a[0];
a.add(c);
Expect.isTrue(c == a[1]);
}
@@ -0,0 +1,28 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class A {
void foo() {}
}
abstract class B extends A {
// If this class were concrete, there would be a problem, since `new
// B().foo(42)` would be statically allowed, but would lead to invalid
// arguments being passed to A.foo. But since the class is abstract, there is
// no problem.
void foo([x]);
}
class /*@compile-error=unspecified*/ C extends B {
// However, there is a problem here because this class is concrete and doesn't
// override foo.
}
void f(B b) {
b.foo();
}
main() {
f(new C());
}
@@ -0,0 +1,21 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class A {
void foo() {}
}
class B extends A {
// This class declaration violates soundness, since it allows `new
// B().foo(42)`, which would lead to invalid arguments being passed to A.foo.
void /*@compile-error=unspecified*/ foo([x]);
}
void f(B b) {
b.foo();
}
main() {
f(new B());
}
@@ -0,0 +1,31 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class A {
void foo() {}
}
abstract class B extends A {
// If this class were concrete, there would be a problem, since `new
// B().foo(42)` would be statically allowed, but would lead to invalid
// arguments being passed to A.foo. But since the class is abstract, there is
// no problem.
void foo([x]);
}
class C extends B {
void foo([x]) {
// But it is a problem to try to pass `x` along to super, since the super
// method is A.foo.
super.foo(/*@compile-error=unspecified*/ x);
}
}
void f(B b) {
b.foo(42);
}
main() {
f(new C());
}
@@ -0,0 +1,33 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// This test exercises a corner case of override checking that is safe from a
// soundness perspective, but which we haven't decided whether or not to allow
// from a usability perspective.
class A {
void foo() {}
}
abstract class B extends A {
// If this class were concrete, there would be a problem, since `new
// B().foo(42)` would be statically allowed, but would lead to invalid
// arguments being passed to A.foo. But since the class is abstract, there is
// no problem.
void foo([x]);
}
class C extends B {
void foo([x]) {
super.foo();
}
}
void f(B b) {
b.foo(42);
}
main() {
f(new C());
}
+20
View File
@@ -0,0 +1,20 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
main() {
var b = new B();
Expect.equals(42, b.foo());
}
class A {
foo(); // //# 00: compile-time error
static bar(); // //# 01: syntax error
}
class B extends A {
foo() => 42;
bar() => 87;
}
+12
View File
@@ -0,0 +1,12 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library compiler_annotations;
// This library contains annotations useful for testing.
// TODO(ngeoffray): Implement in dart2js.
class DontInline {
const DontInline();
}
+43
View File
@@ -0,0 +1,43 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler != dart2analyzer ]
switch_case_warn_test: Skip # Analyzer only, see language_analyzer2.status
[ $compiler == none ]
invalid_returns/*: Skip # https://github.com/dart-lang/sdk/issues/34013
void/*: Skip # https://github.com/dart-lang/sdk/issues/34013
[ $compiler == spec_parser ]
double_literals/*: Skip # https://github.com/dart-lang/sdk/issues/34355
invalid_returns/*: Skip # https://github.com/dart-lang/sdk/issues/34015
mixin_declaration/*: Skip # See https://github.com/dart-lang/language/issues/7
void/*: Skip # https://github.com/dart-lang/sdk/issues/34015
[ $mode == debug ]
large_class_declaration_test: Slow
[ $mode == product ]
assertion_test: SkipByDesign # Requires checked mode.
generic_test: SkipByDesign # Requires checked mode.
issue13474_test: SkipByDesign # Requires checked mode.
map_literal4_test: SkipByDesign # Requires checked mode.
named_parameters_type_test/01: SkipByDesign # Requires checked mode.
named_parameters_type_test/02: SkipByDesign # Requires checked mode.
named_parameters_type_test/03: SkipByDesign # Requires checked mode.
positional_parameters_type_test/01: SkipByDesign # Requires checked mode.
positional_parameters_type_test/02: SkipByDesign # Requires checked mode.
regress_29784_test/02: SkipByDesign # Requires checked mode.
stacktrace_demangle_ctors_test: SkipByDesign # Names are not scrubbed.
type_checks_in_factory_method_test: SkipByDesign # Requires checked mode.
[ $compiler != dart2js && $compiler != dartdevc && !$checked ]
function_type/*: Skip # Needs checked mode.
[ $compiler != dartk && $compiler != dartkb && $compiler != dartkp && $mode == debug && $runtime == vm ]
built_in_identifier_type_annotation_test/set: Crash # Not supported by legacy VM front-end.
[ $hot_reload || $hot_reload_rollback ]
issue_22780_test/01: Crash # Issue 29094
vm/optimized_stacktrace_test: Slow
+11
View File
@@ -0,0 +1,11 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should contain "$compiler == dart2analyzer".
[ $compiler == dart2analyzer ]
large_class_declaration_test: Slow
vm/debug_break_enabled_vm_test: Skip
vm/debug_break_vm_test/*: Skip
vm/regress_27201_test: SkipByDesign # Loads bad library, so will always crash.
+31
View File
@@ -0,0 +1,31 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should contain "$compiler == dart2js".
[ $compiler == dart2js ]
mixin_method_override_test/G5: Skip # Issue 34354
vm/*: SkipByDesign # Tests for the VM.
[ $compiler != dart2js ]
minify_closure_variable_collision_test: SkipByDesign # Regression test for dart2js
[ $builder_tag == dart2js_production && $compiler == dart2js ]
control_flow_collections/for_non_bool_condition_test: Crash # Issue 36442
[ $compiler == dart2js && $runtime == chromeOnAndroid ]
override_field_test/02: Slow # TODO(kasperl): Please triage.
[ $compiler == dart2js && $runtime == d8 ]
conditional_import_string_test: SkipByDesign # No XHR in d8
conditional_import_test: SkipByDesign # No XHR in d8
[ $compiler == dart2js && $runtime == jsshell ]
await_for_test: Skip # Jsshell does not provide periodic timers, Issue 7728
[ $compiler == dart2js && $system == windows ]
canonicalization_hashing_memoize_array_test: Skip # Issue 37631
canonicalization_hashing_memoize_instance_test: Skip # Issue 37631
canonicalization_hashing_shallow_collision_array_test: Skip # Issue 37631
canonicalization_hashing_shallow_collision_instance_test: Skip # Issue 37631
+23
View File
@@ -0,0 +1,23 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should contain "$compiler == dartdevc" or dartdevk.
[ $compiler == dartdevc ]
const_double_in_int_op_test/dd6: Skip # Triple shift
const_double_in_int_op_test/di6: Skip # Triple shift
const_double_in_int_op_test/id6: Skip # Triple shift
const_double_in_int_op_test/ii6: Skip # Triple shift
extension_methods/*: SkipByDesign # Analyzer DDC is expected to be turned down before releasing extension methods.
large_class_declaration_test: Slow
nnbd/*: Skip
variance/*: SkipByDesign # Analyzer DDC is expected to be turned down before releasing variance.
[ $compiler == dartdevk && !$checked ]
assertion_initializer_const_error2_test/*: SkipByDesign # DDC does not support non-checked mode.
[ $compiler == dartdevc || $compiler == dartdevk ]
asyncstar_throw_in_catch_test: Skip # Times out. Issue 29920
int64_literal_test/*: Skip # This is testing Dart 2.0 int64 semantics.
superinterface_variance/*: Skip # Issue dart-lang/language#113
vm/*: SkipByDesign # VM only tests.; VM only tests.
+152
View File
@@ -0,0 +1,152 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == app_jitk ]
no_main_test/01: Crash
vm/regress_27671_test: SkipByDesign # Relies on string comparison of exception message which may return '<optimized out>'
web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $compiler == dartkp ]
web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $compiler == fasta ]
async_await_syntax_test/e5: Crash # Assertion error: continuation.dart: Failed assertion: 'node.expression == null || node.expression is NullLiteral': is not true.
async_await_syntax_test/e6: Crash # Assertion error: continuation.dart: Failed assertion: 'node.expression == null || node.expression is NullLiteral': is not true.
web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $fasta ]
nnbd/*: Skip
superinterface_variance/abstract_class_error_test/27: Crash # Issue dart-lang/language#113
superinterface_variance/concrete_class_error_test/27: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/27: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/37: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/38: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/40: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/41: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/42: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/43: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/44: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/46: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/47: Crash # Issue dart-lang/language#113
superinterface_variance/mixin_error_test/48: Crash # Issue dart-lang/language#113
[ $builder_tag == obfuscated && $compiler == dartkp ]
generic_function_dcall_test/01: SkipByDesign # Prints type names
many_named_arguments_test: SkipByDesign # Checks names of arguments
mixin_generic_test: SkipByDesign # Prints type names
mixin_mixin3_test: SkipByDesign # Prints type names
mixin_mixin5_test: SkipByDesign # Prints type names
mixin_mixin6_test: SkipByDesign # Prints type names
mixin_mixin_bound2_test: SkipByDesign # Prints type names
symbol_literal_test/02: SkipByDesign # We don't obfuscate const Symbol constructor
type_literal_test: SkipByDesign # Uses lots of strings with type names in them
vm/bool_check_stack_traces_test: SkipByDesign # Looks for filenames in stacktrace output
vm/no_such_args_error_message_vm_test: SkipByDesign # Looks for function name in error message
vm/no_such_method_error_message_callable_vm_test: SkipByDesign # Expects unobfuscated method names
vm/no_such_method_error_message_vm_test: SkipByDesign # Looks for unobfuscated name in error message
vm/regress_28325_test: SkipByDesign # Looks for filename in stack trace
[ $compiler == dartk && $mode == debug && ($hot_reload || $hot_reload_rollback) ]
inference_enum_list_test: Skip # Issue 35885
[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled ]
vm/precompiled_static_initializer_test: Slow
# ==== dartkp + dart_precompiled status lines ====
[ $compiler == dartkp && $runtime == dart_precompiled ]
assert_with_type_test_or_cast_test: Crash
const_evaluation_test: SkipByDesign
ct_const2_test: Skip # Incompatible flag: --compile_all
deferred_redirecting_factory_test: Crash # Issue 23408, KernelVM bug: Deferred loading kernel issue 30273.
deopt_inlined_function_lazy_test: Skip # Incompatible flag: --deoptimize-alot
enum_mirror_test: SkipByDesign
export_ambiguous_main_test: Skip # Issue 29895 Fail Issue 14763
export_double_same_main_test: Skip # Issue 29895 Crash Issue 29895
field_increment_bailout_test: SkipByDesign
generic_methods_recursive_bound_test/03: Crash
hello_dart_test: Skip # Incompatible flag: --compile_all
implicit_closure_test: Skip # Incompatible flag: --use_slow_path
instance_creation_in_function_annotation_test: SkipByDesign
invocation_mirror2_test: SkipByDesign
invocation_mirror_invoke_on2_test: SkipByDesign
invocation_mirror_invoke_on_test: SkipByDesign
issue21079_test: SkipByDesign
main_not_a_function_test: Skip
many_overridden_no_such_method_test: SkipByDesign
mixin_illegal_super_use_test: Skip # Issues 24478 and 23773
mixin_illegal_superclass_test: Skip # Issues 24478 and 23773
no_main_test/01: Skip
no_such_method_test: SkipByDesign
null_test/mirrors: Skip # Uses mirrors.
null_test/none: SkipByDesign
overridden_no_such_method_test: SkipByDesign
redirecting_factory_reflection_test: SkipByDesign
regress_13462_0_test: SkipByDesign
regress_13462_1_test: SkipByDesign
regress_18535_test: SkipByDesign
regress_28255_test: SkipByDesign
vm/causal_async_exception_stack2_test: SkipByDesign
vm/causal_async_exception_stack_test: SkipByDesign
vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM
vm/reflect_core_vm_test: SkipByDesign
vm/regress_27671_test: Skip # Unsupported
vm/regress_29145_test: Skip # Issue 29145
[ $compiler == dartkp && $runtime == dart_precompiled && $checked ]
assertion_initializer_const_error2_test/cc01: Crash
assertion_initializer_const_error2_test/cc02: Crash
assertion_initializer_const_error2_test/cc03: Crash
assertion_initializer_const_error2_test/cc04: Crash
assertion_initializer_const_error2_test/cc05: Crash
assertion_initializer_const_error2_test/cc06: Crash
assertion_initializer_const_error2_test/cc07: Crash
assertion_initializer_const_error2_test/cc08: Crash
assertion_initializer_const_error2_test/cc09: Crash
assertion_initializer_const_error2_test/cc10: Crash
assertion_initializer_const_error2_test/cc11: Crash
[ $compiler == dartkp && $system == windows ]
disassemble_test: Slow
[ $mode == debug && $runtime == vm && ($compiler == app_jitk || $compiler == dartk || $compiler == dartkb) ]
deopt_inlined_function_lazy_test: Skip
[ $mode == debug && $hot_reload && ($compiler == dartk || $compiler == dartkb) ]
async_star_test/01: Crash
async_star_test/05: Crash
[ $mode == debug && ($compiler == dartk || $compiler == dartkb) && ($hot_reload || $hot_reload_rollback) ]
enum_duplicate_test/02: Crash # Issue 34606
enum_duplicate_test/none: Crash # Issue 34606
enum_private_test/01: Crash # Issue 34606
enum_test: Crash # Issue 34606
[ $mode == product && $runtime == vm && ($compiler == dartk || $compiler == dartkb) ]
vm/causal_async_exception_stack2_test: SkipByDesign
vm/causal_async_exception_stack_test: SkipByDesign
# ===== dartk + vm status lines =====
[ $runtime == vm && ($compiler == dartk || $compiler == dartkb) ]
ct_const2_test: Crash # Flaky
disassemble_test: Slow, Crash # dartbug.com/34971
mixin_illegal_super_use_test: Skip # Issues 24478 and 23773
mixin_illegal_superclass_test: Skip # Issues 24478 and 23773
no_main_test/01: Skip
vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM
vm/regress_29145_test: Skip # Issue 29145
web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $hot_reload_rollback && ($compiler == dartk || $compiler == dartkb) ]
symbol_conflict_test: Slow
[ ($compiler == dartk || $compiler == dartkb) && ($hot_reload || $hot_reload_rollback) ]
async_star_test/01: Skip # Timeout
async_star_test/02: Skip # Timeout
async_star_test/03: Skip # Timeout
async_star_test/04: Skip # Timeout
async_star_test/05: Skip # Timeout
async_star_test/none: Skip # Timeout
type_constants_test/none: Skip # Deferred libraries and hot reload.
@@ -0,0 +1,44 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should start with "$runtime == dart_precompiled".
[ $arch == arm64 && $runtime == dart_precompiled ]
large_class_declaration_test: SkipSlow # Uses too much memory.
setter4_test: MissingCompileTimeError
[ $arch == ia32 && $runtime == dart_precompiled ]
vm/regress_24517_test: Pass, Fail # Issue 24517.
[ $compiler != dart2analyzer && $runtime == dart_precompiled ]
mixin_mixin2_test: Skip
[ $compiler == dartkp && $runtime == dart_precompiled ]
async_star/async_star_await_for_test: RuntimeError
async_star/async_star_cancel_test: RuntimeError
async_star/async_star_test: RuntimeError
[ $runtime == dart_precompiled && $minified ]
cyclic_type_test/*: Skip
enum_duplicate_test/*: Skip # Uses Enum.toString()
enum_private_test/*: Skip # Uses Enum.toString()
enum_test: Skip # Uses Enum.toString()
full_stacktrace1_test: Skip
full_stacktrace2_test: Skip
full_stacktrace3_test: Skip
mixin_generic_test: Skip
mixin_mixin3_test: Skip
mixin_mixin5_test: Skip
mixin_mixin6_test: Skip
mixin_mixin_bound2_test: Skip
mixin_mixin_type_arguments_test: Skip
mixin_super_2_test: Skip
no_such_method_dispatcher_test: Skip # Uses new Symbol()
vm/no_such_args_error_message_vm_test: Skip
vm/no_such_method_error_message_callable_vm_test: Skip
vm/no_such_method_error_message_vm_test: Skip
vm/regress_28325_test: Skip
[ $runtime == dart_precompiled && ($mode == product || $minified) ]
stacktrace_rethrow_error_test: SkipByDesign # obfuscation/minification and instruction deduplication cause names of frames to be mangled (expected)
stacktrace_rethrow_nonerror_test: SkipByDesign # obfuscation/minification and instruction deduplication cause names of frames to be mangled (expected)
@@ -0,0 +1,64 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == spec_parser ]
built_in_identifier_prefix_test: Skip # A built-in identifier can _not_ be a prefix.
closure_type_test: Pass # Marked as RuntimeError for all in language_2.status.
const_native_factory_test: Skip # Uses `native`.
deep_nesting_expression_test: Skip # JVM stack overflow.
deep_nesting_statement_test: Skip # JVM stack overflow.
double_invalid_test: Skip # Contains illegaly formatted double.
getter_declaration_negative_test: Fail # Negative, uses getter with parameter.
inst_field_initializer1_negative_test: Skip # Negative, not syntax.
instance_call_wrong_argument_count_negative_test: Skip # Negative, not syntax.
instance_method2_negative_test: Skip # Negative, not syntax.
instance_method_negative_test: Skip # Negative, not syntax.
interface2_negative_test: Skip # Negative, not syntax.
interface_static_method_negative_test: Skip # Negative, not syntax.
interface_static_non_final_fields_negative_test: Skip # Negative, not syntax.
is_not_class1_negative_test: Fail # Negative, uses `a is "A"`.
is_not_class4_negative_test: Fail # Negative, uses `a is A is A`.
issue1578_negative_test: Fail # Negative, is line noise.
issue_1751477_test: Skip # Times out: 9 levels, exponential blowup => 430 secs.
large_class_declaration_test: Skip # JVM stack overflow.
list_literal2_negative_test: Skip # Negative, not syntax.
list_literal_negative_test: Fail # Negative, uses `new List<int>[1, 2]`.
map_literal2_negative_test: Skip # Negative, not syntax.
map_literal_negative_test: Fail # Negative, uses `new Map<int>{..}`.
new_expression1_negative_test: Fail # Negative, uses `new id`.
new_expression2_negative_test: Fail # Negative, uses `new id(`.
new_expression3_negative_test: Fail # Negative, uses `new id(...`.
nnbd/syntax/opt_out_nnbd_modifiers_test: Skip # Requires opt-out of NNBD.
nnbd/syntax/pre_nnbd_modifiers_test: Skip # Requires opt-out of NNBD.
no_such_method_negative_test: Skip # Negative, not syntax.
non_const_super_negative_test: Skip # Negative, not syntax.
operator1_negative_test: Fail # Negative, declares static operator.
operator2_negative_test: Fail # Negative, declares `operator ===`.
override_field_method1_negative_test: Skip # Negative, not syntax.
override_field_method2_negative_test: Skip # Negative, not syntax.
override_field_method4_negative_test: Skip # Negative, not syntax.
override_field_method5_negative_test: Skip # Negative, not syntax.
parameter_initializer1_negative_test: Skip # Negative, not syntax.
parameter_initializer2_negative_test: Skip # Negative, not syntax.
parameter_initializer3_negative_test: Skip # Negative, not syntax.
parameter_initializer4_negative_test: Skip # Negative, not syntax.
parameter_initializer6_negative_test: Skip # Negative, not syntax.
private_member1_negative_test: Skip # Negative, not syntax.
private_member2_negative_test: Skip # Negative, not syntax.
private_member3_negative_test: Skip # Negative, not syntax.
script1_negative_test: Skip # Negative, not syntax.
script2_negative_test: Skip # Negative, not syntax.
string_escape4_negative_test: Fail # Negative, uses newline in string literal.
string_interpolate1_negative_test: Fail # Negative, misplaced '$'.
string_interpolate2_negative_test: Fail # Negative, misplaced '$'.
string_unicode1_negative_test: Skip # Negative, not syntax.
string_unicode2_negative_test: Skip # Negative, not syntax.
string_unicode3_negative_test: Skip # Negative, not syntax.
string_unicode4_negative_test: Skip # Negative, not syntax.
switch1_negative_test: Fail # Negative, `default` clause not last.
test_negative_test: Fail # Negative, uses non-terminated string literal.
unary_plus_negative_test: Fail # Negative, uses non-existing unary plus.
variance: Skip # Not yet supported.
vm/debug_break_enabled_vm_test/01: Fail # Uses debug break.
vm/debug_break_enabled_vm_test/none: Fail # Uses debug break.
+32
View File
@@ -0,0 +1,32 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should contain "$runtime == vm".
[ $compiler == dartkp ]
assertion_initializer_const_error2_test/cc01: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc03: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc04: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc05: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc06: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc07: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc08: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
[ $runtime == vm ]
async_star/async_star_await_for_test: RuntimeError
async_star/async_star_cancel_test: RuntimeError
async_star/async_star_test: RuntimeError
[ $arch == arm64 && $runtime == vm ]
closure_cycles_test: Pass, Slow
large_class_declaration_test: SkipSlow # Uses too much memory.
[ $arch == ia32 && $mode == release && $runtime == vm ]
deep_nesting_expression_test/01: Crash, Pass # Issue 31496
[ $runtime == dart_precompiled || $runtime == vm ]
superinterface_variance/*: Skip # Issue dart-lang/language#113
@@ -0,0 +1,6 @@
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2analyzer ]
*: Skip
+125
View File
@@ -0,0 +1,125 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
html/cross_frame_test: Skip # Issue 32039, test reloads itself (not by design - investigate)
wasm/*: Skip # dart:wasm is currently behind a Dart SDK build flag.
[ $arch == simarm64 ]
convert/utf85_test: Skip # Pass, Slow Issue 20111.
[ $mode == product ]
developer/timeline_test: Skip # Not supported
isolate/issue_24243_parent_isolate_test: Skip # Requires checked mode
[ $runtime == ff ]
convert/streamed_conversion_utf8_decode_test: Slow # Issue 12029
mirrors/mirrors_reader_test: Slow # Issue 16589
[ $runtime == ie11 ]
html/request_animation_frame_test: Skip # Times out. Issue 22167
html/transition_event_test: Skip # Times out. Issue 22167
[ $runtime == safari ]
html/indexeddb_1_test/functional: Skip # Times out. Issue 21433
html/indexeddb_3_test: Skip # Times out 1 out of 10.
html/worker_api_test: Skip # Issue 13221
[ $system == windows ]
html/xhr_test/xhr: Skip # Times out. Issue 21527
[ $csp ]
isolate/deferred_in_isolate2_test: Skip # Issue 16898. Deferred loading does not work from an isolate in CSP-mode
[ $runtime == chrome && $system == linux ]
mirrors/native_class_test: Slow
[ $runtime == chrome && $system == macos ]
convert/streamed_conversion_utf8_encode_test: SkipSlow # Times out. Issue 22050
html/canvasrenderingcontext2d_test/drawImage_video_element: Skip # Times out. Please triage this failure.
html/canvasrenderingcontext2d_test/drawImage_video_element_dataUrl: Skip # Times out. Please triage this failure.
html/request_animation_frame_test: Skip # Times out. Issue 22167
html/transition_event_test: Skip # Times out. Issue 22167
[ $runtime != dart_precompiled && ($runtime != vm || $compiler != dartk && $compiler != none) ]
isolate/vm_rehash_test: SkipByDesign
[ $arch == simarm || $arch == simarmv6 ]
convert/utf85_test: Skip # Pass, Slow Issue 12644.
[ $arch != x64 || $compiler == dartkb || $runtime != vm ]
isolate/int32_length_overflow_test: SkipSlow
[ $compiler != none || $runtime != vm ]
isolate/package_config_test: SkipByDesign # Uses Isolate.packageConfig
isolate/package_resolve_test: SkipByDesign # Uses Isolate.resolvePackageUri
isolate/package_root_test: SkipByDesign # Uses Isolate.packageRoot
isolate/scenarios/*: SkipByDesign # Use automatic package resolution, spawnFunction and .dart URIs.
isolate/spawn_uri_fail_test: SkipByDesign # Uses dart:io.
[ $mode == product || $runtime != vm ]
isolate/checked_test: Skip # Unsupported.
[ $runtime == chrome || $runtime == ff ]
async/slow_consumer2_test: SkipSlow # Times out. Issue 22050
async/stream_timeout_test: SkipSlow # Times out. Issue 22050
[ $runtime == dart_precompiled || $runtime == vm ]
isolate/isolate_stress_test: Skip # Issue 12588: Uses dart:html. This should be able to pass when we have wrapper-less tests.
# It makes no sense to run any test that uses spawnURI under the simulator
# as that would involve running CFE (the front end) in simulator mode
# to compile the URI file specified in spawnURI code.
# These Isolate tests that use spawnURI are hence skipped on purpose.
[ $runtime == dart_precompiled || $runtime == vm && ($arch == simarm || $arch == simarm64) ]
isolate/count_test: Skip # Isolate.spawnUri
isolate/cross_isolate_message_test: Skip # Isolate.spawnUri
isolate/deferred_in_isolate2_test: Skip # Isolate.spawnUri
isolate/deferred_in_isolate_test: Skip # Isolate.spawnUri
isolate/error_at_spawnuri_test: Skip # Isolate.spawnUri
isolate/error_exit_at_spawnuri_test: Skip # Isolate.spawnUri
isolate/exit_at_spawnuri_test: Skip # Isolate.spawnUri
isolate/illegal_msg_function_test: Skip # Isolate.spawnUri
isolate/illegal_msg_mirror_test: Skip # Isolate.spawnUri
isolate/isolate_complex_messages_test: Skip # Isolate.spawnUri
isolate/issue_21398_parent_isolate1_test: Skip # Isolate.spawnUri
isolate/issue_21398_parent_isolate_test: Skip # Isolate.spawnUri
isolate/issue_24243_parent_isolate_test: Skip # Isolate.spawnUri
isolate/issue_6610_test: Skip # Isolate.spawnUri
isolate/mandel_isolate_test: Skip # Isolate.spawnUri
isolate/message2_test: Skip # Isolate.spawnUri
isolate/message_test: Skip # Isolate.spawnUri
isolate/mint_maker_test: Skip # Isolate.spawnUri
isolate/nested_spawn2_test: Skip # Isolate.spawnUri
isolate/nested_spawn_test: Skip # Isolate.spawnUri
isolate/raw_port_test: Skip # Isolate.spawnUri
isolate/request_reply_test: Skip # Isolate.spawnUri
isolate/spawn_function_custom_class_test: Skip # Isolate.spawnUri
isolate/spawn_function_test: Skip # Isolate.spawnUri
isolate/spawn_uri_exported_main_test: Skip # Isolate.spawnUri
isolate/spawn_uri_missing_from_isolate_test: Skip # Isolate.spawnUri
isolate/spawn_uri_missing_test: Skip # Isolate.spawnUri
isolate/spawn_uri_multi_test: Skip # Isolate.spawnUri
isolate/spawn_uri_nested_vm_test: Skip # Isolate.spawnUri
isolate/spawn_uri_test: Skip # Isolate.spawnUri
isolate/spawn_uri_vm_test: Skip # Isolate.spawnUri
isolate/stacktrace_message_test: Skip # Isolate.spawnUri
isolate/static_function_test: Skip # Isolate.spawnUri
isolate/unresolved_ports_test: Skip # Isolate.spawnUri
[ $hot_reload || $hot_reload_rollback ]
convert/chunked_conversion_utf88_test: SkipSlow
convert/utf85_test: SkipSlow
isolate/deferred_in_isolate2_test: Crash # Requires deferred libraries
isolate/deferred_in_isolate_test: Crash # Requires deferred libraries
isolate/issue_21398_parent_isolate2_test: Crash # Requires deferred libraries
isolate/spawn_uri_nested_vm_test: Crash # Issue 28192
mirrors/closurization_equivalence_test: SkipByDesign # Method equality
mirrors/deferred_constraints_constants_test: Crash # Requires deferred libraries
mirrors/deferred_mirrors_metadata_test: Crash # Deferred loading
mirrors/deferred_mirrors_metatarget_test: Crash # Deferred loading
mirrors/deferred_mirrors_update_test: Crash # Deferred loading
mirrors/library_enumeration_deferred_loading_test: Crash # Deferred loading
mirrors/library_import_deferred_loading_test: Crash # Deferred loading
mirrors/library_imports_deferred_test: Crash # Deferred loading
mirrors/load_library_test: Crash # Deferred loading
mirrors/typedef_deferred_library_test: Crash # Deferred loading
+6
View File
@@ -0,0 +1,6 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2analyzer ]
html/js_function_getter_trust_types_test: Skip # dart2js specific flags.
+6
View File
@@ -0,0 +1,6 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == app_jitk ]
mirrors/*: Skip # Issue 27929: Triage
+98
View File
@@ -0,0 +1,98 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2js ]
convert/chunked_conversion_utf88_test: Slow
convert/utf85_test: Slow
developer/timeline_test: Skip # Not supported
html/async_test: SkipByDesign
html/custom/document_register_basic_test: Slow
html/custom/document_register_type_extensions_test/construction: Slow
html/custom/document_register_type_extensions_test/registration: Slow
html/custom/entered_left_view_test/shadow_dom: Slow
html/custom/js_custom_test: Skip # mirrors not supported, delete this test.
html/custom/mirrors_2_test: Skip # mirrors not supported, delete this test.
html/custom/mirrors_test: Skip # mirrors not supported, delete this test.
html/custom_elements_test: Slow # Issue 26789
html/isolates_test: SkipByDesign
html/mirrors_js_typed_interop_test: Skip # mirrors not supported, delete this test.
html/worker_api_test: SkipByDesign
html/wrapping_collections_test: SkipByDesign # Testing an issue that is only relevant to Dartium
html/xhr_test: Slow
isolate/*: SkipByDesign # No support for dart:isolate in dart4web (http://dartbug.com/30538)
mirrors/*: SkipByDesign # Mirrors not supported on web in Dart 2.0.
profiler/metrics_num_test: Skip # Because of an int / double type test.
wasm/*: SkipByDesign # dart:wasm not currently supported on web.
[ $compiler != dart2js ]
async/dart2js_uncaught_error_test: Skip # JS-integration only test
[ $compiler == dart2js && $runtime == chrome ]
async/slow_consumer2_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_decode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_encode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_utf8_decode_test: SkipSlow # Times out. Issue 22050
[ $compiler == dart2js && $runtime == chromeOnAndroid ]
html/crypto_test/functional: Slow # TODO(dart2js-team): Please triage this failure.
html/input_element_datetime_test: Slow # TODO(dart2js-team): Please triage this failure.
[ $compiler == dart2js && $runtime == d8 ]
html/event_callback_test: Skip # Browser test
[ $compiler == dart2js && $runtime == ff ]
async/slow_consumer2_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_decode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_encode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_utf8_decode_test: SkipSlow # Times out. Issue 22050
convert/utf85_test: Slow
html/callback_list_test: SkipByDesign # FileSystem not supported in FireFox.
html/custom/attribute_changed_callback_test: Skip # Times out
html/custom/created_callback_test: Skip # Times out
html/custom/document_register_basic_test: Skip # Times out, or unittest times out
html/dart_object_local_storage_test: Skip # sessionStorage NS_ERROR_DOM_NOT_SUPPORTED_ERR
html/file_sample_test: Skip # FileSystem not supported on FireFox.
html/fileapi_supported_test: Skip # FileSystem not supported on FireFox.
html/fileapi_supported_throws_test: Skip # FileSystem not supported on FireFox.
html/history_test/history: Skip # Issue 22050
html/request_animation_frame_test: Skip # Async test hangs.
[ $compiler == dart2js && $runtime == safari ]
html/callback_list_test: SkipByDesign # FileSystem not supported in Safari.
html/file_sample_test: Skip # FileSystem not supported on Safari.
html/fileapi_supported_throws_test: Skip # FileSystem not supported on Safari
html/interactive_media_test: SkipSlow
[ $compiler == dart2js && $system == linux ]
html/interactive_geolocation_test: Skip # Requires allowing geo location.
[ $compiler == dart2js && $checked ]
convert/utf85_test: Slow # Issue 12029.
html/js_function_getter_trust_types_test: Skip # --trust-type-annotations incompatible with --checked
[ $compiler == dart2js && $csp && ($runtime == chrome || $runtime == chromeOnAndroid || $runtime == ff || $runtime == safari) ]
html/event_customevent_test: SkipByDesign
html/js_array_test: SkipByDesign
html/js_dart_to_string_test: SkipByDesign
html/js_function_getter_test: SkipByDesign
html/js_function_getter_trust_types_test: SkipByDesign
html/js_interop_1_test: SkipByDesign
html/js_typed_interop_bind_this_test: SkipByDesign
html/js_typed_interop_callable_object_test: SkipByDesign
html/js_typed_interop_default_arg_test: SkipByDesign
html/js_typed_interop_test: SkipByDesign
html/js_typed_interop_type1_test: SkipByDesign
html/js_typed_interop_type3_test: SkipByDesign
html/js_typed_interop_type_test: SkipByDesign
html/js_typed_interop_window_property_test: SkipByDesign
html/js_util_test: SkipByDesign
html/mirrors_js_typed_interop_test: SkipByDesign
html/postmessage_structured_test: SkipByDesign
[ $compiler == dart2js && ($runtime == chrome || $runtime == ff) ]
async/slow_consumer2_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_decode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_encode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_utf8_decode_test: SkipSlow # Times out. Issue 22050
+49
View File
@@ -0,0 +1,49 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dartdevc ]
html/xhr_test: Slow
[ $runtime == chrome && ($compiler == dartdevc || $compiler == dartdevk) ]
html/js_dispatch_property_test: Skip # Timeout Issue 31030
[ $system == linux && ($compiler == dartdevc || $compiler == dartdevk) ]
html/interactive_geolocation_test: Skip # Requires allowing geo location.
[ $system == macos && ($compiler == dartdevc || $compiler == dartdevk) ]
html/interactive_media_test: Skip # Requires interactive camera, microphone permissions.
[ $system == windows && ($compiler == dartdevc || $compiler == dartdevk) ]
html/xhr_test: Skip # Times out. Issue 21527
[ $compiler == dartdevc || $compiler == dartdevk ]
convert/chunked_conversion_utf88_test: Slow
convert/json_utf8_chunk_test: Slow
convert/streamed_conversion_utf8_decode_test: Slow # Issue 29922
convert/utf85_test: Slow
html/callback_list_test: Skip # Test requires user interaction to accept permissions.
html/custom/attribute_changed_callback_test: Skip # Issue 31577
html/custom/constructor_calls_created_synchronously_test: Skip # Issue 31577
html/custom/created_callback_test: Skip # Issue 31577
html/custom/document_register_basic_test: Skip # Issue 31577
html/custom/document_register_template_test: Skip # Issue 31577
html/custom/document_register_type_extensions_test/construction: Skip # Issue 31577
html/custom/document_register_type_extensions_test/constructors: Skip # Issue 31577
html/custom/document_register_type_extensions_test/createElement with type extension: Skip # Issue 31577
html/custom/document_register_type_extensions_test/functional: Skip # Issue 31577
html/custom/document_register_type_extensions_test/namespaces: Skip # Issue 31577
html/custom/document_register_type_extensions_test/parsing: Skip # Issue 31577
html/custom/document_register_type_extensions_test/registration: Skip # Issue 31577
html/custom/document_register_type_extensions_test/single-parameter createElement: Skip # Issue 31577
html/custom/element_upgrade_test: Skip # Issue 31577
html/custom/entered_left_view_test: Skip # Issue 31577
html/custom/mirrors_2_test: Skip # Issue 31577
html/custom_element_method_clash_test: Skip # Issue 29922
html/custom_element_name_clash_test: Skip # Issue 29922
html/custom_elements_23127_test: Skip # Issue 29922
html/custom_elements_test: Skip # Issue 29922
html/notification_permission_test: Skip # Issue 32002
isolate/*: SkipByDesign # No support for dart:isolate in dart4web (http://dartbug.com/30538)
mirrors/*: SkipByDesign # Mirrors not supported on web in Dart 2.0.
profiler/metrics_num_test: Skip # Because of an int / double type test.
+76
View File
@@ -0,0 +1,76 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should contain "$compiler == dartk" or
# "$compiler == dartkp".
isolate/ping_pause_test: Skip # Issue https://dartbug.com/37787
[ $compiler == dartkb ]
isolate/isolate_complex_messages_test: Crash # runtime/vm/object.cc: 17395: error: expected: type_arguments.IsNull() || type_arguments.IsCanonical()
[ $compiler == fasta ]
html/*: Skip # TODO(ahe): Make dart:html available.
js/*: Skip # TODO(ahe): Make dart:js available.
[ $arch == x64 && $mode == debug && $runtime == vm && ($compiler == dartk || $compiler == dartkb) ]
mirrors/invocation_fuzz_test: Skip # Because it times out, issue 29439.
[ $arch == x64 && ($hot_reload || $hot_reload_rollback) ]
convert/base64_test/01: Crash # http://dartbug.com/35948
[ $builder_tag == optimization_counter_threshold && ($compiler == dartk || $compiler == dartkb) ]
mirrors/invocation_fuzz_test/emptyarray: Crash # Flaky on vm-kernel-optcounter-threshold-linux-release-x64, bug #31838
mirrors/invocation_fuzz_test/false: Crash # Flaky on vm-kernel-optcounter-threshold-linux-release-x64, bug #31838
mirrors/invocation_fuzz_test/none: Crash # Flaky on vm-kernel-optcounter-threshold-linux-release-x64, bug #31838
mirrors/invocation_fuzz_test/smi: Crash # Crashes on opt counter builder (#31838)
mirrors/invocation_fuzz_test/string: Crash # Flaky on vm-kernel-optcounter-threshold-linux-release-x64, bug #31838
[ $compiler == app_jitk && ($mode == product || $mode == release) ]
isolate/spawn_uri_nested_vm_test: Skip # Timeout, Issue 33385
[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled ]
isolate/static_function_test: Skip # Flaky (https://github.com/dart-lang/sdk/issues/30063).
# ===== dartkp + dart_precompiled status lines =====
[ $compiler == dartkp && $runtime == dart_precompiled ]
html/*: SkipByDesign # dart:html not supported on VM.
isolate/deferred_in_isolate2_test: Skip # Times out. Deferred loading kernel issue 28335.
isolate/deferred_in_isolate_test: Skip # Times out. Deferred loading kernel issue 28335.
isolate/issue_21398_parent_isolate2_test/01: Skip # Times out. Deferred loading kernel issue 28335.
mirrors/*: SkipByDesign # Mirrors are not supported in AOT mode.
[ $mode == debug && $runtime == vm && ($compiler == dartk || $compiler == dartkb) ]
mirrors/other_declarations_location_test: Crash # Issue 33325 (assertion error, TypeParameter not having position).
[ $mode == debug && $hot_reload_rollback && ($compiler == dartk || $compiler == dartkb) ]
isolate/message3_test/constList_identical: Skip # Timeout
# ===== dartk + vm status lines =====
[ $runtime == vm && ($compiler == dartk || $compiler == dartkb) ]
html/*: SkipByDesign # dart:html not supported on VM.
isolate/deferred_in_isolate2_test: Skip # Times out. Deferred loading kernel issue 28335.
isolate/deferred_in_isolate_test: Skip # Times out. Deferred loading kernel issue 28335.
isolate/issue_21398_parent_isolate2_test/01: Skip # Times out. Deferred loading kernel issue 28335.
isolate/static_function_test: Skip # Times out. Issue 31855. CompileTimeError. Issue 31402
mirrors/invocation_fuzz_test: Crash
mirrors/metadata_allowed_values_test/16: Skip # Flaky, crashes.
mirrors/mirrors_used*: SkipByDesign # Invalid tests. MirrorsUsed does not have a specification, and dart:mirrors is not required to hide declarations that are not covered by any MirrorsUsed annotation.
mirrors/native_class_test: SkipByDesign # Imports dart:html
[ $hot_reload_rollback && ($compiler == dartk || $compiler == dartkb) ]
isolate/illegal_msg_function_test: Skip # Timeout
isolate/pause_test: Skip # Timeout
[ ($compiler == dartk || $compiler == dartkb) && ($hot_reload || $hot_reload_rollback) ]
isolate/message4_test: Crash # Timeout and sporadic crash (issue 33824)
mirrors/dynamic_load_test: Skip # Reload has an effect similar to deleting the dynamically loaded library
mirrors/immutable_collections_test: Pass, Slow
mirrors/mirrors_reader_test: Pass, Slow
[ $compiler == app_jitk || $compiler == dartk || $compiler == dartkb || $compiler == dartkp ]
html/*: SkipByDesign
js/*: SkipByDesign
[ $hot_reload || $hot_reload_rollback ]
isolate/issue_6610_test: Skip # Sources are looked up on every reload request.
+9
View File
@@ -0,0 +1,9 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == none ]
async/future_or_strong_test: RuntimeError
isolate/compile_time_error_test/01: Skip # Issue 12587
isolate/ping_test: Skip # Resolve test issues
mirrors/symbol_validation_test: RuntimeError # Issue 13596
+86
View File
@@ -0,0 +1,86 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $runtime != vm ]
isolate/native_wrapper_message_test: Skip # A VM specific test.
[ $arch == arm64 && $runtime == vm ]
mirrors/immutable_collections_test: Pass, Slow # http://dartbug.com/33057
[ $arch == ia32 && $mode == debug && $runtime == vm && $system == windows ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification OOM.
[ $arch != ia32 && $arch != simarm && $arch != simarmv6 && $arch != x64 && $mode == debug && $runtime == vm ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification not yet implemented.
[ $arch == simarm64 && $runtime == vm ]
convert/utf85_test: Skip # Pass, Slow Issue 20111.
[ $compiler != app_jitk && $compiler != dartk && $compiler != dartkb && $runtime == vm ]
async/future_or_only_in_async_test/00: MissingCompileTimeError
convert/streamed_conversion_json_utf8_decode_test: Pass, Slow # Infrequent timeouts.
html/*: SkipByDesign # dart:html not supported on VM.
js/datetime_roundtrip_test: CompileTimeError
js/null_test: CompileTimeError
js/prototype_access_test: CompileTimeError
mirrors/deferred_type_test: CompileTimeError
mirrors/generic_bounded_by_type_parameter_test/02: MissingCompileTimeError
mirrors/generic_bounded_test/01: MissingCompileTimeError
mirrors/generic_bounded_test/02: MissingCompileTimeError
mirrors/generic_interface_test/01: MissingCompileTimeError
mirrors/generics_test/01: MissingCompileTimeError
mirrors/initializing_formals_test/01: Fail # initializing formals are implicitly final as of Dart 1.21
mirrors/metadata_nested_constructor_call_test/none: CompileTimeError
mirrors/mirrors_used*: SkipByDesign # Invalid tests. MirrorsUsed does not have a specification, and dart:mirrors is not required to hide declarations that are not covered by any MirrorsUsed annotation.
mirrors/native_class_test: SkipByDesign # Imports dart:html
mirrors/redirecting_factory_different_type_test/01: MissingCompileTimeError
mirrors/redirecting_factory_test/01: RuntimeError
mirrors/redirecting_factory_test/none: RuntimeError
[ $compiler != app_jitk && $compiler != dartk && $compiler != dartkb && $runtime == vm && !$checked ]
mirrors/inference_and_no_such_method_test: RuntimeError
[ $runtime == vm && $system == fuchsia ]
async/first_regression_test: RuntimeError
async/future_timeout_test: RuntimeError
async/schedule_microtask2_test: RuntimeError
async/schedule_microtask3_test: RuntimeError
async/schedule_microtask5_test: RuntimeError
async/stream_controller_async_test: RuntimeError
async/stream_first_where_test: RuntimeError
async/stream_iterator_test: RuntimeError
async/stream_join_test: RuntimeError
async/stream_last_where_test: RuntimeError
async/stream_periodic2_test: RuntimeError
async/stream_periodic3_test: RuntimeError
async/stream_periodic4_test: RuntimeError
async/stream_periodic5_test: RuntimeError
async/stream_periodic6_test: RuntimeError
async/stream_periodic_test: RuntimeError
async/stream_single_test: RuntimeError
async/stream_single_to_multi_subscriber_test: RuntimeError
async/stream_state_nonzero_timer_test: RuntimeError
async/stream_state_test: RuntimeError
async/stream_subscription_as_future_test: RuntimeError
async/stream_subscription_cancel_test: RuntimeError
async/stream_transform_test: RuntimeError
async/stream_transformation_broadcast_test: RuntimeError
async/timer_cancel1_test: RuntimeError
async/timer_cancel2_test: RuntimeError
async/timer_cancel_test: RuntimeError
async/timer_isActive_test: RuntimeError
async/timer_repeat_test: RuntimeError
async/timer_test: RuntimeError
convert/json_lib_test: RuntimeError
math/point_test: RuntimeError
math/rectangle_test: RuntimeError
mirrors/invocation_fuzz_test: Crash
mirrors/library_uri_io_test: RuntimeError
mirrors/library_uri_package_test: RuntimeError
[ $runtime == vm && ($arch == simarm || $arch == simarmv6) ]
convert/utf85_test: Skip # Pass, Slow Issue 12644.
[ $arch == simarmv6 || $arch == simarm && $runtime == vm ]
convert/chunked_conversion_utf88_test: Skip # Pass, Slow Issue 12644.
@@ -0,0 +1,26 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// VMOptions=--optimization-counter-threshold=-1 --new_gen_semi_max_size=2
// TODO(rnystrom): This looks like a VM-specific test. Move out of
// tests/language and into somewhere more appropriate.
import 'dart:math';
main() {
// 2MB / 16 bytes = 125000 allocations
for (var i = 0; i < 500000; i++) {
sin(i);
}
for (var i = 0; i < 500000; i++) {
cos(i);
}
for (var i = 0; i < 500000; i++) {
i.toDouble().truncateToDouble();
}
}
+59
View File
@@ -0,0 +1,59 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that a coin toss with Random.nextBool() is fair.
import "package:expect/expect.dart";
import 'dart:math';
main() {
var seed = new Random().nextInt(1 << 16);
print("coin_test seed: $seed");
var rnd = new Random(seed);
var heads = 0;
var tails = 0;
for (var i = 0; i < 10000; i++) {
if (rnd.nextBool()) {
heads++;
} else {
tails++;
}
}
print("Heads: $heads\n"
"Tails: $tails\n"
"Ratio: ${heads / tails}\n");
Expect.approxEquals(1.0, heads / tails, 0.1);
heads = 0;
tails = 0;
for (var i = 0; i < 10000; i++) {
rnd = new Random(i);
if (rnd.nextBool()) {
heads++;
} else {
tails++;
}
}
print("Heads: $heads\n"
"Tails: $tails\n"
"Ratio: ${heads / tails}\n");
Expect.approxEquals(1.0, heads / tails, 0.1);
// A sequence of newly allocated Random number generators should have fair
// initial tosses.
heads = 0;
tails = 0;
for (var i = 0; i < 10000; i++) {
rnd = new Random();
if (rnd.nextBool()) {
heads++;
} else {
tails++;
}
}
print("Heads: $heads\n"
"Tails: $tails\n"
"Ratio: ${heads / tails}\n");
Expect.approxEquals(1.0, heads / tails, 0.1);
}
+174
View File
@@ -0,0 +1,174 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// VMOptions=--optimization-counter-threshold=5 --no-background-compilation
library math_test;
import "package:expect/expect.dart";
import 'dart:math';
void checkVeryClose(double a, num b) {
// We find a ulp (unit in the last place) by shifting the original number
// to the right. This only works if we are not too close to infinity or if
// we work with denormals.
// We special case for 0.0, but not for infinity.
if (a == 0.0) {
final minimalDouble = 4.9406564584124654e-324;
Expect.equals(true, b.abs() <= minimalDouble);
return;
}
if (b == 0.0) {
// No need to look if they are close. Otherwise the check for 'a' above
// would have triggered.
Expect.equals(a, b);
}
final double shiftRightBy52 = 2.220446049250313080847263336181640625e-16;
final double shiftedA = (a * shiftRightBy52).abs();
// Compared to 'a', 'shiftedA' is now ~1-2 ulp.
final double limitLow = a - shiftedA;
final double limitHigh = a + shiftedA;
Expect.equals(false, a == limitLow);
Expect.equals(false, a == limitHigh);
Expect.equals(true, limitLow <= b);
Expect.equals(true, b <= limitHigh);
}
const NaN = double.nan;
const Infinity = double.infinity;
var samples = [
NaN,
-Infinity,
-3.0, // Odd integer
-2.0, // Even integer
-1.5, // Non-integer, magnitude > 1
-1.0, // Unit
-0.5, // Non-integer, magnitude < 1.
-0.0,
0.5, // Non-integer, magnitude < 1.
1.0, // Unit
1.5, // Non-integer, magnitude > 1
2.0, // Even integer
3.0, // Odd integer
Infinity
];
test() {
// Tests of pow(x, y):
for (var d in samples) {
// if `y` is zero (0.0 or -0.0), the result is always 1.0.
Expect.identical(1.0, pow(d, 0.0), "$d");
Expect.identical(1.0, pow(d, -0.0), "$d");
}
for (var d in samples) {
// if `x` is 1.0, the result is always 1.0.
Expect.identical(1.0, pow(1.0, d), "$d");
}
for (var d in samples) {
// otherwise, if either `x` or `y` is NaN then the result is NaN.
if (d != 0.0) Expect.isTrue(pow(NaN, d).isNaN, "$d");
if (d != 1.0) Expect.isTrue(pow(d, NaN).isNaN, "$d");
}
for (var d in samples) {
// if `x` is a finite and strictly negative and `y` is a finite non-integer,
// the result is NaN.
if (d < 0 && !d.isInfinite) {
Expect.isTrue(pow(d, 0.5).isNaN, "$d");
Expect.isTrue(pow(d, -0.5).isNaN, "$d");
Expect.isTrue(pow(d, 1.5).isNaN, "$d");
Expect.isTrue(pow(d, -1.5).isNaN, "$d");
}
}
for (var d in samples) {
if (d < 0) {
// if `x` is Infinity and `y` is strictly negative, the result is 0.0.
Expect.identical(0.0, pow(Infinity, d), "$d");
}
if (d > 0) {
// if `x` is Infinity and `y` is strictly positive, the result is Infinity.
Expect.identical(Infinity, pow(Infinity, d), "$d");
}
}
for (var d in samples) {
if (d < 0) {
// if `x` is 0.0 and `y` is strictly negative, the result is Infinity.
Expect.identical(Infinity, pow(0.0, d), "$d");
}
if (d > 0) {
// if `x` is 0.0 and `y` is strictly positive, the result is 0.0.
Expect.identical(0.0, pow(0.0, d), "$d");
}
}
for (var d in samples) {
if (!d.isInfinite && !d.isNaN) {
var dint = d.toInt();
if (d == dint && dint.isOdd) {
// if `x` is -Infinity or -0.0 and `y` is an odd integer, then the
// result is`-pow(-x ,y)`.
Expect.identical(-pow(Infinity, d), pow(-Infinity, d));
Expect.identical(-pow(0.0, d), pow(-0.0, d));
continue;
}
}
// if `x` is -Infinity or -0.0 and `y` is not an odd integer, then the
// result is the same as `pow(-x , y)`.
if (d.isNaN) {
Expect.isTrue(pow(Infinity, d).isNaN);
Expect.isTrue(pow(-Infinity, d).isNaN);
Expect.isTrue(pow(0.0, d).isNaN);
Expect.isTrue(pow(-0.0, d).isNaN);
continue;
}
Expect.identical(pow(Infinity, d), pow(-Infinity, d));
Expect.identical(pow(0.0, d), pow(-0.0, d));
}
for (var d in samples) {
if (d.abs() < 1) {
// if `y` is Infinity and the absolute value of `x` is less than 1, the
// result is 0.0.
Expect.identical(0.0, pow(d, Infinity));
} else if (d.abs() > 1) {
// if `y` is Infinity and the absolute value of `x` is greater than 1,
// the result is Infinity.
Expect.identical(Infinity, pow(d, Infinity));
} else if (d == -1) {
// if `y` is Infinity and `x` is -1, the result is 1.0.
Expect.identical(1.0, pow(d, Infinity));
}
// if `y` is -Infinity, the result is `1/pow(x, Infinity)`.
if (d.isNaN) {
Expect.isTrue((1 / pow(d, Infinity)).isNaN);
Expect.isTrue(pow(d, -Infinity).isNaN);
} else {
Expect.identical(1 / pow(d, Infinity), pow(d, -Infinity));
}
}
// Some non-exceptional values.
checkVeryClose(16.0, pow(4.0, 2.0));
checkVeryClose(sqrt2, pow(2.0, 0.5));
checkVeryClose(sqrt1_2, pow(0.5, 0.5));
// Denormal result.
Expect.identical(5e-324, pow(2.0, -1074.0));
// Overflow.
Expect.identical(Infinity, pow(10.0, 309.0));
// Underflow.
Expect.identical(0.0, pow(10.0, -325.0));
// Conversion to double.
// The second argument is an odd integer as int, but not when converted
// to double.
Expect.identical(Infinity, pow(-0.0, -9223372036854775807));
}
main() {
for (int i = 0; i < 10; i++) test();
}
@@ -0,0 +1,80 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math' hide Rectangle;
import 'dart:math' as math show Point, Rectangle, MutableRectangle;
import 'package:expect/expect.dart' show Expect;
void main() {
verifyRectable(new Rectangle(1, 2, 3, 4));
}
void verifyRectable(math.Rectangle rect) {
Expect.equals(1.0, rect.left.toDouble());
Expect.equals(2.0, rect.top.toDouble());
Expect.equals(4.0, rect.right.toDouble());
Expect.equals(6.0, rect.bottom.toDouble());
}
class Rectangle<T extends num> implements math.MutableRectangle<T> {
T left;
T top;
T width;
T height;
Rectangle(this.left, this.top, this.width, this.height);
T get right => left + width;
T get bottom => top + height;
Point<T> get topLeft => new Point<T>(left, top);
Point<T> get topRight => new Point<T>(right, top);
Point<T> get bottomLeft => new Point<T>(left, bottom);
Point<T> get bottomRight => new Point<T>(right, bottom);
//---------------------------------------------------------------------------
bool contains(num px, num py) {
return left <= px && top <= py && right > px && bottom > py;
}
bool containsPoint(math.Point<num> p) {
return contains(p.x, p.y);
}
bool intersects(math.Rectangle<num> r) {
return left < r.right && right > r.left && top < r.bottom && bottom > r.top;
}
/// Returns a new rectangle which completely contains `this` and [other].
Rectangle<T> boundingBox(math.Rectangle<T> other) {
T rLeft = min(left, other.left);
T rTop = min(top, other.top);
T rRight = max(right, other.right);
T rBottom = max(bottom, other.bottom);
return new Rectangle<T>(rLeft, rTop, rRight - rLeft, rBottom - rTop);
}
/// Tests whether `this` entirely contains [another].
bool containsRectangle(math.Rectangle<num> r) {
return left <= r.left &&
top <= r.top &&
right >= r.right &&
bottom >= r.bottom;
}
Rectangle<T> intersection(math.Rectangle<T> rect) {
T rLeft = max(left, rect.left);
T rTop = max(top, rect.top);
T rRight = min(right, rect.right);
T rBottom = min(bottom, rect.bottom);
return new Rectangle<T>(rLeft, rTop, rRight - rLeft, rBottom - rTop);
}
}
+31
View File
@@ -0,0 +1,31 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that the default PRNG does uniformly distribute values when not using
// a power of 2.
import "package:expect/expect.dart";
import 'dart:math';
void main() {
var n = (2 * 0x100000000) ~/ 3;
var n2 = n ~/ 2;
var iterations = 200000;
var seed = new Random().nextInt(1 << 16);
print("low_test seed: $seed");
var prng = new Random(seed);
var low = 0;
for (var i = 0; i < iterations; i++) {
if (prng.nextInt(n) < n2) {
low++;
}
}
var diff = (low - (iterations ~/ 2)).abs();
print("$low, $diff");
Expect.isTrue(diff < (iterations ~/ 20));
}
+265
View File
@@ -0,0 +1,265 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// We temporarily test both the new math library and the old Math
// class. This can easily be simplified once we get rid of the Math
// class entirely.
library math_test;
import "package:expect/expect.dart";
import 'dart:math' as math;
class MathLibraryTest {
static void testConstants() {
// Source for mathematical constants is Wolfram Alpha.
Expect.equals(
2.7182818284590452353602874713526624977572470936999595749669, math.e);
Expect.equals(2.3025850929940456840179914546843642076011014886287729760333,
math.ln10);
Expect.equals(
0.6931471805599453094172321214581765680755001343602552541206, math.ln2);
Expect.equals(1.4426950408889634073599246810018921374266459541529859341354,
math.log2e);
Expect.equals(0.4342944819032518276511289189166050822943970058036665661144,
math.log10e);
Expect.equals(
3.1415926535897932384626433832795028841971693993751058209749, math.pi);
Expect.equals(0.7071067811865475244008443621048490392848359376884740365883,
math.sqrt1_2);
Expect.equals(1.4142135623730950488016887242096980785696718753769480731766,
math.sqrt2);
}
static checkClose(double a, double b, EPSILON) {
Expect.equals(true, a - EPSILON <= b);
Expect.equals(true, b <= a + EPSILON);
}
static void testSin() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, math.sin(0.0), EPSILON);
checkClose(0.0, math.sin(math.pi), EPSILON);
checkClose(0.0, math.sin(2.0 * math.pi), EPSILON);
checkClose(1.0, math.sin(math.pi / 2.0), EPSILON);
checkClose(-1.0, math.sin(math.pi * (3.0 / 2.0)), EPSILON);
}
static void testCos() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(1.0, math.cos(0.0), EPSILON);
checkClose(-1.0, math.cos(math.pi), EPSILON);
checkClose(1.0, math.cos(2.0 * math.pi), EPSILON);
checkClose(0.0, math.cos(math.pi / 2.0), EPSILON);
checkClose(0.0, math.cos(math.pi * (3.0 / 2.0)), EPSILON);
}
static void testTan() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, math.tan(0.0), EPSILON);
checkClose(0.0, math.tan(math.pi), EPSILON);
checkClose(0.0, math.tan(2.0 * math.pi), EPSILON);
checkClose(1.0, math.tan(math.pi / 4.0), EPSILON);
}
static void testAsin() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, math.asin(0.0), EPSILON);
checkClose(math.pi / 2.0, math.asin(1.0), EPSILON);
checkClose(-math.pi / 2.0, math.asin(-1.0), EPSILON);
}
static void testAcos() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, math.acos(1.0), EPSILON);
checkClose(math.pi, math.acos(-1.0), EPSILON);
checkClose(math.pi / 2.0, math.acos(0.0), EPSILON);
}
static void testAtan() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, math.atan(0.0), EPSILON);
checkClose(math.pi / 4.0, math.atan(1.0), EPSILON);
checkClose(-math.pi / 4.0, math.atan(-1.0), EPSILON);
}
static void testAtan2() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, math.atan2(0.0, 5.0), EPSILON);
checkClose(math.pi / 4.0, math.atan2(2.0, 2.0), EPSILON);
checkClose(3 * math.pi / 4.0, math.atan2(0.5, -0.5), EPSILON);
checkClose(-3 * math.pi / 4.0, math.atan2(-2.5, -2.5), EPSILON);
}
static checkVeryClose(double a, num b) {
// We find a ulp (unit in the last place) by shifting the original number
// to the right. This only works if we are not too close to infinity or if
// we work with denormals.
// We special case or 0.0, but not for infinity.
if (a == 0.0) {
final minimalDouble = 4.9406564584124654e-324;
Expect.equals(true, b.abs() <= minimalDouble);
return;
}
if (b == 0.0) {
// No need to look if they are close. Otherwise the check for 'a' above
// whould have triggered.
Expect.equals(a, b);
}
final double shiftRightBy52 = 2.220446049250313080847263336181640625e-16;
final double shiftedA = (a * shiftRightBy52).abs();
// Compared to 'a', 'shiftedA' is now ~1-2 ulp.
final double limitLow = a - shiftedA;
final double limitHigh = a + shiftedA;
Expect.equals(false, a == limitLow);
Expect.equals(false, a == limitHigh);
Expect.equals(true, limitLow <= b);
Expect.equals(true, b <= limitHigh);
}
static void testSqrt() {
checkVeryClose(2.0, math.sqrt(4.0));
checkVeryClose(math.sqrt2, math.sqrt(2.0));
checkVeryClose(math.sqrt1_2, math.sqrt(0.5));
checkVeryClose(1e50, math.sqrt(1e100));
checkVeryClose(1.1111111061110855443054405046358901279277111935183977e56,
math.sqrt(12345678901234e99));
}
static void testExp() {
checkVeryClose(math.e, math.exp(1.0));
final EPSILON = 1e-15;
checkClose(10.0, math.exp(math.ln10), EPSILON);
checkClose(2.0, math.exp(math.ln2), EPSILON);
}
static void testLog() {
// Even though E is imprecise, it is good enough to get really close to 1.
// We still provide an epsilon.
checkClose(1.0, math.log(math.e), 1e-16);
checkVeryClose(math.ln10, math.log(10.0));
checkVeryClose(math.ln2, math.log(2.0));
}
static void testPow() {
checkVeryClose(16.0, math.pow(4.0, 2.0));
checkVeryClose(math.sqrt2, math.pow(2.0, 0.5));
checkVeryClose(math.sqrt1_2, math.pow(0.5, 0.5));
}
static bool parseIntThrowsFormatException(str) {
try {
int.parse(str);
return false;
} on FormatException catch (e) {
return true;
}
}
static void testParseInt() {
Expect.equals(499, int.parse("499"));
Expect.equals(499, int.parse("+499"));
Expect.equals(-499, int.parse("-499"));
Expect.equals(499, int.parse(" 499 "));
Expect.equals(499, int.parse(" +499 "));
Expect.equals(-499, int.parse(" -499 "));
Expect.equals(0, int.parse("0"));
Expect.equals(0, int.parse("+0"));
Expect.equals(0, int.parse("-0"));
Expect.equals(0, int.parse(" 0 "));
Expect.equals(0, int.parse(" +0 "));
Expect.equals(0, int.parse(" -0 "));
Expect.equals(0x1234567890, int.parse("0x1234567890"));
Expect.equals(-0x1234567890, int.parse("-0x1234567890"));
Expect.equals(0x1234567890, int.parse(" 0x1234567890 "));
Expect.equals(-0x1234567890, int.parse(" -0x1234567890 "));
Expect.equals(256, int.parse("0x100"));
Expect.equals(-256, int.parse("-0x100"));
Expect.equals(256, int.parse(" 0x100 "));
Expect.equals(-256, int.parse(" -0x100 "));
Expect.equals(0xabcdef, int.parse("0xabcdef"));
Expect.equals(0xABCDEF, int.parse("0xABCDEF"));
Expect.equals(0xabcdef, int.parse("0xabCDEf"));
Expect.equals(-0xabcdef, int.parse("-0xabcdef"));
Expect.equals(-0xABCDEF, int.parse("-0xABCDEF"));
Expect.equals(0xabcdef, int.parse(" 0xabcdef "));
Expect.equals(0xABCDEF, int.parse(" 0xABCDEF "));
Expect.equals(-0xabcdef, int.parse(" -0xabcdef "));
Expect.equals(-0xABCDEF, int.parse(" -0xABCDEF "));
Expect.equals(0xabcdef, int.parse("0x00000abcdef"));
Expect.equals(0xABCDEF, int.parse("0x00000ABCDEF"));
Expect.equals(-0xabcdef, int.parse("-0x00000abcdef"));
Expect.equals(-0xABCDEF, int.parse("-0x00000ABCDEF"));
Expect.equals(0xabcdef, int.parse(" 0x00000abcdef "));
Expect.equals(0xABCDEF, int.parse(" 0x00000ABCDEF "));
Expect.equals(-0xabcdef, int.parse(" -0x00000abcdef "));
Expect.equals(-0xABCDEF, int.parse(" -0x00000ABCDEF "));
Expect.equals(10, int.parse("010"));
Expect.equals(-10, int.parse("-010"));
Expect.equals(10, int.parse(" 010 "));
Expect.equals(-10, int.parse(" -010 "));
Expect.equals(9, int.parse("09"));
Expect.equals(9, int.parse(" 09 "));
Expect.equals(-9, int.parse("-09"));
Expect.equals(0x1234567890, int.parse("+0x1234567890"));
Expect.equals(0x1234567890, int.parse(" +0x1234567890 "));
Expect.equals(0x100, int.parse("+0x100"));
Expect.equals(0x100, int.parse(" +0x100 "));
Expect.equals(true, parseIntThrowsFormatException("1b"));
Expect.equals(true, parseIntThrowsFormatException(" 1b "));
Expect.equals(true, parseIntThrowsFormatException(" 1 b "));
Expect.equals(true, parseIntThrowsFormatException("1e2"));
Expect.equals(true, parseIntThrowsFormatException(" 1e2 "));
Expect.equals(true, parseIntThrowsFormatException("00x12"));
Expect.equals(true, parseIntThrowsFormatException(" 00x12 "));
Expect.equals(true, parseIntThrowsFormatException("-1b"));
Expect.equals(true, parseIntThrowsFormatException(" -1b "));
Expect.equals(true, parseIntThrowsFormatException(" -1 b "));
Expect.equals(true, parseIntThrowsFormatException("-1e2"));
Expect.equals(true, parseIntThrowsFormatException(" -1e2 "));
Expect.equals(true, parseIntThrowsFormatException("-00x12"));
Expect.equals(true, parseIntThrowsFormatException(" -00x12 "));
Expect.equals(true, parseIntThrowsFormatException(" -00x12 "));
Expect.equals(true, parseIntThrowsFormatException("0x0x12"));
Expect.equals(true, parseIntThrowsFormatException("0.1"));
Expect.equals(true, parseIntThrowsFormatException("0x3.1"));
Expect.equals(true, parseIntThrowsFormatException("5."));
Expect.equals(true, parseIntThrowsFormatException("+-5"));
Expect.equals(true, parseIntThrowsFormatException("-+5"));
Expect.equals(true, parseIntThrowsFormatException("--5"));
Expect.equals(true, parseIntThrowsFormatException("++5"));
Expect.equals(true, parseIntThrowsFormatException("+ 5"));
Expect.equals(true, parseIntThrowsFormatException("- 5"));
Expect.equals(true, parseIntThrowsFormatException(""));
Expect.equals(true, parseIntThrowsFormatException(" "));
}
static testMain() {
testConstants();
testSin();
testCos();
testTan();
testAsin();
testAcos();
testAtan();
testAtan2();
testSqrt();
testLog();
testExp();
testPow();
testParseInt();
}
}
main() {
MathLibraryTest.testMain();
}
+170
View File
@@ -0,0 +1,170 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// We temporarily test both the new math library and the old Math
// class. This can easily be simplified once we get rid of the Math
// class entirely.
library math_parse_double_test;
import "package:expect/expect.dart";
void parseDoubleThrowsFormatException(str) {
Expect.throwsFormatException(() => double.parse(str));
}
void runTest(double expected, String input) {
Expect.equals(expected, double.parse(input));
Expect.equals(expected, double.parse(" $input "));
Expect.equals(expected, double.parse(" $input"));
Expect.equals(expected, double.parse("$input "));
Expect.equals(expected, double.parse("+$input"));
Expect.equals(expected, double.parse(" +$input "));
Expect.equals(expected, double.parse("+$input "));
Expect.equals(expected, double.parse("\xA0 $input\xA0 "));
Expect.equals(expected, double.parse(" \xA0$input"));
Expect.equals(expected, double.parse("$input \xA0"));
Expect.equals(expected, double.parse("\xA0 +$input\xA0 "));
Expect.equals(expected, double.parse("+$input\xA0 "));
Expect.equals(expected, double.parse("\u205F $input\u205F "));
Expect.equals(expected, double.parse("$input \u2006"));
Expect.equals(expected, double.parse("\u1680 +$input\u1680 "));
Expect.equals(-expected, double.parse("-$input"));
Expect.equals(-expected, double.parse(" -$input "));
Expect.equals(-expected, double.parse("-$input "));
Expect.equals(-expected, double.parse("\xA0 -$input\xA0 "));
Expect.equals(-expected, double.parse("-$input\xA0 "));
Expect.equals(-expected, double.parse("\u1680 -$input\u1680 "));
}
final TESTS = [
[499.0, "499"],
[499.0, "499."],
[499.0, "499.0"],
[0.0, "0"],
[0.0, ".0"],
[0.0, "0."],
[0.1, "0.1"],
[0.1, ".1"],
[10.0, "010"],
[1.5, "1.5"],
[1.5, "001.5"],
[1.5, "1.500"],
[1234567.89, "1234567.89"],
[1234567e89, "1234567e89"],
[1234567.89e2, "1234567.89e2"],
[1234567.89e2, "1234567.89e+2"],
[1234567.89e-2, "1234567.89e-2"],
[5.0, "5"],
[123456700.0, "1234567.e2"],
[123456700.0, "1234567.e+2"],
[double.infinity, "Infinity"],
[5e-324, "5e-324"], // min-pos.
// Same, without exponential.
[
0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004940656458412465441765687928682213723650598026143247644255856825006755072702087518652998363616359923797965646954457177309266567103559397963987747960107818781263007131903114045278458171678489821036887186360569987307230500063874091535649843873124733972731696151400317153853980741262385655911710266585566867681870395603106249319452715914924553293054565444011274801297099995419319894090804165633245247571478690147267801593552386115501348035264934720193790268107107491703332226844753335720832431936092382893458368060106011506169809753078342277318329247904982524730776375927247874656084778203734469699533647017972677717585125660551199131504891101451037862738167250955837389733598993664809941164205702637090279242767544565229087538682506419718265533447265625,
"0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004940656458412465441765687928682213723650598026143247644255856825006755072702087518652998363616359923797965646954457177309266567103559397963987747960107818781263007131903114045278458171678489821036887186360569987307230500063874091535649843873124733972731696151400317153853980741262385655911710266585566867681870395603106249319452715914924553293054565444011274801297099995419319894090804165633245247571478690147267801593552386115501348035264934720193790268107107491703332226844753335720832431936092382893458368060106011506169809753078342277318329247904982524730776375927247874656084778203734469699533647017972677717585125660551199131504891101451037862738167250955837389733598993664809941164205702637090279242767544565229087538682506419718265533447265625"
],
[0.0, "2e-324"], // underflow 0.0
[0.9999999999999999, "0.9999999999999999"], // max below 1
[1.0, "1.00000000000000005"], // 1.0
[1.0000000000000002, "1.0000000000000002"], // min above 1
[2147483647.0, "2147483647"], // max int32
[2147483647.0000002, "2147483647.0000002"], // min not int32
[2147483648.0, "2147483648"], // min int not int32
[4295967295.0, "4295967295"], // max uint32
[4295967295.000001, "4295967295.000001"], // min not uint-32
[4295967296.0, "4295967296"], // min int not-uint32
[1.7976931348623157e+308, "1.7976931348623157e+308"], // Max finite
[1.7976931348623157e+308, "1.7976931348623158e+308"], // Max finite
[double.infinity, "1.7976931348623159e+308"], // Infinity
[.049999999999999994, ".049999999999999994"], // not 0.5
[.05, ".04999999999999999935"],
[4503599627370498.0, "4503599627370497.5"],
[1.2345678901234568e+39, "1234567890123456898981341324213421342134"],
[9.87291183742987e+24, "9872911837429871193379121"],
[1e21, "1e+21"],
];
void main() {
for (var test in TESTS) {
runTest(test[0] as double, test[1] as String);
}
Expect.equals(true, double.parse("-0").isNegative);
Expect.equals(true, double.parse(" -0 ").isNegative);
Expect.equals(true, double.parse("\xA0 -0 \xA0").isNegative);
Expect.isTrue(double.parse("NaN").isNaN);
Expect.isTrue(double.parse("-NaN").isNaN);
Expect.isTrue(double.parse("+NaN").isNaN);
Expect.isTrue(double.parse("NaN ").isNaN);
Expect.isTrue(double.parse("-NaN ").isNaN);
Expect.isTrue(double.parse("+NaN ").isNaN);
Expect.isTrue(double.parse(" NaN ").isNaN);
Expect.isTrue(double.parse(" -NaN ").isNaN);
Expect.isTrue(double.parse(" +NaN ").isNaN);
Expect.isTrue(double.parse(" NaN").isNaN);
Expect.isTrue(double.parse(" -NaN").isNaN);
Expect.isTrue(double.parse(" +NaN").isNaN);
Expect.isTrue(double.parse("NaN\xA0").isNaN);
Expect.isTrue(double.parse("-NaN\xA0").isNaN);
Expect.isTrue(double.parse("+NaN\xA0").isNaN);
Expect.isTrue(double.parse(" \xA0NaN\xA0").isNaN);
Expect.isTrue(double.parse(" \xA0-NaN\xA0").isNaN);
Expect.isTrue(double.parse(" \xA0+NaN\xA0").isNaN);
Expect.isTrue(double.parse(" \xA0NaN").isNaN);
Expect.isTrue(double.parse(" \xA0-NaN").isNaN);
Expect.isTrue(double.parse(" \xA0+NaN").isNaN);
parseDoubleThrowsFormatException("1b");
parseDoubleThrowsFormatException(" 1b ");
parseDoubleThrowsFormatException(" 1 b ");
parseDoubleThrowsFormatException(" e3 ");
parseDoubleThrowsFormatException(" .e3 ");
parseDoubleThrowsFormatException("00x12");
parseDoubleThrowsFormatException(" 00x12 ");
parseDoubleThrowsFormatException("-1b");
parseDoubleThrowsFormatException(" -1b ");
parseDoubleThrowsFormatException(" -1 b ");
parseDoubleThrowsFormatException("-00x12");
parseDoubleThrowsFormatException(" -00x12 ");
parseDoubleThrowsFormatException(" -00x12 ");
parseDoubleThrowsFormatException("0x0x12");
parseDoubleThrowsFormatException("+ 1.5");
parseDoubleThrowsFormatException("- 1.5");
parseDoubleThrowsFormatException("");
parseDoubleThrowsFormatException(" ");
parseDoubleThrowsFormatException("+0x1234567890");
parseDoubleThrowsFormatException(" +0x1234567890 ");
parseDoubleThrowsFormatException(" +0x100 ");
parseDoubleThrowsFormatException("+0x100");
parseDoubleThrowsFormatException("0x1234567890");
parseDoubleThrowsFormatException("-0x1234567890");
parseDoubleThrowsFormatException(" 0x1234567890 ");
parseDoubleThrowsFormatException(" -0x1234567890 ");
parseDoubleThrowsFormatException("0x100");
parseDoubleThrowsFormatException("-0x100");
parseDoubleThrowsFormatException(" 0x100 ");
parseDoubleThrowsFormatException(" -0x100 ");
parseDoubleThrowsFormatException("0xabcdef");
parseDoubleThrowsFormatException("0xABCDEF");
parseDoubleThrowsFormatException("0xabCDEf");
parseDoubleThrowsFormatException("-0xabcdef");
parseDoubleThrowsFormatException("-0xABCDEF");
parseDoubleThrowsFormatException(" 0xabcdef ");
parseDoubleThrowsFormatException(" 0xABCDEF ");
parseDoubleThrowsFormatException(" -0xabcdef ");
parseDoubleThrowsFormatException(" -0xABCDEF ");
parseDoubleThrowsFormatException("0x00000abcdef");
parseDoubleThrowsFormatException("0x00000ABCDEF");
parseDoubleThrowsFormatException("-0x00000abcdef");
parseDoubleThrowsFormatException("-0x00000ABCDEF");
parseDoubleThrowsFormatException(" 0x00000abcdef ");
parseDoubleThrowsFormatException(" 0x00000ABCDEF ");
parseDoubleThrowsFormatException(" -0x00000abcdef ");
parseDoubleThrowsFormatException(" -0x00000ABCDEF ");
parseDoubleThrowsFormatException(" -INFINITY ");
parseDoubleThrowsFormatException(" NAN ");
parseDoubleThrowsFormatException(" inf ");
parseDoubleThrowsFormatException(" nan ");
}
+254
View File
@@ -0,0 +1,254 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library math_test;
import "package:expect/expect.dart";
import 'dart:math';
class MathTest {
static void testConstants() {
// Source for mathematical constants is Wolfram Alpha.
Expect.equals(
2.7182818284590452353602874713526624977572470936999595749669, e);
Expect.equals(
2.3025850929940456840179914546843642076011014886287729760333, ln10);
Expect.equals(
0.6931471805599453094172321214581765680755001343602552541206, ln2);
Expect.equals(
1.4426950408889634073599246810018921374266459541529859341354, log2e);
Expect.equals(
0.4342944819032518276511289189166050822943970058036665661144, log10e);
Expect.equals(
3.1415926535897932384626433832795028841971693993751058209749, pi);
Expect.equals(
0.7071067811865475244008443621048490392848359376884740365883, sqrt1_2);
Expect.equals(
1.4142135623730950488016887242096980785696718753769480731766, sqrt2);
}
static checkClose(double a, double b, EPSILON) {
Expect.equals(true, a - EPSILON <= b);
Expect.equals(true, b <= a + EPSILON);
}
static void testSin() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, sin(0.0), EPSILON);
checkClose(0.0, sin(pi), EPSILON);
checkClose(0.0, sin(2.0 * pi), EPSILON);
checkClose(1.0, sin(pi / 2.0), EPSILON);
checkClose(-1.0, sin(pi * (3.0 / 2.0)), EPSILON);
}
static void testCos() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(1.0, cos(0.0), EPSILON);
checkClose(-1.0, cos(pi), EPSILON);
checkClose(1.0, cos(2.0 * pi), EPSILON);
checkClose(0.0, cos(pi / 2.0), EPSILON);
checkClose(0.0, cos(pi * (3.0 / 2.0)), EPSILON);
}
static void testTan() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, tan(0.0), EPSILON);
checkClose(0.0, tan(pi), EPSILON);
checkClose(0.0, tan(2.0 * pi), EPSILON);
checkClose(1.0, tan(pi / 4.0), EPSILON);
}
static void testAsin() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, asin(0.0), EPSILON);
checkClose(pi / 2.0, asin(1.0), EPSILON);
checkClose(-pi / 2.0, asin(-1.0), EPSILON);
}
static void testAcos() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, acos(1.0), EPSILON);
checkClose(pi, acos(-1.0), EPSILON);
checkClose(pi / 2.0, acos(0.0), EPSILON);
}
static void testAtan() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, atan(0.0), EPSILON);
checkClose(pi / 4.0, atan(1.0), EPSILON);
checkClose(-pi / 4.0, atan(-1.0), EPSILON);
}
static void testAtan2() {
// Given the imprecision of pi we can't expect better results than this.
final double EPSILON = 1e-15;
checkClose(0.0, atan2(0.0, 5.0), EPSILON);
checkClose(pi / 4.0, atan2(2.0, 2.0), EPSILON);
checkClose(3 * pi / 4.0, atan2(0.5, -0.5), EPSILON);
checkClose(-3 * pi / 4.0, atan2(-2.5, -2.5), EPSILON);
}
static checkVeryClose(double a, double b) {
// We find a ulp (unit in the last place) by shifting the original number
// to the right. This only works if we are not too close to infinity or if
// we work with denormals.
// We special case or 0.0, but not for infinity.
if (a == 0.0) {
final minimalDouble = 4.9406564584124654e-324;
Expect.equals(true, b.abs() <= minimalDouble);
return;
}
if (b == 0.0) {
// No need to look if they are close. Otherwise the check for 'a' above
// whould have triggered.
Expect.equals(a, b);
}
final double shiftRightBy52 = 2.220446049250313080847263336181640625e-16;
final double shiftedA = (a * shiftRightBy52).abs();
// Compared to 'a', 'shiftedA' is now ~1-2 ulp.
final double limitLow = a - shiftedA;
final double limitHigh = a + shiftedA;
Expect.equals(false, a == limitLow);
Expect.equals(false, a == limitHigh);
Expect.equals(true, limitLow <= b);
Expect.equals(true, b <= limitHigh);
}
static void testSqrt() {
checkVeryClose(2.0, sqrt(4.0));
checkVeryClose(sqrt2, sqrt(2.0));
checkVeryClose(sqrt1_2, sqrt(0.5));
checkVeryClose(1e50, sqrt(1e100));
checkVeryClose(1.1111111061110855443054405046358901279277111935183977e56,
sqrt(12345678901234e99));
}
static void testExp() {
checkVeryClose(e, exp(1.0));
final EPSILON = 1e-15;
checkClose(10.0, exp(ln10), EPSILON);
checkClose(2.0, exp(ln2), EPSILON);
}
static void testLog() {
// Even though E is imprecise, it is good enough to get really close to 1.
// We still provide an epsilon.
checkClose(1.0, log(e), 1e-16);
checkVeryClose(ln10, log(10.0));
checkVeryClose(ln2, log(2.0));
}
static bool parseIntThrowsFormatException(str) {
try {
int.parse(str);
return false;
} on FormatException catch (e) {
return true;
}
}
static void testParseInt() {
Expect.equals(499, int.parse("499"));
Expect.equals(499, int.parse("+499"));
Expect.equals(-499, int.parse("-499"));
Expect.equals(499, int.parse(" 499 "));
Expect.equals(499, int.parse(" +499 "));
Expect.equals(-499, int.parse(" -499 "));
Expect.equals(0, int.parse("0"));
Expect.equals(0, int.parse("+0"));
Expect.equals(0, int.parse("-0"));
Expect.equals(0, int.parse(" 0 "));
Expect.equals(0, int.parse(" +0 "));
Expect.equals(0, int.parse(" -0 "));
Expect.equals(0x1234567890, int.parse("0x1234567890"));
Expect.equals(-0x1234567890, int.parse("-0x1234567890"));
Expect.equals(0x1234567890, int.parse(" 0x1234567890 "));
Expect.equals(-0x1234567890, int.parse(" -0x1234567890 "));
Expect.equals(256, int.parse("0x100"));
Expect.equals(-256, int.parse("-0x100"));
Expect.equals(256, int.parse(" 0x100 "));
Expect.equals(-256, int.parse(" -0x100 "));
Expect.equals(0xabcdef, int.parse("0xabcdef"));
Expect.equals(0xABCDEF, int.parse("0xABCDEF"));
Expect.equals(0xabcdef, int.parse("0xabCDEf"));
Expect.equals(-0xabcdef, int.parse("-0xabcdef"));
Expect.equals(-0xABCDEF, int.parse("-0xABCDEF"));
Expect.equals(0xabcdef, int.parse(" 0xabcdef "));
Expect.equals(0xABCDEF, int.parse(" 0xABCDEF "));
Expect.equals(-0xabcdef, int.parse(" -0xabcdef "));
Expect.equals(-0xABCDEF, int.parse(" -0xABCDEF "));
Expect.equals(0xabcdef, int.parse("0x00000abcdef"));
Expect.equals(0xABCDEF, int.parse("0x00000ABCDEF"));
Expect.equals(-0xabcdef, int.parse("-0x00000abcdef"));
Expect.equals(-0xABCDEF, int.parse("-0x00000ABCDEF"));
Expect.equals(0xabcdef, int.parse(" 0x00000abcdef "));
Expect.equals(0xABCDEF, int.parse(" 0x00000ABCDEF "));
Expect.equals(-0xabcdef, int.parse(" -0x00000abcdef "));
Expect.equals(-0xABCDEF, int.parse(" -0x00000ABCDEF "));
Expect.equals(10, int.parse("010"));
Expect.equals(-10, int.parse("-010"));
Expect.equals(10, int.parse(" 010 "));
Expect.equals(-10, int.parse(" -010 "));
Expect.equals(9, int.parse("09"));
Expect.equals(9, int.parse(" 09 "));
Expect.equals(-9, int.parse("-09"));
Expect.equals(0x1234567890, int.parse("+0x1234567890"));
Expect.equals(0x1234567890, int.parse(" +0x1234567890 "));
Expect.equals(0x100, int.parse("+0x100"));
Expect.equals(0x100, int.parse(" +0x100 "));
Expect.equals(true, parseIntThrowsFormatException("1b"));
Expect.equals(true, parseIntThrowsFormatException(" 1b "));
Expect.equals(true, parseIntThrowsFormatException(" 1 b "));
Expect.equals(true, parseIntThrowsFormatException("1e2"));
Expect.equals(true, parseIntThrowsFormatException(" 1e2 "));
Expect.equals(true, parseIntThrowsFormatException("00x12"));
Expect.equals(true, parseIntThrowsFormatException(" 00x12 "));
Expect.equals(true, parseIntThrowsFormatException("-1b"));
Expect.equals(true, parseIntThrowsFormatException(" -1b "));
Expect.equals(true, parseIntThrowsFormatException(" -1 b "));
Expect.equals(true, parseIntThrowsFormatException("-1e2"));
Expect.equals(true, parseIntThrowsFormatException(" -1e2 "));
Expect.equals(true, parseIntThrowsFormatException("-00x12"));
Expect.equals(true, parseIntThrowsFormatException(" -00x12 "));
Expect.equals(true, parseIntThrowsFormatException(" -00x12 "));
Expect.equals(true, parseIntThrowsFormatException("0x0x12"));
Expect.equals(true, parseIntThrowsFormatException("0.1"));
Expect.equals(true, parseIntThrowsFormatException("0x3.1"));
Expect.equals(true, parseIntThrowsFormatException("5."));
Expect.equals(true, parseIntThrowsFormatException("+-5"));
Expect.equals(true, parseIntThrowsFormatException("-+5"));
Expect.equals(true, parseIntThrowsFormatException("--5"));
Expect.equals(true, parseIntThrowsFormatException("++5"));
Expect.equals(true, parseIntThrowsFormatException("+ 5"));
Expect.equals(true, parseIntThrowsFormatException("- 5"));
Expect.equals(true, parseIntThrowsFormatException(""));
Expect.equals(true, parseIntThrowsFormatException(" "));
}
static testMain() {
testConstants();
testSin();
testCos();
testTan();
testAsin();
testAcos();
testAtan();
testAtan2();
testSqrt();
testLog();
testExp();
testParseInt();
}
}
main() {
MathTest.testMain();
}
+563
View File
@@ -0,0 +1,563 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart test for testing Math.min and Math.max.
// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
library min_max_test;
import "package:expect/expect.dart";
import 'dart:math';
var inf = double.infinity;
var nan = double.nan;
// A class that might work if [min] and [max] worked for non-numbers.
class Wrap implements Comparable<dynamic> {
final num value;
Wrap(this.value);
int compareTo(dynamic other) => value.compareTo(other.value);
bool operator <(Wrap other) => compareTo(other) < 0;
bool operator <=(Wrap other) => compareTo(other) <= 0;
bool operator >(Wrap other) => compareTo(other) > 0;
bool operator >=(Wrap other) => compareTo(other) >= 0;
bool operator ==(other) => other is Wrap && compareTo(other) == 0;
String toString() => 'Wrap($value)';
int get hashCode => value.hashCode;
}
var wrap1 = new Wrap(1);
var wrap2 = new Wrap(2);
testMin() {
testMin1();
testMin2();
testMin3();
}
testMin1() {
Expect.equals(0, min(0, 2));
Expect.equals(0, min(2, 0));
Expect.equals(-10, min(-10, -9));
Expect.equals(-10, min(-10, 9));
Expect.equals(-10, min(-10, 0));
Expect.equals(-10, min(-9, -10));
Expect.equals(-10, min(9, -10));
Expect.equals(-10, min(0, -10));
Expect.equals(0.5, min(0.5, 2.5));
Expect.equals(0.5, min(2.5, 0.5));
Expect.equals(-10.5, min(-10.5, -9.5));
Expect.equals(-10.5, min(-10.5, 9.5));
Expect.equals(-10.5, min(-10.5, 0.5));
Expect.equals(-10.5, min(-9.5, -10.5));
Expect.equals(-10.5, min(9.5, -10.5));
Expect.equals(-10.5, min(0.5, -10.5));
// Test matrix:
// NaN, -infinity, -499.0, -499, -0.0, 0.0, 0, 499.0, 499, +infinity.
Expect.isTrue(min(nan, nan).isNaN);
Expect.isTrue(min(nan, -inf).isNaN);
Expect.isTrue(min(nan, -499.0).isNaN);
Expect.isTrue(min(nan, -499).isNaN);
Expect.isTrue(min(nan, -0.0).isNaN);
Expect.isTrue(min(nan, 0.0).isNaN);
Expect.isTrue(min(nan, 499.0).isNaN);
Expect.isTrue(min(nan, 499).isNaN);
Expect.isTrue(min(nan, inf).isNaN);
Expect.equals(-inf, min(-inf, -inf));
Expect.equals(-inf, min(-inf, -499.0));
Expect.equals(-inf, min(-inf, -499));
Expect.equals(-inf, min(-inf, -0.0));
Expect.equals(-inf, min(-inf, 0.0));
Expect.equals(-inf, min(-inf, 0));
Expect.equals(-inf, min(-inf, 499));
Expect.equals(-inf, min(-inf, 499.0));
Expect.equals(-inf, min(-inf, inf));
Expect.isTrue(min(-inf, nan).isNaN);
Expect.equals(-inf, min(-499.0, -inf));
Expect.equals(-499.0, min(-499.0, -499.0));
Expect.equals(-499.0, min(-499.0, -499));
Expect.equals(-499.0, min(-499.0, -0.0));
Expect.equals(-499.0, min(-499.0, 0.0));
Expect.equals(-499.0, min(-499.0, 0));
Expect.equals(-499.0, min(-499.0, 499.0));
Expect.equals(-499.0, min(-499.0, 499));
Expect.equals(-499.0, min(-499.0, inf));
Expect.isTrue(min(-499.0, nan).isNaN);
Expect.isTrue(min(-499.0, -499.0) is double);
Expect.isTrue(min(-499.0, -499) is double);
Expect.isTrue(min(-499.0, -0.0) is double);
Expect.isTrue(min(-499.0, 0.0) is double);
Expect.isTrue(min(-499.0, 0) is double);
Expect.isTrue(min(-499.0, 499.0) is double);
Expect.isTrue(min(-499.0, 499) is double);
Expect.isTrue(min(-499.0, inf) is double);
Expect.equals(-inf, min(-499, -inf));
Expect.equals(-499, min(-499, -499.0));
Expect.equals(-499, min(-499, -499));
Expect.equals(-499, min(-499, -0.0));
Expect.equals(-499, min(-499, 0.0));
Expect.equals(-499, min(-499, 0));
Expect.equals(-499, min(-499, 499.0));
Expect.equals(-499, min(-499, 499));
Expect.equals(-499, min(-499, inf));
Expect.isTrue(min(-499, nan).isNaN);
Expect.isTrue(min(-499, -499.0) is int);
Expect.isTrue(min(-499, -499) is int);
Expect.isTrue(min(-499, -0.0) is int);
Expect.isTrue(min(-499, 0.0) is int);
Expect.isTrue(min(-499, 0) is int);
Expect.isTrue(min(-499, 499.0) is int);
Expect.isTrue(min(-499, 499) is int);
Expect.isTrue(min(-499, inf) is int);
Expect.equals(-inf, min(-0.0, -inf));
Expect.equals(-499.0, min(-0.0, -499.0));
Expect.equals(-499, min(-0.0, -499));
Expect.equals(-0.0, min(-0.0, -0.0));
Expect.equals(-0.0, min(-0.0, 0.0));
Expect.equals(-0.0, min(-0.0, 0));
Expect.equals(-0.0, min(-0.0, 499.0));
Expect.equals(-0.0, min(-0.0, 499));
Expect.equals(-0.0, min(-0.0, inf));
Expect.isTrue(min(-0.0, nan).isNaN);
}
testMin2() {
Expect.isTrue(min(-0.0, -499.0) is double);
Expect.isTrue(min(-0.0, -499) is int);
Expect.isTrue(min(-0.0, -0.0) is double);
Expect.isTrue(min(-0.0, 0.0) is double);
Expect.isTrue(min(-0.0, 0) is double);
Expect.isTrue(min(-0.0, 499.0) is double);
Expect.isTrue(min(-0.0, 499) is double);
Expect.isTrue(min(-0.0, inf) is double);
Expect.isTrue(min(-0.0, -499.0).isNegative);
Expect.isTrue(min(-0.0, -499).isNegative);
Expect.isTrue(min(-0.0, -0.0).isNegative);
Expect.isTrue(min(-0.0, 0.0).isNegative);
Expect.isTrue(min(-0.0, 0).isNegative);
Expect.isTrue(min(-0.0, 499.0).isNegative);
Expect.isTrue(min(-0.0, 499).isNegative);
Expect.isTrue(min(-0.0, inf).isNegative);
Expect.equals(-inf, min(0.0, -inf));
Expect.equals(-499.0, min(0.0, -499.0));
Expect.equals(-499, min(0.0, -499));
Expect.equals(-0.0, min(0.0, -0.0));
Expect.equals(0.0, min(0.0, 0.0));
Expect.equals(0.0, min(0.0, 0));
Expect.equals(0.0, min(0.0, 499.0));
Expect.equals(0.0, min(0.0, 499));
Expect.equals(0.0, min(0.0, inf));
Expect.isTrue(min(0.0, nan).isNaN);
Expect.isTrue(min(0.0, -499.0) is double);
Expect.isTrue(min(0.0, -499) is int);
Expect.isTrue(min(0.0, -0.0) is double);
Expect.isTrue(min(0.0, 0.0) is double);
Expect.isTrue(min(0.0, 0) is double);
Expect.isTrue(min(0.0, 499.0) is double);
Expect.isTrue(min(0.0, 499) is double);
Expect.isTrue(min(0.0, inf) is double);
Expect.isTrue(min(0.0, -499.0).isNegative);
Expect.isTrue(min(0.0, -499).isNegative);
Expect.isTrue(min(0.0, -0.0).isNegative);
Expect.isFalse(min(0.0, 0.0).isNegative);
Expect.isFalse(min(0.0, 0).isNegative);
Expect.isFalse(min(0.0, 499.0).isNegative);
Expect.isFalse(min(0.0, 499).isNegative);
Expect.isFalse(min(0.0, inf).isNegative);
Expect.equals(-inf, min(0, -inf));
Expect.equals(-499.0, min(0, -499.0));
Expect.equals(-499, min(0, -499));
Expect.equals(-0.0, min(0, -0.0));
Expect.equals(0, min(0, 0.0));
Expect.equals(0, min(0, 0));
Expect.equals(0, min(0, 499.0));
Expect.equals(0, min(0, 499));
Expect.equals(0, min(0, inf));
Expect.isTrue(min(0, nan).isNaN);
Expect.isTrue(min(0, -499.0) is double);
Expect.isTrue(min(0, -499) is int);
Expect.isTrue(min(0, -0.0) is double);
Expect.isTrue(min(0, 0.0) is int);
Expect.isTrue(min(0, 0) is int);
Expect.isTrue(min(0, 499.0) is int);
Expect.isTrue(min(0, 499) is int);
Expect.isTrue(min(0, inf) is int);
Expect.isTrue(min(0, -499.0).isNegative);
Expect.isTrue(min(0, -499).isNegative);
Expect.isTrue(min(0, -0.0).isNegative);
Expect.isFalse(min(0, 0.0).isNegative);
Expect.isFalse(min(0, 0).isNegative);
Expect.isFalse(min(0, 499.0).isNegative);
Expect.isFalse(min(0, 499).isNegative);
Expect.isFalse(min(0, inf).isNegative);
}
testMin3() {
Expect.equals(-inf, min(499.0, -inf));
Expect.equals(-499.0, min(499.0, -499.0));
Expect.equals(-499, min(499.0, -499));
Expect.equals(-0.0, min(499.0, -0.0));
Expect.equals(0.0, min(499.0, 0.0));
Expect.equals(0, min(499.0, 0));
Expect.equals(499.0, min(499.0, 499.0));
Expect.equals(499.0, min(499.0, 499));
Expect.equals(499.0, min(499.0, inf));
Expect.isTrue(min(499.0, nan).isNaN);
Expect.isTrue(min(499.0, -499.0) is double);
Expect.isTrue(min(499.0, -499) is int);
Expect.isTrue(min(499.0, -0.0) is double);
Expect.isTrue(min(499.0, 0.0) is double);
Expect.isTrue(min(499.0, 0) is int);
Expect.isTrue(min(499.0, 499) is double);
Expect.isTrue(min(499.0, 499.0) is double);
Expect.isTrue(min(499.0, inf) is double);
Expect.isTrue(min(499.0, -499.0).isNegative);
Expect.isTrue(min(499.0, -499).isNegative);
Expect.isTrue(min(499.0, -0.0).isNegative);
Expect.isFalse(min(499.0, 0.0).isNegative);
Expect.isFalse(min(499.0, 0).isNegative);
Expect.isFalse(min(499.0, 499).isNegative);
Expect.isFalse(min(499.0, 499.0).isNegative);
Expect.isFalse(min(499.0, inf).isNegative);
Expect.equals(-inf, min(499, -inf));
Expect.equals(-499.0, min(499, -499.0));
Expect.equals(-499, min(499, -499));
Expect.equals(-0.0, min(499, -0.0));
Expect.equals(0.0, min(499, 0.0));
Expect.equals(0, min(499, 0));
Expect.equals(499, min(499, 499.0));
Expect.equals(499, min(499, 499));
Expect.equals(499, min(499, inf));
Expect.isTrue(min(499, nan).isNaN);
Expect.isTrue(min(499, -499.0) is double);
Expect.isTrue(min(499, -499) is int);
Expect.isTrue(min(499, -0.0) is double);
Expect.isTrue(min(499, 0.0) is double);
Expect.isTrue(min(499, 0) is int);
Expect.isTrue(min(499, 499.0) is int);
Expect.isTrue(min(499, 499) is int);
Expect.isTrue(min(499, inf) is int);
Expect.isTrue(min(499, -499.0).isNegative);
Expect.isTrue(min(499, -499).isNegative);
Expect.isTrue(min(499, -0.0).isNegative);
Expect.isFalse(min(499, 0.0).isNegative);
Expect.isFalse(min(499, 0).isNegative);
Expect.isFalse(min(499, 499.0).isNegative);
Expect.isFalse(min(499, 499).isNegative);
Expect.isFalse(min(499, inf).isNegative);
Expect.equals(-inf, min(inf, -inf));
Expect.equals(-499.0, min(inf, -499.0));
Expect.equals(-499, min(inf, -499));
Expect.equals(-0.0, min(inf, -0.0));
Expect.equals(0.0, min(inf, 0.0));
Expect.equals(0, min(inf, 0));
Expect.equals(499.0, min(inf, 499.0));
Expect.equals(499, min(inf, 499));
Expect.equals(inf, min(inf, inf));
Expect.isTrue(min(inf, nan).isNaN);
Expect.isTrue(min(inf, -499.0) is double);
Expect.isTrue(min(inf, -499) is int);
Expect.isTrue(min(inf, -0.0) is double);
Expect.isTrue(min(inf, 0.0) is double);
Expect.isTrue(min(inf, 0) is int);
Expect.isTrue(min(inf, 499) is int);
Expect.isTrue(min(inf, 499.0) is double);
Expect.isTrue(min(inf, inf) is double);
Expect.isTrue(min(inf, -499.0).isNegative);
Expect.isTrue(min(inf, -499).isNegative);
Expect.isTrue(min(inf, -0.0).isNegative);
Expect.isFalse(min(inf, 0.0).isNegative);
Expect.isFalse(min(inf, 0).isNegative);
Expect.isFalse(min(inf, 499).isNegative);
Expect.isFalse(min(inf, 499.0).isNegative);
Expect.isFalse(min(inf, inf).isNegative);
}
testMax() {
testMax1();
testMax2();
testMax3();
}
testMax1() {
Expect.equals(2, max(0, 2));
Expect.equals(2, max(2, 0));
Expect.equals(-9, max(-10, -9));
Expect.equals(9, max(-10, 9));
Expect.equals(0, max(-10, 0));
Expect.equals(-9, max(-9, -10));
Expect.equals(9, max(9, -10));
Expect.equals(0, max(0, -10));
Expect.equals(2.5, max(0.5, 2.5));
Expect.equals(2.5, max(2.5, 0.5));
Expect.equals(-9.5, max(-10.5, -9.5));
Expect.equals(9.5, max(-10.5, 9.5));
Expect.equals(0.5, max(-10.5, 0.5));
Expect.equals(-9.5, max(-9.5, -10.5));
Expect.equals(9.5, max(9.5, -10.5));
Expect.equals(0.5, max(0.5, -10.5));
// Test matrix:
// NaN, infinity, 499.0, 499, 0.0, 0, -0.0, -499.0, -499, -infinity.
Expect.isTrue(max(nan, nan).isNaN);
Expect.isTrue(max(nan, -inf).isNaN);
Expect.isTrue(max(nan, -499.0).isNaN);
Expect.isTrue(max(nan, -499).isNaN);
Expect.isTrue(max(nan, -0.0).isNaN);
Expect.isTrue(max(nan, 0.0).isNaN);
Expect.isTrue(max(nan, 499.0).isNaN);
Expect.isTrue(max(nan, 499).isNaN);
Expect.isTrue(max(nan, inf).isNaN);
Expect.equals(inf, max(inf, inf));
Expect.equals(inf, max(inf, 499.0));
Expect.equals(inf, max(inf, 499));
Expect.equals(inf, max(inf, 0.0));
Expect.equals(inf, max(inf, 0));
Expect.equals(inf, max(inf, -0.0));
Expect.equals(inf, max(inf, -499));
Expect.equals(inf, max(inf, -499.0));
Expect.equals(inf, max(inf, -inf));
Expect.isTrue(max(inf, nan).isNaN);
Expect.equals(inf, max(499.0, inf));
Expect.equals(499.0, max(499.0, 499.0));
Expect.equals(499.0, max(499.0, 499));
Expect.equals(499.0, max(499.0, 0.0));
Expect.equals(499.0, max(499.0, 0));
Expect.equals(499.0, max(499.0, -0.0));
Expect.equals(499.0, max(499.0, -499));
Expect.equals(499.0, max(499.0, -499.0));
Expect.equals(499.0, max(499.0, -inf));
Expect.isTrue(max(499.0, nan).isNaN);
Expect.isTrue(max(499.0, 499.0) is double);
Expect.isTrue(max(499.0, 499) is double);
Expect.isTrue(max(499.0, 0.0) is double);
Expect.isTrue(max(499.0, 0) is double);
Expect.isTrue(max(499.0, -0.0) is double);
Expect.isTrue(max(499.0, -499) is double);
Expect.isTrue(max(499.0, -499.0) is double);
Expect.isTrue(max(499.0, -inf) is double);
Expect.equals(inf, max(499, inf));
Expect.equals(499, max(499, 499.0));
Expect.equals(499, max(499, 499));
Expect.equals(499, max(499, 0.0));
Expect.equals(499, max(499, 0));
Expect.equals(499, max(499, -0.0));
Expect.equals(499, max(499, -499));
Expect.equals(499, max(499, -499.0));
Expect.equals(499, max(499, -inf));
Expect.isTrue(max(499, nan).isNaN);
Expect.isTrue(max(499, 499.0) is int);
Expect.isTrue(max(499, 499) is int);
Expect.isTrue(max(499, 0.0) is int);
Expect.isTrue(max(499, 0) is int);
Expect.isTrue(max(499, -0.0) is int);
Expect.isTrue(max(499, -499) is int);
Expect.isTrue(max(499, -499.0) is int);
Expect.isTrue(max(499, -inf) is int);
Expect.equals(inf, max(0.0, inf));
Expect.equals(499.0, max(0.0, 499.0));
Expect.equals(499, max(0.0, 499));
Expect.equals(0.0, max(0.0, 0.0));
Expect.equals(0.0, max(0.0, 0));
Expect.equals(0.0, max(0.0, -0.0));
Expect.equals(0.0, max(0.0, -499));
Expect.equals(0.0, max(0.0, -499.0));
Expect.equals(0.0, max(0.0, -inf));
Expect.isTrue(max(0.0, nan).isNaN);
Expect.isTrue(max(0.0, 499.0) is double);
Expect.isTrue(max(0.0, 499) is int);
Expect.isTrue(max(0.0, 0.0) is double);
Expect.isTrue(max(0.0, 0) is double);
Expect.isTrue(max(0.0, -0.0) is double);
Expect.isTrue(max(0.0, -499) is double);
Expect.isTrue(max(0.0, -499.0) is double);
Expect.isTrue(max(0.0, -inf) is double);
}
testMax2() {
Expect.isFalse(max(0.0, 0.0).isNegative);
Expect.isFalse(max(0.0, 0).isNegative);
Expect.isFalse(max(0.0, -0.0).isNegative);
Expect.isFalse(max(0.0, -499).isNegative);
Expect.isFalse(max(0.0, -499.0).isNegative);
Expect.isFalse(max(0.0, -inf).isNegative);
Expect.equals(inf, max(0, inf));
Expect.equals(499.0, max(0, 499.0));
Expect.equals(499, max(0, 499));
Expect.equals(0, max(0, 0.0));
Expect.equals(0, max(0, 0));
Expect.equals(0, max(0, -0.0));
Expect.equals(0, max(0, -499));
Expect.equals(0, max(0, -499.0));
Expect.equals(0, max(0, -inf));
Expect.isTrue(max(0, nan).isNaN);
Expect.isTrue(max(0, 499.0) is double);
Expect.isTrue(max(0, 499) is int);
Expect.isTrue(max(0, 0.0) is int);
Expect.isTrue(max(0, 0) is int);
Expect.isTrue(max(0, -0.0) is int);
Expect.isTrue(max(0, -499) is int);
Expect.isTrue(max(0, -499.0) is int);
Expect.isTrue(max(0, -inf) is int);
Expect.isFalse(max(0, 0.0).isNegative);
Expect.isFalse(max(0, 0).isNegative);
Expect.isFalse(max(0, -0.0).isNegative);
Expect.isFalse(max(0, -499).isNegative);
Expect.isFalse(max(0, -499.0).isNegative);
Expect.isFalse(max(0, -inf).isNegative);
Expect.equals(inf, max(-0.0, inf));
Expect.equals(499.0, max(-0.0, 499.0));
Expect.equals(499, max(-0.0, 499));
Expect.equals(0.0, max(-0.0, 0.0));
Expect.equals(0.0, max(-0.0, 0));
Expect.equals(-0.0, max(-0.0, -0.0));
Expect.equals(-0.0, max(-0.0, -499));
Expect.equals(-0.0, max(-0.0, -499.0));
Expect.equals(-0.0, max(-0.0, -inf));
Expect.isTrue(max(-0.0, nan).isNaN);
Expect.isTrue(max(-0.0, 499.0) is double);
Expect.isTrue(max(-0.0, 499) is int);
Expect.isTrue(max(-0.0, 0.0) is double);
Expect.isTrue(max(-0.0, 0) is int);
Expect.isTrue(max(-0.0, -0.0) is double);
Expect.isTrue(max(-0.0, -499) is double);
Expect.isTrue(max(-0.0, -499.0) is double);
Expect.isTrue(max(-0.0, -inf) is double);
}
testMax3() {
Expect.isFalse(max(-0.0, 0.0).isNegative);
Expect.isFalse(max(-0.0, 0).isNegative);
Expect.isTrue(max(-0.0, -0.0).isNegative);
Expect.isTrue(max(-0.0, -499).isNegative);
Expect.isTrue(max(-0.0, -499.0).isNegative);
Expect.isTrue(max(-0.0, -inf).isNegative);
Expect.equals(inf, max(-499, inf));
Expect.equals(499.0, max(-499, 499.0));
Expect.equals(499, max(-499, 499));
Expect.equals(0.0, max(-499, 0.0));
Expect.equals(0.0, max(-499, 0));
Expect.equals(-0.0, max(-499, -0.0));
Expect.equals(-499, max(-499, -499));
Expect.equals(-499, max(-499, -499.0));
Expect.equals(-499, max(-499, -inf));
Expect.isTrue(max(-499, nan).isNaN);
Expect.isTrue(max(-499, 499.0) is double);
Expect.isTrue(max(-499, 499) is int);
Expect.isTrue(max(-499, 0.0) is double);
Expect.isTrue(max(-499, 0) is int);
Expect.isTrue(max(-499, -0.0) is double);
Expect.isTrue(max(-499, -499) is int);
Expect.isTrue(max(-499, -499.0) is int);
Expect.isTrue(max(-499, -inf) is int);
Expect.isFalse(max(-499, 0.0).isNegative);
Expect.isFalse(max(-499, 0).isNegative);
Expect.isTrue(max(-499, -0.0).isNegative);
Expect.isTrue(max(-499, -499).isNegative);
Expect.isTrue(max(-499, -499.0).isNegative);
Expect.isTrue(max(-499, -inf).isNegative);
Expect.equals(inf, max(-499.0, inf));
Expect.equals(499.0, max(-499.0, 499.0));
Expect.equals(499, max(-499.0, 499));
Expect.equals(0.0, max(-499.0, 0.0));
Expect.equals(0.0, max(-499.0, 0));
Expect.equals(-0.0, max(-499.0, -0.0));
Expect.equals(-499.0, max(-499.0, -499));
Expect.equals(-499.0, max(-499.0, -499.0));
Expect.equals(-499.0, max(-499.0, -inf));
Expect.isTrue(max(-499.0, nan).isNaN);
Expect.isTrue(max(-499.0, 499.0) is double);
Expect.isTrue(max(-499.0, 499) is int);
Expect.isTrue(max(-499.0, 0.0) is double);
Expect.isTrue(max(-499.0, 0) is int);
Expect.isTrue(max(-499.0, -0.0) is double);
Expect.isTrue(max(-499.0, -499) is double);
Expect.isTrue(max(-499.0, -499.0) is double);
Expect.isTrue(max(-499.0, -inf) is double);
Expect.isFalse(max(-499.0, 0.0).isNegative);
Expect.isFalse(max(-499.0, 0).isNegative);
Expect.isTrue(max(-499.0, -0.0).isNegative);
Expect.isTrue(max(-499.0, -499).isNegative);
Expect.isTrue(max(-499.0, -499.0).isNegative);
Expect.isTrue(max(-499.0, -inf).isNegative);
Expect.equals(inf, max(-inf, inf));
Expect.equals(499.0, max(-inf, 499.0));
Expect.equals(499, max(-inf, 499));
Expect.equals(0.0, max(-inf, 0.0));
Expect.equals(0.0, max(-inf, 0));
Expect.equals(-0.0, max(-inf, -0.0));
Expect.equals(-499, max(-inf, -499));
Expect.equals(-499.0, max(-inf, -499.0));
Expect.equals(-inf, max(-inf, -inf));
Expect.isTrue(max(-inf, nan).isNaN);
Expect.isTrue(max(-inf, 499.0) is double);
Expect.isTrue(max(-inf, 499) is int);
Expect.isTrue(max(-inf, 0.0) is double);
Expect.isTrue(max(-inf, 0) is int);
Expect.isTrue(max(-inf, -0.0) is double);
Expect.isTrue(max(-inf, -499) is int);
Expect.isTrue(max(-inf, -499.0) is double);
Expect.isTrue(max(-inf, -inf) is double);
Expect.isFalse(max(-inf, 0.0).isNegative);
Expect.isFalse(max(-inf, 0).isNegative);
Expect.isTrue(max(-inf, -0.0).isNegative);
Expect.isTrue(max(-inf, -499).isNegative);
Expect.isTrue(max(-inf, -499.0).isNegative);
Expect.isTrue(max(-inf, -inf).isNegative);
}
main() {
testMin();
testMin();
testMax();
testMax();
}
+49
View File
@@ -0,0 +1,49 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that the default PRNG does converge towards Pi when doing a Monte Carlo
// simulation.
import "package:expect/expect.dart";
import 'dart:math';
var known_bad_seeds = const [50051, 55597, 59208];
void main([args]) {
// Select a seed either from the argument passed in or
// otherwise a random seed.
var seed = -1;
if ((args != null) && (args.length > 0)) {
seed = int.parse(args[0]);
} else {
var seed_prng = new Random();
while (seed == -1) {
seed = seed_prng.nextInt(1 << 16);
if (known_bad_seeds.contains(seed)) {
// Reset seed and try again.
seed = -1;
}
}
}
// Setup the PRNG for the Monte Carlo simulation.
print("pi_test seed: $seed");
var prng = new Random(seed);
var outside = 0;
var inside = 0;
for (var i = 0; i < 600000; i++) {
var x = prng.nextDouble();
var y = prng.nextDouble();
if ((x * x) + (y * y) < 1.0) {
inside++;
} else {
outside++;
}
}
// Mmmmh, Pie!
var pie = 4.0 * (inside / (inside + outside));
print("$pie");
Expect.isTrue(((pi - 0.009) < pie) && (pie < (pi + 0.009)));
}
+99
View File
@@ -0,0 +1,99 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:expect/expect.dart';
main() {
// constructor
{
var point = new Point(0, 0);
Expect.equals(0, point.x);
Expect.equals(0, point.y);
Expect.equals('Point(0, 0)', '$point');
}
// constructor X
{
var point = new Point<int>(10, 0);
Expect.equals(10, point.x);
Expect.equals(0, point.y);
Expect.equals('Point(10, 0)', '$point');
}
// constructor X Y
{
var point = new Point<int>(10, 20);
Expect.equals(10, point.x);
Expect.equals(20, point.y);
Expect.equals('Point(10, 20)', '$point');
}
// constructor X Y double
{
var point = new Point<double>(10.5, 20.897);
Expect.equals(10.5, point.x);
Expect.equals(20.897, point.y);
Expect.equals('Point(10.5, 20.897)', '$point');
}
// constructor X Y NaN
{
var point = new Point(double.nan, 1000);
Expect.isTrue(point.x.isNaN);
Expect.equals(1000, point.y);
Expect.equals('Point(NaN, 1000)', '$point');
}
// squaredDistanceTo
{
var a = new Point(7, 11);
var b = new Point(3, -1);
Expect.equals(160, a.squaredDistanceTo(b));
Expect.equals(160, b.squaredDistanceTo(a));
}
// distanceTo
{
var a = new Point(-2, -3);
var b = new Point(2, 0);
Expect.equals(5, a.distanceTo(b));
Expect.equals(5, b.distanceTo(a));
}
// subtract
{
var a = new Point(5, 10);
var b = new Point(2, 50);
Expect.equals(new Point(3, -40), a - b);
}
// add
{
var a = new Point(5, 10);
var b = new Point(2, 50);
Expect.equals(new Point(7, 60), a + b);
}
// hashCode
{
var a = new Point(0, 1);
var b = new Point(0, 1);
Expect.equals(b.hashCode, a.hashCode);
var c = new Point(1, 0);
Expect.isFalse(a.hashCode == c.hashCode);
}
// magnitude
{
var a = new Point(5, 10);
var b = new Point(0, 0);
Expect.equals(a.distanceTo(b), a.magnitude);
Expect.equals(0, b.magnitude);
var c = new Point(-5, -10);
Expect.equals(a.distanceTo(b), c.magnitude);
}
}
+19
View File
@@ -0,0 +1,19 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that Random can deal with a seed outside 64-bit range.
import "package:expect/expect.dart";
import 'dart:math';
main() {
var results = [];
for (var i = 60; i < 64; i++) {
var rng = new Random(1 << i);
var val = rng.nextInt(100000);
print("$i: $val");
Expect.isFalse(results.contains(val));
results.add(val);
}
}
+58
View File
@@ -0,0 +1,58 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that the secure random generator does not systematically generates
// duplicates. Note that this test is flaky by definition, since duplicates
// can occur. They should be extremely rare, though.
import "package:expect/expect.dart";
import 'dart:math';
main() {
var results;
var rng0;
var rng1;
var checkInt = (max) {
var intVal0 = rng0.nextInt(max);
var intVal1 = rng1.nextInt(max);
if (max > (1 << 28)) {
Expect.isFalse(results.contains(intVal0));
results.add(intVal0);
Expect.isFalse(results.contains(intVal1));
results.add(intVal1);
}
};
results = [];
rng0 = new Random.secure();
for (var i = 0; i <= 32; i++) {
rng1 = new Random.secure();
checkInt(pow(2, 32));
checkInt(pow(2, 32 - i));
checkInt(1000000000);
}
var checkDouble = () {
var doubleVal0 = rng0.nextDouble();
var doubleVal1 = rng1.nextDouble();
Expect.isFalse(results.contains(doubleVal0));
results.add(doubleVal0);
Expect.isFalse(results.contains(doubleVal1));
results.add(doubleVal1);
};
results = [];
rng0 = new Random.secure();
for (var i = 0; i < 32; i++) {
rng1 = new Random.secure();
checkDouble();
}
var cnt0 = 0;
var cnt1 = 0;
rng0 = new Random.secure();
for (var i = 0; i < 32; i++) {
rng1 = new Random.secure();
cnt0 += rng0.nextBool() ? 1 : 0;
cnt1 += rng1.nextBool() ? 1 : 0;
}
Expect.isTrue((cnt0 > 0) && (cnt0 < 32));
Expect.isTrue((cnt1 > 0) && (cnt1 < 32));
}
@@ -0,0 +1,27 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that `Random.secure()` throws `UnsupportedError` each time it fails.
import "package:expect/expect.dart";
import 'dart:math';
main() {
var result1 = getRandom();
var result2 = getRandom();
Expect.isNotNull(result1);
Expect.isNotNull(result2); // This fired for http://dartbug.com/36206
Expect.equals(result1 is Random, result2 is Random);
Expect.equals(result1 is UnsupportedError, result2 is UnsupportedError);
}
dynamic getRandom() {
try {
return Random.secure();
} catch (e) {
return e;
}
}
+239
View File
@@ -0,0 +1,239 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that rnd.nextInt with a seed generates the same sequence each time.
// Library tag to allow Dartium to run the test.
library random_test;
import "package:expect/expect.dart";
import 'dart:math';
main() {
checkSequence();
checkSeed();
}
void checkSequence() {
// Check the sequence of numbers generated by the random generator for a seed
// doesn't change unintendedly, and it agrees between implementations.
var rnd = new Random(20130307);
// Make sure we do not break the random number generation.
// If the random algorithm changes, make sure both the VM and dart2js
// generate the same new sequence.
var i = 1;
Expect.equals(0, rnd.nextInt(i *= 2));
Expect.equals(3, rnd.nextInt(i *= 2));
Expect.equals(7, rnd.nextInt(i *= 2));
Expect.equals(5, rnd.nextInt(i *= 2));
Expect.equals(29, rnd.nextInt(i *= 2));
Expect.equals(17, rnd.nextInt(i *= 2));
Expect.equals(104, rnd.nextInt(i *= 2));
Expect.equals(199, rnd.nextInt(i *= 2));
Expect.equals(408, rnd.nextInt(i *= 2));
Expect.equals(362, rnd.nextInt(i *= 2));
Expect.equals(995, rnd.nextInt(i *= 2));
Expect.equals(2561, rnd.nextInt(i *= 2));
Expect.equals(2548, rnd.nextInt(i *= 2));
Expect.equals(9553, rnd.nextInt(i *= 2));
Expect.equals(2628, rnd.nextInt(i *= 2));
Expect.equals(42376, rnd.nextInt(i *= 2));
Expect.equals(101848, rnd.nextInt(i *= 2));
Expect.equals(85153, rnd.nextInt(i *= 2));
Expect.equals(495595, rnd.nextInt(i *= 2));
Expect.equals(647122, rnd.nextInt(i *= 2));
Expect.equals(793546, rnd.nextInt(i *= 2));
Expect.equals(1073343, rnd.nextInt(i *= 2));
Expect.equals(4479969, rnd.nextInt(i *= 2));
Expect.equals(9680425, rnd.nextInt(i *= 2));
Expect.equals(28460171, rnd.nextInt(i *= 2));
Expect.equals(49481738, rnd.nextInt(i *= 2));
Expect.equals(9878974, rnd.nextInt(i *= 2));
Expect.equals(132552472, rnd.nextInt(i *= 2));
Expect.equals(210267283, rnd.nextInt(i *= 2));
Expect.equals(125422442, rnd.nextInt(i *= 2));
Expect.equals(226275094, rnd.nextInt(i *= 2));
Expect.equals(1639629168, rnd.nextInt(i *= 2));
Expect.equals(0x100000000, i);
// If max is too large expect an ArgumentError.
Expect.throwsArgumentError(() => rnd.nextInt(i + 1));
rnd = new Random(6790);
Expect.approxEquals(0.1202733131, rnd.nextDouble());
Expect.approxEquals(0.5554054805, rnd.nextDouble());
Expect.approxEquals(0.0385160727, rnd.nextDouble());
Expect.approxEquals(0.2836345217, rnd.nextDouble());
}
void checkSeed() {
// Check that various seeds generate the expected first values.
// 53 significant bits, so the number is representable in JS.
var rawSeed = 0x19a32c640e1d71;
var expectations = [
26007,
43006,
46458,
18610,
16413,
50455,
2164,
47399,
8859,
9732,
20367,
33935,
54549,
54913,
4819,
24198,
49353,
22277,
51852,
35959,
45347,
12100,
10136,
22372,
15293,
20066,
1351,
49030,
64845,
12793,
50916,
55784,
43170,
27653,
34696,
1492,
50255,
9597,
45929,
2874,
27629,
53084,
36064,
42140,
32016,
41751,
13967,
20516,
578,
16773,
53064,
14814,
22737,
48846,
45147,
10205,
56584,
63711,
44128,
21099,
47966,
35471,
39576,
1141,
45716,
54940,
57406,
15437,
31721,
35044,
28136,
39797,
50801,
22184,
58686
];
var negative_seed_expectations = [
12170,
42844,
39228,
64032,
29046,
57572,
8453,
52224,
27060,
28454,
20510,
28804,
59221,
53422,
11047,
50864,
33997,
19611,
1250,
65088,
19690,
11396,
20,
48867,
44862,
47129,
58724,
13325,
50005,
33320,
16523,
4740,
63721,
63272,
30545,
51403,
35845,
3943,
31850,
23148,
26307,
1724,
29281,
39988,
43653,
48012,
43810,
16755,
13105,
25325,
32648,
19958,
38838,
8322,
3421,
28624,
17269,
45385,
50680,
1696,
26088,
2787,
48566,
34357,
27731,
51764,
8455,
16498,
59721,
59568,
46333,
7935,
51459,
36766,
50711
];
for (var i = 0, m = 1; i < 75; i++) {
if (rawSeed * m < 0) {
// Overflow.
break;
}
Expect.equals(expectations[i], new Random(rawSeed * m).nextInt(65536));
Expect.equals(
negative_seed_expectations[i], new Random(rawSeed * -m).nextInt(65536));
m *= 2;
}
// And test zero seed too.
Expect.equals(21391, new Random(0).nextInt(65536));
}
+288
View File
@@ -0,0 +1,288 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:expect/expect.dart';
main() {
testConstruction();
testIntersection();
testIntersects();
testBoundingBox();
testContainsRectangle();
testContainsPoint();
testHashCode();
testEdgeCases();
testEquality();
testNegativeLengths();
testNaNLeft();
testNaNTop();
testNaNWidth();
testNaNHeight();
}
Rectangle? createRectangle(List<num>? a) {
return a != null ? new Rectangle(a[0], a[1], a[2] - a[0], a[3] - a[1]) : null;
}
testConstruction() {
var r0 = new Rectangle(10, 20, 30, 40);
Expect.equals('Rectangle (10, 20) 30 x 40', r0.toString());
Expect.equals(40, r0.right);
Expect.equals(60, r0.bottom);
var r1 = new Rectangle.fromPoints(r0.topLeft, r0.bottomRight);
Expect.equals(r0, r1);
var r2 = new Rectangle.fromPoints(r0.bottomRight, r0.topLeft);
Expect.equals(r0, r2);
}
testIntersection() {
var tests = <List<List<num>?>>[
[
[10, 10, 20, 20],
[15, 15, 25, 25],
[15, 15, 20, 20]
],
[
[10, 10, 20, 20],
[20, 0, 30, 10],
[20, 10, 20, 10]
],
[
[0, 0, 1, 1],
[10, 11, 12, 13],
null
],
[
[11, 12, 98, 99],
[22, 23, 34, 35],
[22, 23, 34, 35]
]
];
for (var test in tests) {
var r0 = createRectangle(test[0]);
var r1 = createRectangle(test[1]);
var expected = createRectangle(test[2]);
Expect.equals(expected, r0.intersection(r1));
Expect.equals(expected, r1.intersection(r0));
}
}
testIntersects() {
var r0 = new Rectangle(10, 10, 20, 20);
var r1 = new Rectangle(15, 15, 25, 25);
var r2 = new Rectangle(0, 0, 1, 1);
Expect.isTrue(r0.intersects(r1));
Expect.isTrue(r1.intersects(r0));
Expect.isFalse(r0.intersects(r2));
Expect.isFalse(r2.intersects(r0));
}
testBoundingBox() {
var tests = [
[
[10, 10, 20, 20],
[15, 15, 25, 25],
[10, 10, 25, 25]
],
[
[10, 10, 20, 20],
[20, 0, 30, 10],
[10, 0, 30, 20]
],
[
[0, 0, 1, 1],
[10, 11, 12, 13],
[0, 0, 12, 13]
],
[
[11, 12, 98, 99],
[22, 23, 34, 35],
[11, 12, 98, 99]
]
];
for (var test in tests) {
var r0 = createRectangle(test[0]);
var r1 = createRectangle(test[1]);
var expected = createRectangle(test[2]);
Expect.equals(expected, r0.boundingBox(r1));
Expect.equals(expected, r1.boundingBox(r0));
}
}
testContainsRectangle() {
var r = new Rectangle(-10, 0, 20, 10);
Expect.isTrue(r.containsRectangle(r));
Expect.isFalse(r.containsRectangle(
new Rectangle(double.nan, double.nan, double.nan, double.nan)));
var r2 = new Rectangle(0, 2, 5, 5);
Expect.isTrue(r.containsRectangle(r2));
Expect.isFalse(r2.containsRectangle(r));
r2 = new Rectangle(-11, 2, 5, 5);
Expect.isFalse(r.containsRectangle(r2));
r2 = new Rectangle(0, 2, 15, 5);
Expect.isFalse(r.containsRectangle(r2));
r2 = new Rectangle(0, 2, 5, 10);
Expect.isFalse(r.containsRectangle(r2));
r2 = new Rectangle(0, 0, 5, 10);
Expect.isTrue(r.containsRectangle(r2));
}
testContainsPoint() {
var r = new Rectangle(20, 40, 60, 80);
// Test middle.
Expect.isTrue(r.containsPoint(new Point(50, 80)));
// Test edges.
Expect.isTrue(r.containsPoint(new Point(20, 40)));
Expect.isTrue(r.containsPoint(new Point(50, 40)));
Expect.isTrue(r.containsPoint(new Point(80, 40)));
Expect.isTrue(r.containsPoint(new Point(80, 80)));
Expect.isTrue(r.containsPoint(new Point(80, 120)));
Expect.isTrue(r.containsPoint(new Point(50, 120)));
Expect.isTrue(r.containsPoint(new Point(20, 120)));
Expect.isTrue(r.containsPoint(new Point(20, 80)));
// Test outside.
Expect.isFalse(r.containsPoint(new Point(0, 0)));
Expect.isFalse(r.containsPoint(new Point(50, 0)));
Expect.isFalse(r.containsPoint(new Point(100, 0)));
Expect.isFalse(r.containsPoint(new Point(100, 80)));
Expect.isFalse(r.containsPoint(new Point(100, 160)));
Expect.isFalse(r.containsPoint(new Point(50, 160)));
Expect.isFalse(r.containsPoint(new Point(0, 160)));
Expect.isFalse(r.containsPoint(new Point(0, 80)));
}
testHashCode() {
var a = new Rectangle(0, 1, 2, 3);
var b = new Rectangle(0, 1, 2, 3);
Expect.equals(b.hashCode, a.hashCode);
var c = new Rectangle(1, 0, 2, 3);
Expect.isFalse(a.hashCode == c.hashCode);
}
testEdgeCases() {
edgeTest(double a, double l) {
var r = new Rectangle(a, a, l, l);
Expect.equals(r, r.boundingBox(r));
Expect.equals(r, r.intersection(r));
}
var bignum1 = 0x20000000000000 + 0.0;
var bignum2 = 0x20000000000002 + 0.0;
var bignum3 = 0x20000000000004 + 0.0;
edgeTest(1.0, bignum1);
edgeTest(1.0, bignum2);
edgeTest(1.0, bignum3);
edgeTest(bignum1, 1.0);
edgeTest(bignum2, 1.0);
edgeTest(bignum3, 1.0);
}
testEquality() {
var bignum = 0x80000000000008 + 0.0;
var r1 = new Rectangle(bignum, bignum, 1.0, 1.0);
var r2 = new Rectangle(bignum, bignum, 2.0, 2.0);
Expect.equals(r2, r1);
Expect.equals(r2.hashCode, r1.hashCode);
Expect.equals(r2.right, r1.right);
Expect.equals(r2.bottom, r1.bottom);
Expect.equals(1.0, r1.width);
Expect.equals(2.0, r2.width);
}
testNegativeLengths() {
// Constructor allows negative lengths, but clamps them to zero.
Expect.equals(new Rectangle(4, 4, 0, 0), new Rectangle(4, 4, -2, -2));
Expect.equals(new Rectangle(4, 4, 0, 0), new MutableRectangle(4, 4, -2, -2));
// Setters clamp negative lengths to zero.
var mutable = new MutableRectangle(0, 0, 1, 1);
mutable.width = -1;
mutable.height = -1;
Expect.equals(new Rectangle(0, 0, 0, 0), mutable);
// Test that doubles are clamped to double zero.
var rectangle = new Rectangle(1.5, 1.5, -2.5, -2.5);
Expect.isTrue(identical(rectangle.width, 0.0));
Expect.isTrue(identical(rectangle.height, 0.0));
}
testNaNLeft() {
var rectangles = [
const Rectangle(double.nan, 1, 2, 3),
new MutableRectangle(double.nan, 1, 2, 3),
new Rectangle.fromPoints(new Point(double.nan, 1), new Point(2, 4)),
new MutableRectangle.fromPoints(new Point(double.nan, 1), new Point(2, 4)),
];
for (var r in rectangles) {
Expect.isFalse(r.containsPoint(new Point(0, 1)));
Expect.isFalse(r.containsRectangle(new Rectangle(0, 1, 2, 3)));
Expect.isFalse(r.intersects(new Rectangle(0, 1, 2, 3)));
Expect.isTrue(r.left.isNaN);
Expect.isTrue(r.right.isNaN);
}
}
testNaNTop() {
var rectangles = [
const Rectangle(0, double.nan, 2, 3),
new MutableRectangle(0, double.nan, 2, 3),
new Rectangle.fromPoints(new Point(0, double.nan), new Point(2, 4)),
new MutableRectangle.fromPoints(new Point(0, double.nan), new Point(2, 4)),
];
for (var r in rectangles) {
Expect.isFalse(r.containsPoint(new Point(0, 1)));
Expect.isFalse(r.containsRectangle(new Rectangle(0, 1, 2, 3)));
Expect.isFalse(r.intersects(new Rectangle(0, 1, 2, 3)));
Expect.isTrue(r.top.isNaN);
Expect.isTrue(r.bottom.isNaN);
}
}
testNaNWidth() {
var rectangles = [
const Rectangle(0, 1, double.nan, 3),
new MutableRectangle(0, 1, double.nan, 3),
new Rectangle.fromPoints(new Point(0, 1), new Point(double.nan, 4)),
new MutableRectangle.fromPoints(new Point(0, 1), new Point(double.nan, 4)),
];
for (var r in rectangles) {
Expect.isFalse(r.containsPoint(new Point(0, 1)));
Expect.isFalse(r.containsRectangle(new Rectangle(0, 1, 2, 3)));
Expect.isFalse(r.intersects(new Rectangle(0, 1, 2, 3)));
Expect.isTrue(r.right.isNaN);
Expect.isTrue(r.width.isNaN);
}
}
testNaNHeight() {
var rectangles = [
const Rectangle(0, 1, 2, double.nan),
new MutableRectangle(0, 1, 2, double.nan),
new Rectangle.fromPoints(new Point(0, 1), new Point(2, double.nan)),
new MutableRectangle.fromPoints(new Point(0, 1), new Point(2, double.nan)),
];
for (var r in rectangles) {
Expect.isFalse(r.containsPoint(new Point(0, 1)));
Expect.isFalse(r.containsRectangle(new Rectangle(0, 1, 2, 3)));
Expect.isFalse(r.intersects(new Rectangle(0, 1, 2, 3)));
Expect.isTrue(r.bottom.isNaN);
Expect.isTrue(r.height.isNaN);
}
}
@@ -0,0 +1,89 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// We are using --complete-timeline below to ensure that we get timeline events
// generated during all phases of compilation and deoptimization.
// VMOptions=--optimization_counter_threshold=10 --no-use-osr --complete-timeline --no-background_compilation
import "package:expect/expect.dart";
test1(a, start, step, N) {
var e;
for (var i = 0; i < N; i++) {
e = a[start + i * step];
}
return e;
}
test2(a, b) {
var e;
for (var i = 0, j = 0, k = 0; i < a.length; i++, j++, k++) {
e = b[k] = a[j];
}
return e;
}
test3(a, b) {
var e;
for (var i = 0, j = 1, k = 0; i < a.length - 1; i++, j++, k++) {
e = b[k] = a[j - 1];
}
return e;
}
test4(a, b) {
var e;
if (a.length < 2) {
return null;
}
for (var i = 0, j = 1, k = 0; i < a.length - 1; i++, j++, k++) {
e = b[k] = a[j - 1];
}
return e;
}
test5(a, b, k0) {
var e;
if (a.length < 2) {
return null;
}
if (k0 > 1) {
return null;
}
for (var i = 0, j = 1, k = 0; i < a.length - 1; i++, j++, k++) {
e = b[k - k0] = a[j - 1];
}
return e;
}
test6(List<int> a, int M, int N) {
var e = 0;
for (var i = 0; i < N; i++) {
for (var j = 0; j < M; j++) {
e += a[i * M + j];
}
}
return e;
}
main() {
var a = const [0, 1, 2, 3, 4, 5, 6, 7];
var b = new List(a.length);
for (var i = 0; i < 10000; i++) {
Expect.equals(a.last, test1(a, 0, 1, a.length));
Expect.equals(a.last, test2(a, b));
Expect.equals(a[a.length - 2], test3(a, b));
Expect.equals(a[a.length - 2], test4(a, b));
Expect.equals(a[a.length - 2], test5(a, b, 0));
Expect.equals(6, test6(a, 2, 2));
}
test1(a, 0, 2, a.length ~/ 2);
Expect.throws(() => test1(a, 1, 1, a.length));
Expect.throws(() => test2(a, new List(a.length - 1)));
Expect.throws(() => test6(a, 4, 3));
}
@@ -0,0 +1,34 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
abstract class A<T extends A<T>> {
@pragma('vm:prefer-inline')
f(x) => new R<T>(x);
}
class B extends A<B> {}
class R<T> {
@pragma('vm:prefer-inline')
R(T field);
}
class C extends B {}
class D extends C {}
// f will be inlined and T=B will be forwarded to AssertAssignable in the
// R. However B will be wrapped in the TypeRef which breaks runtime TypeCheck
// function (Instance::IsInstanceOf does not work for TypeRefs).
@pragma('vm:never-inline')
f(o) => new B().f(o);
main() {
final o = new D();
for (var i = 0; i < 10; i++) {
f(o);
}
}
+100
View File
@@ -0,0 +1,100 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# WARNING:
# Tests using the multitest feature where failure is expected should *also* be
# listed in tests/lib/analyzer/analyze_tests.status without the "standalone"
# prefix.
io/http_linklocal_ipv6_test: SkipByDesign # This needs manual test.
io/non_utf8_directory_test: Skip # Issue 33519. Temp files causing bots to go purple.
io/non_utf8_file_test: Skip # Issue 33519. Temp files causing bots to go purple.
io/non_utf8_link_test: Skip # Issue 33519. Temp files causing bots to go purple.
packages_file_test: Skip # Issue 26715
packages_file_test/none: Skip # contains no tests.
[ $builder_tag == asan ]
io/process_detached_test: Slow
[ $builder_tag == no_ipv6 ]
io/http_ipv6_test: SkipByDesign
io/http_loopback_test: SkipByDesign
io/http_proxy_advanced_test: SkipByDesign
io/socket_bind_test: SkipByDesign
io/socket_info_ipv6_test: SkipByDesign
io/socket_ipv6_test: SkipByDesign
io/socket_source_address_test: SkipByDesign
[ $compiler == dart2analyzer ]
deferred_transitive_import_error_test: Skip
[ $compiler == dartkp ]
causal_async_stack_test: Skip # Flaky.
[ $mode == product ]
dart_developer_env_test: SkipByDesign
io/stdio_implicit_close_test: Skip # SkipByDesign
no_profiler_test: SkipByDesign
no_support_coverage_test: SkipByDesign
no_support_debugger_test: SkipByDesign
no_support_disassembler_test: SkipByDesign
no_support_il_printer_test: SkipByDesign
no_support_service_test: SkipByDesign
no_support_timeline_test: SkipByDesign
verbose_gc_to_bmu_test: SkipByDesign # No verbose_gc in product mode
[ $runtime == dart_precompiled ]
http_launch_test: Skip
io/addlatexhash_test: Skip
io/wait_for_event_isolate_test: SkipByDesign # Uses mirrors.
io/wait_for_event_microtask_test: SkipByDesign # Uses mirrors.
io/wait_for_event_nested_microtask_test: SkipByDesign # Uses mirrors.
io/wait_for_event_nested_timer_microtask_test: SkipByDesign # Uses mirrors.
io/wait_for_event_nested_timer_test: SkipByDesign # Uses mirrors.
io/wait_for_event_nested_waits_test: SkipByDesign # Uses mirrors.
io/wait_for_event_timer_test: SkipByDesign # Uses mirrors.
io/wait_for_event_zone_caught_error_test: SkipByDesign # Uses mirrors.
io/wait_for_event_zone_test: SkipByDesign # Uses mirrors.
io/wait_for_test: SkipByDesign # Uses mirrors.
verbose_gc_to_bmu_test: Skip # Attempts to spawn dart using Platform.executable
[ $builder_tag == swarming && $system == macos ]
io/*: Skip # Issue 30618
[ $compiler == none && $runtime == vm && $system == fuchsia ]
*: Skip # Not yet triaged.
[ $compiler != none && $runtime != dart_precompiled && $runtime != vm ]
env_test: Skip # This is testing a vm command line parsing scenario.
[ $mode == product && $runtime == dart_precompiled ]
dwarf_stack_trace_test: SkipByDesign # Due to instruction canonicalization we can end up having the wrong names in stack traces.
[ $runtime == vm && $system == linux ]
io/http_basic_test: Slow # Issue 28046, These tests might be slow on an opt counter threshold bot. They also time out on the bot occasionally => flaky test issue 28046
io/http_launch_test: Slow # Issue 28046, These tests might be slow on an opt counter threshold bot. They also time out on the bot occasionally => flaky test issue 28046
[ $system == macos && ($runtime == dart_precompiled || $runtime == vm) ]
io/raw_secure_server_socket_test: Crash
io/raw_server_socket_cancel_test: Skip # Issue 28182 # This test sometimes hangs on Mac.
io/secure_server_client_certificate_test: Skip # Re-enable once the bots have been updated. Issue #26057
io/socket_many_connections_test: Skip # This test fails with "Too many open files" on the Mac OS buildbot. This is expected as MacOS by default runs with a very low number of allowed open files ('ulimit -n' says something like 256).
[ $arch == arm || $arch == arm64 || $runtime != vm || $system == android ]
fragmentation_test: SkipSlow
fragmentation_typed_data_test: SkipSlow
[ $compiler == dart2js || $compiler == dartdevc || $compiler == dartdevk ]
*: SkipByDesign
[ $mode == product || $runtime == dart_precompiled ]
no_assert_test: SkipByDesign
[ $runtime == dart_precompiled || $runtime == vm ]
deferred_transitive_import_error_test: Skip
[ $hot_reload || $hot_reload_rollback ]
io/addlatexhash_test: Crash # Issue 31252
io/many_directory_operations_test: SkipSlow
io/many_file_operations_test: SkipSlow
package/*: SkipByDesign # Launches VMs in interesting ways.
typed_data_isolate_test: SkipSlow
@@ -0,0 +1,8 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2analyzer ]
deferred_transitive_import_error_test: Skip # Contains intentional errors.
io/process_exit_negative_test: Skip
+111
View File
@@ -0,0 +1,111 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should contain "$compiler == dartk" or
# "$compiler == dartkp".
fragmentation_test: Pass, Slow # GC heavy
fragmentation_typed_data_test: Pass, Slow # GC heavy
io/process_sync_test: Pass, Slow # Spawns synchronously subprocesses in sequence.
[ $compiler == dartkb ]
no_lazy_dispatchers_test: SkipByDesign # KBC interpreter doesn't support --no_lazy_dispatchers
[ $system == android ]
entrypoints_verification_test: Skip # Requires shared objects which the test script doesn't "adb push".
[ $arch == ia32 && $builder_tag == optimization_counter_threshold ]
io/file_lock_test: SkipSlow # Timeout
[ $arch == simarm64 && ($compiler == dartk || $compiler == dartkb) ]
io/http_bind_test: Slow
[ $builder_tag == optimization_counter_threshold && ($compiler == dartk || $compiler == dartkb) ]
map_insert_remove_oom_test: Skip # Heap limit too low.
[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled ]
io/raw_socket_test: Crash
io/socket_exception_test: Crash
io/socket_finalizer_test: Crash
io/socket_info_ipv4_test: Crash
io/socket_info_ipv6_test: Crash
io/socket_port_test: Crash
[ $compiler == dartkp && $runtime == dart_precompiled ]
io/compile_all_test: Skip # We do not support --compile-all for precompilation
io/http_client_connect_test: Skip # Flaky.
io/http_content_length_test: Skip # Flaky.
io/http_proxy_advanced_test: Skip # Flaky
io/http_proxy_test: Skip # Flaky.
io/http_response_deadline_test: Skip # Flaky.
io/http_reuse_server_port_test: Skip # Flaky.
io/http_server_close_response_after_error_test: Skip # Flaky.
io/http_shutdown_test: Skip # Flaky.
io/https_client_certificate_test: Crash
io/platform_test: Crash
io/raw_datagram_socket_test: Skip # Flaky.
io/raw_secure_server_closing_test: Skip # Flaky
io/raw_socket_test: Crash
io/secure_multiple_client_server_test: Skip # Flaky.
io/secure_server_closing_test: Skip # Flaky.
io/secure_server_socket_test: Skip # Flaky.
io/secure_socket_renegotiate_test: Crash
io/socket_many_connections_test: Skip # Flaky
io/web_socket_error_test: Skip # Flaky
io/web_socket_ping_test: Skip # Flaky.
io/web_socket_test: Skip # Flaky.
map_insert_remove_oom_test: Skip # Heap limit too low.
no_support_debugger_test: Skip # kernel-service snapshot not compatible with flag disabled
[ $mode == debug && $runtime == vm && ($compiler == dartk || $compiler == dartkb) ]
io/file_lock_test: Slow
io/raw_socket_test: Crash
io/socket_exception_test: Crash
io/socket_finalizer_test: Crash
io/socket_info_ipv4_test: Crash
io/socket_info_ipv6_test: Crash
io/socket_port_test: Crash
[ $mode == debug && $hot_reload && ($compiler == dartk || $compiler == dartkb) ]
io/web_socket_ping_test: Crash
[ $runtime == vm && ($compiler == dartk || $compiler == dartkb) ]
no_support_debugger_test: Skip # kernel-service snapshot not compatible with flag disabled
[ $system == windows && ($compiler == dartk || $compiler == dartkb) ]
io/dart_std_io_pipe_test: Slow
io/secure_builtin_roots_test: Skip # Issues 32137 and 32138.
io/wait_for_event_isolate_test: Skip # Issues 32137 and 32138.
map_insert_remove_oom_test: Skip # Heap limit too low.
[ $hot_reload && ($compiler == dartk || $compiler == dartkb) ]
io/http_no_reason_phrase_test: Crash
io/http_outgoing_size_test: Crash
[ $hot_reload_rollback && ($compiler == dartk || $compiler == dartkb) ]
io/directory_chdir_test: Skip # Timeout
io/echo_server_stream_test: Slow
# Enabling of dartk for sim{arm,arm64} revealed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
# batch mode.
[ ($arch == simarm || $arch == simarm64) && ($compiler == dartk || $compiler == dartkb) ]
io/file_blocking_lock_test: Crash # Please triage.
io/file_lock_test: Slow
map_insert_remove_oom_test: Skip # Heap limit too low.
[ ($compiler == dartk || $compiler == dartkb) && ($hot_reload || $hot_reload_rollback) ]
io/addlatexhash_test: Skip # Timeout
io/http_advanced_test: Skip # Timeout
io/http_auth_digest_test: Crash
io/http_auth_test: Skip # Timeout
io/http_proxy_advanced_test: Skip # Timeout
io/http_read_test: Skip # Timeout
io/pipe_server_test: Skip # Timeout
io/socket_close_test: Skip # Timeout
io/socket_many_connections_test: Skip # Timeout
io/web_socket_compression_test: Skip # Timeout
io/web_socket_test: Skip # Timeout
[ $compiler != dartk && $compiler != dartkb && $compiler != dartkp || $compiler == dartkp && $system == windows ]
entrypoints_verification_test: SkipByDesign # Requires VM to run. Cannot run in precompiled Windows because the DLL is linked against dart.exe instead of dart_precompiled_runtime.exe.
@@ -0,0 +1,68 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $builder_tag == obfuscated ]
dwarf_stack_trace_test: Pass, RuntimeError # Issue 35563
[ $runtime == dart_precompiled ]
http_launch_test: Skip
io/addlatexhash_test: Skip
io/dart_std_io_pipe_test: Skip
io/directory_list_sync_test: Timeout, Skip # Expects to find the test directory relative to the script.
io/file_blocking_lock_test: Skip
io/file_lock_test: Skip
io/file_read_special_device_test: Skip
io/http_client_stays_alive_test: Skip
io/http_response_deadline_test: Skip
io/http_server_close_response_after_error_test: Skip
io/https_unauthorized_test: Skip
io/named_pipe_script_test: Skip
io/namespace_test: Skip # Issue 33168
io/platform_resolved_executable_test: Skip
io/platform_test: RuntimeError # Expects to be running from 'dart' instead of 'dart_precompiled_runtime'
io/print_sync_test: Skip
io/process_check_arguments_test: Skip
io/process_detached_test: Skip
io/process_environment_test: Skip
io/process_inherit_stdio_test: Skip
io/process_non_ascii_test: Skip
io/process_run_output_test: Skip
io/process_set_exit_code_test: Skip
io/process_shell_test: Skip
io/process_stderr_test: Skip
io/process_stdin_transform_unsubscribe_test: Skip
io/process_stdout_test: Skip
io/process_sync_test: Skip
io/raw_datagram_socket_test: Skip
io/regress_7191_test: Skip
io/regress_7679_test: Skip
io/secure_unauthorized_test: Skip
io/signals_test: Skip
io/stdin_sync_test: Skip
io/stdio_implicit_close_test: Skip
io/stdio_nonblocking_test: Skip
io/test_extension_fail_test: Skip
io/test_extension_test: Skip
io/windows_environment_test: Skip
package/scenarios/empty_packages_file/empty_packages_file_noimports_test: Skip
package/scenarios/invalid/invalid_utf8_test: Skip
package/scenarios/invalid/non_existent_packages_file_test: Skip
package/scenarios/invalid/same_package_twice_test: Skip
package/scenarios/packages_file_strange_formatting/empty_lines_test: Skip
package/scenarios/packages_file_strange_formatting/mixed_line_ends_test: Skip
package/scenarios/packages_option_only/packages_option_only_noimports_test: Skip
package/scenarios/packages_option_only/packages_option_only_test: Skip
[ $arch == arm && $mode == release && $runtime == dart_precompiled && $system == android ]
io/socket_cancel_connect_test: RuntimeError # Issue 34142
io/stdout_stderr_non_blocking_test: Pass, Timeout # Issue 28426
[ $mode == product && $runtime == dart_precompiled ]
dwarf_stack_trace_test: Pass, RuntimeError # Results will flake due to identical code folding
[ $runtime == dart_precompiled && $checked ]
io/namespace_test: RuntimeError
[ $mode == product || $runtime == dart_precompiled ]
no_assert_test: SkipByDesign # Requires checked mode.
+79
View File
@@ -0,0 +1,79 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
[ $arch == ia32 ]
link_natives_lazily_test: SkipByDesign # Not supported.
no_allow_absolute_addresses_test: SkipByDesign # Not supported.
[ $system == android ]
io/file_stat_test: Skip # Issue 26376
io/file_system_watcher_test: Skip # Issue 26376
io/file_test: Skip # Issue 26376
io/http_proxy_advanced_test: Skip # Issue 27638
io/http_proxy_test: Skip # Issue 27638
io/https_bad_certificate_test: Skip # Issue 27638
io/https_server_test: Skip # Issue 27638
io/non_utf8_output_test: Skip # The Android command runner doesn't correctly handle non-UTF8 formatted output. https://github.com/dart-lang/sdk/issues/28872
io/process_exit_test: Skip # Issue 29578
io/process_path_environment_test: Skip # Issue 26376
io/process_path_test: Skip # Issue 26376
io/process_segfault_test: Skip # Issue 26376
io/raw_datagram_socket_test: Skip # Issue 27638
io/raw_secure_server_closing_test: Skip # Issue 27638
io/raw_secure_server_socket_test: Skip # Issue 27638
io/raw_secure_socket_pause_test: Skip # Issue 27638
io/raw_secure_socket_test: Skip # Issue 27638
io/regress_21160_test: Skip # Issue 27638
io/resolve_symbolic_links_test: Skip # Issue 26376
io/secure_bad_certificate_test: Skip # Issue 27638
io/secure_client_raw_server_test: Skip # Issue 27638
io/secure_client_server_test: Skip # Issue 27638
io/secure_multiple_client_server_test: Skip # Issue 27638
io/secure_server_client_certificate_test: Skip # Issue 27638
io/secure_server_closing_test: Skip # Issue 27638
io/secure_server_socket_test: Skip # Issue 27638
io/secure_session_resume_test: Skip # Issue 27638
io/secure_socket_alpn_test: Skip # Issue 27638
io/secure_socket_test: Skip # Issue 27638
io/socket_upgrade_to_secure_test: Skip # Issue 27638
[ $system == windows ]
io/process_sync_test: Pass, Timeout # Issue 24596
io/sleep_test: Pass, Fail # Issue 25757
io/socket_info_ipv6_test: Skip
verbose_gc_to_bmu_test: Skip
[ $arch == arm && $mode == release && $runtime == dart_precompiled && $system == android ]
io/stdout_stderr_non_blocking_test: Pass, Timeout # Issue 28426
[ $arch == x64 && $compiler == dartkb && $runtime == vm && $system == linux ]
io/stdout_stderr_non_blocking_test: Pass, Timeout # Issue 35192
[ $arch == x64 && $mode == release && $runtime == vm && $system == linux ]
io/http_bind_test: Pass, Timeout # Issue 35192
[ $compiler != dart2analyzer && $system == windows ]
io/platform_resolved_executable_test/06: RuntimeError # Issue 23641
[ $mode == release && $runtime == vm && $system == macos ]
io/http_server_close_response_after_error_test: Pass, Timeout # Issue 28370: timeout.
io/named_pipe_script_test: Pass, RuntimeError # Issue 28737
[ $mode == release && $runtime == vm && $system == windows ]
io/http_server_close_response_after_error_test: Pass, Timeout # Issue 28370: timeout.
[ $runtime == dart_precompiled && $system == linux && ($arch == simarm || $arch == simarm64 || $arch == x64) ]
io/stdout_stderr_non_blocking_test: Pass, Timeout # Issue 35192
[ $runtime == vm && ($arch == arm || $arch == arm64) ]
io/dart_std_io_pipe_test: Timeout, Pass
io/file_input_stream_test: Skip # Issue 26109
io/file_stream_test: Skip # Issue 26109
io/file_typed_data_test: Skip # Issue 26109
io/process_sync_test: Timeout, Pass
[ $runtime == vm && ($arch == simarm || $arch == simarm64) ]
io/dart_std_io_pipe_test: Timeout, Pass
io/http_client_stays_alive_test: Skip # Spawns process in Dart2 mode.
io/process_sync_test: Timeout, Pass