mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:48:25 +00:00
Migrate test block 9 to Dart 2.0
Deleted http_resource_test – the associated classes no longer exist Deleted int_fromEnvironment3 - validated type semantics Tweaked hash_set_type_check – made it very simple. Also tweaked some analyzer hints R=rnystrom@google.com Review-Url: https://codereview.chromium.org/2990623002 .
This commit is contained in:
parent
edfb6d02bf
commit
c347b0ed16
|
@ -8,9 +8,6 @@
|
|||
[ $compiler == none && $runtime == drt ]
|
||||
from_environment_const_type_test: Skip
|
||||
from_environment_const_type_undefined_test: Skip
|
||||
int_from_environment2_test: Skip
|
||||
int_from_environment3_test: Skip
|
||||
int_from_environment_test: Skip
|
||||
|
||||
[ $compiler == none || $compiler == precompiler || $compiler == app_jit ]
|
||||
string_case_test/01: Fail # Bug 18061
|
||||
|
@ -19,8 +16,6 @@ string_case_test/01: Fail # Bug 18061
|
|||
int_parse_radix_test/01: Pass, Fail # JS implementations disagree on U+0085 being whitespace.
|
||||
int_parse_radix_test/02: Fail # No bigints.
|
||||
integer_to_radix_string_test: RuntimeError # issue 22045
|
||||
int_modulo_arith_test/bignum: RuntimeError # No bigints.
|
||||
int_modulo_arith_test/modPow: RuntimeError # No bigints.
|
||||
list_unmodifiable_test: Pass, RuntimeError # Issue 28712
|
||||
|
||||
[ $runtime == safari || $runtime == safarimobilesim ]
|
||||
|
@ -34,7 +29,6 @@ double_round_to_double2_test: Pass, Fail, OK # Fails on ff 34, passes on ff 35.
|
|||
|
||||
[ $compiler == dart2js && ! $dart2js_with_kernel ]
|
||||
error_stack_trace1_test: RuntimeError # Issue 12399
|
||||
hash_set_test/01: RuntimeError # Issue 11551
|
||||
integer_to_string_test/01: RuntimeError # Issue 1533
|
||||
iterable_return_type_test/01: RuntimeError # Issue 20085
|
||||
iterable_return_type_test/02: RuntimeError # Dart2js does not support Uint64*.
|
||||
|
@ -70,7 +64,6 @@ from_environment_const_type_undefined_test/16: CompileTimeError
|
|||
|
||||
[ $compiler == dart2analyzer ]
|
||||
int_parse_radix_bad_handler_test: fail
|
||||
hash_set_type_check_test: StaticWarning, OK # Tests failing type tests.
|
||||
error_stack_trace_test: StaticWarning, OK # Test generates errors on purpose.
|
||||
iterable_element_at_test: StaticWarning, OK # Test generates errors on purpose.
|
||||
num_clamp_test: StaticWarning, OK # Test generates errors on purpose.
|
||||
|
@ -122,11 +115,6 @@ regexp/pcre_test: RuntimeError # Issue 27394
|
|||
regress/4562_test/01: Crash # Issue 27394
|
||||
|
||||
[ ($compiler == dartk || $compiler == dartkp) && ($runtime == vm || $runtime == dart_precompiled) ]
|
||||
int_from_environment3_test/01: MissingCompileTimeError
|
||||
int_from_environment3_test/02: MissingCompileTimeError
|
||||
int_from_environment3_test/03: MissingCompileTimeError
|
||||
int_from_environment3_test/04: MissingCompileTimeError
|
||||
int_from_environment3_test/05: MissingCompileTimeError
|
||||
string_case_test/01: RuntimeError
|
||||
string_from_environment3_test/01: MissingCompileTimeError
|
||||
string_from_environment3_test/02: MissingCompileTimeError
|
||||
|
@ -169,21 +157,6 @@ for_in_test: Crash
|
|||
growable_list_test: Crash
|
||||
has_next_iterator_test: Crash
|
||||
hash_map2_test: Crash
|
||||
hash_set_test/01: Crash
|
||||
hash_set_test/none: Crash
|
||||
hash_set_type_check_test: Crash
|
||||
hashcode_test: Crash
|
||||
hidden_library2_test/01: Crash
|
||||
hidden_library2_test/none: Crash
|
||||
indexed_list_access_test: Crash
|
||||
int_from_environment3_test/01: MissingCompileTimeError
|
||||
int_from_environment3_test/02: MissingCompileTimeError
|
||||
int_from_environment3_test/03: MissingCompileTimeError
|
||||
int_from_environment3_test/04: MissingCompileTimeError
|
||||
int_from_environment3_test/05: Crash
|
||||
int_modulo_arith_test/bignum: Crash
|
||||
int_modulo_arith_test/modPow: Crash
|
||||
int_modulo_arith_test/none: Crash
|
||||
int_parse_radix_bad_handler_test: Crash
|
||||
int_parse_radix_test/01: Crash
|
||||
int_parse_radix_test/02: Crash
|
||||
|
@ -370,7 +343,6 @@ symbol_test/03: Crash
|
|||
symbol_test/none: Crash
|
||||
|
||||
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
|
||||
hash_map_test: Crash
|
||||
list_sort_test: Crash
|
||||
map_contains_key_test: Crash
|
||||
map_index_test: Crash
|
||||
|
@ -425,14 +397,6 @@ from_environment_const_type_undefined_test/14: Crash
|
|||
from_environment_const_type_undefined_test/15: Crash
|
||||
from_environment_const_type_undefined_test/16: Crash
|
||||
from_environment_const_type_undefined_test/none: Crash
|
||||
hash_map_test: Crash
|
||||
hashcode_boxed_test: Crash
|
||||
int_ceil_test: Crash
|
||||
int_ceil_to_double_test: Crash
|
||||
int_floor_test: Crash
|
||||
int_floor_to_double_test: Crash
|
||||
int_from_environment2_test: Crash
|
||||
int_from_environment_test: Crash
|
||||
int_round_test: Crash
|
||||
int_round_to_double_test: Crash
|
||||
int_to_int_test: Crash
|
||||
|
@ -527,8 +491,6 @@ from_environment_const_type_undefined_test/08: MissingCompileTimeError
|
|||
|
||||
# Possible bugs
|
||||
format_exception_test: RuntimeError # Flutter Issue 9111
|
||||
int_from_environment_test: Fail # Flutter Issue 9111
|
||||
int_from_environment2_test: Fail # Flutter Issue 9111
|
||||
from_environment_const_type_test/none: Fail # Flutter Issue 9111
|
||||
from_environment_const_type_test/01: Fail # Flutter Issue 9111
|
||||
from_environment_const_type_test/05: Fail # Flutter Issue 9111
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
// 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 Override {
|
||||
int hash;
|
||||
int get superHash => super.hashCode;
|
||||
int get hashCode => hash;
|
||||
|
||||
int foo() => hash; // Just some function that can be closurized.
|
||||
|
||||
bool operator ==(Object other) =>
|
||||
other is Override && (other as Override).hash == hash;
|
||||
}
|
||||
|
||||
int bar() => 42; // Some global function.
|
||||
|
||||
main() {
|
||||
var o = new Object();
|
||||
var hash = o.hashCode;
|
||||
// Doesn't change.
|
||||
Expect.equals(hash, o.hashCode);
|
||||
Expect.equals(hash, identityHashCode(o));
|
||||
|
||||
var c = new Override();
|
||||
int identityHash = c.superHash;
|
||||
hash = (identityHash == 42) ? 37 : 42;
|
||||
c.hash = hash;
|
||||
Expect.equals(hash, c.hashCode);
|
||||
Expect.equals(identityHash, identityHashCode(c));
|
||||
|
||||
// These classes don't override hashCode.
|
||||
var samples = [0, 0x10000000, 1.5, -0, null, true, false, const Object()];
|
||||
for (var v in samples) {
|
||||
print(v);
|
||||
Expect.equals(v.hashCode, identityHashCode(v));
|
||||
}
|
||||
// These do, or might do, but we can still use hashCodeOf and get the same
|
||||
// result each time.
|
||||
samples = ["string", "", (x) => 42, c.foo, bar];
|
||||
for (var v in samples) {
|
||||
print(v);
|
||||
Expect.equals(v.hashCode, v.hashCode);
|
||||
Expect.equals(identityHashCode(v), identityHashCode(v));
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// 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.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// Check that indexed access to lists throws correct exception if index
|
||||
// is not int.
|
||||
|
||||
main() {
|
||||
checkList(new List(10));
|
||||
var growable = new List();
|
||||
growable.add(1);
|
||||
growable.add(1);
|
||||
checkList(growable);
|
||||
}
|
||||
|
||||
checkList(var list) {
|
||||
// Check unoptimized.
|
||||
Expect.isFalse(checkCatch(getIt, list, 1));
|
||||
Expect.isTrue(checkCatch(getIt, list, "hi"));
|
||||
Expect.isFalse(checkCatch(putIt, list, 1));
|
||||
Expect.isTrue(checkCatch(putIt, list, "hi"));
|
||||
// Optimize 'getIt' and 'putIt'.
|
||||
for (int i = 0; i < 2000; i++) {
|
||||
putIt(list, 1);
|
||||
getIt(list, 1);
|
||||
}
|
||||
Expect.isTrue(checkCatch(getIt, list, "hi"));
|
||||
Expect.isTrue(checkCatch(putIt, list, "hi"));
|
||||
}
|
||||
|
||||
checkCatch(var f, var list, var index) {
|
||||
try {
|
||||
f(list, index);
|
||||
} on ArgumentError catch (e) {
|
||||
return true;
|
||||
} on TypeError catch (t) {
|
||||
return true; // thrown in type checked mode.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getIt(var a, var i) {
|
||||
return a[i];
|
||||
}
|
||||
|
||||
putIt(var a, var i) {
|
||||
a[i] = null;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// 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.
|
||||
|
||||
main() {
|
||||
const int.fromEnvironment('NOT_FOUND', defaultValue: ''); // //# 01: compile-time error
|
||||
const int.fromEnvironment('NOT_FOUND', defaultValue: true); // //# 02: compile-time error
|
||||
const int.fromEnvironment(null); // //# 03: compile-time error
|
||||
const int.fromEnvironment(1); // //# 04: compile-time error
|
||||
const int.fromEnvironment([]); // //# 05: compile-time error
|
||||
}
|
|
@ -72,6 +72,10 @@ big_integer_parsed_div_rem_vm_test: RuntimeError # Issue 29921
|
|||
big_integer_parsed_mul_div_vm_test: RuntimeError # Issue 29921
|
||||
bit_twiddling_bigint_test: RuntimeError # Required bigint support.
|
||||
compare_to2_test: RuntimeError, OK # Requires bigint support.
|
||||
hash_set_test/01: RuntimeError # Issue 11551
|
||||
int_modulo_arith_test/bignum: RuntimeError # Issue 29921
|
||||
int_modulo_arith_test/modPow: RuntimeError # Issue 29921
|
||||
int_modulo_arith_test/none: RuntimeError # Issue 29921
|
||||
|
||||
[ $compiler == dart2js && $runtime == drt && $csp && $minified ]
|
||||
core_runtime_types_test: Pass, Fail # Issue 27913
|
||||
|
@ -79,6 +83,8 @@ core_runtime_types_test: Pass, Fail # Issue 27913
|
|||
[ $runtime == flutter ]
|
||||
apply3_test: CompileTimeError # mirrors not supported
|
||||
bool_from_environment_test: Fail # Flutter Issue 9111
|
||||
int_from_environment_test: Fail # Flutter Issue 9111
|
||||
int_from_environment2_test: Fail # Flutter Issue 9111
|
||||
string_trimlr_test/02: RuntimeError # Flutter Issue 9111
|
||||
string_from_environment_test: Fail # Flutter Issue 9111
|
||||
string_from_environment2_test: Fail # Flutter Issue 9111
|
||||
|
@ -257,6 +263,20 @@ date_time4_test: Crash
|
|||
date_time7_test: Crash
|
||||
date_time_parse_test: Crash
|
||||
date_time_test: Crash
|
||||
hash_set_test/01: Crash
|
||||
hash_set_test/none: Crash
|
||||
hash_set_type_check_test: RuntimeError
|
||||
hashcode_test: Crash
|
||||
hidden_library2_test/01: Crash
|
||||
hidden_library2_test/none: Crash
|
||||
int_from_environment3_test/01: MissingCompileTimeError
|
||||
int_from_environment3_test/02: MissingCompileTimeError
|
||||
int_from_environment3_test/03: MissingCompileTimeError
|
||||
int_from_environment3_test/04: MissingCompileTimeError
|
||||
int_from_environment3_test/05: Crash
|
||||
int_modulo_arith_test/bignum: Crash
|
||||
int_modulo_arith_test/modPow: Crash
|
||||
int_modulo_arith_test/none: Crash
|
||||
stacktrace_fromstring_test: Crash
|
||||
stopwatch2_test: Crash
|
||||
string_base_vm_test: Crash
|
||||
|
|
|
@ -301,7 +301,7 @@ void testIdentitySet(Set create()) {
|
|||
// All compile time constants are identical to themselves.
|
||||
var constants = [
|
||||
double.INFINITY,
|
||||
double.NAN, -0.0, //# 01: ok
|
||||
double.NAN, -0.0, //# 01: ok
|
||||
0.0, 42, "", null, false, true, #bif, testIdentitySet
|
||||
];
|
||||
set.addAll(constants);
|
|
@ -9,39 +9,22 @@ library hash_set_type_check_test;
|
|||
import "package:expect/expect.dart";
|
||||
import 'dart:collection';
|
||||
|
||||
// TODO: all this test does now is verify that lookup takes a non-T
|
||||
// should merge this with `hash_test_test`.
|
||||
testSet(Set<String> newSet()) {
|
||||
Set<String> s = newSet();
|
||||
Expect.throws(() => s.add(1), (e) => e is Error);
|
||||
Expect.isNull(s.lookup(1));
|
||||
}
|
||||
|
||||
void testIdentitySet(Set create()) {
|
||||
Set<String> s = create();
|
||||
Expect.throws(() => s.add(1), (e) => e is Error);
|
||||
Expect.isNull(s.lookup(1));
|
||||
}
|
||||
|
||||
bool get inCheckedMode {
|
||||
try {
|
||||
var i = 1;
|
||||
String j = i;
|
||||
} catch (_) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void main() {
|
||||
if (!inCheckedMode) return;
|
||||
|
||||
testSet(() => new Set<String>());
|
||||
testSet(() => new HashSet<String>());
|
||||
testSet(() => new LinkedHashSet<String>());
|
||||
testIdentitySet(() => new Set<String>.identity());
|
||||
testIdentitySet(() => new HashSet<String>.identity());
|
||||
testIdentitySet(() => new LinkedHashSet<String>.identity());
|
||||
testIdentitySet(() => new HashSet<String>(
|
||||
testSet(() => new Set<String>.identity());
|
||||
testSet(() => new HashSet<String>.identity());
|
||||
testSet(() => new LinkedHashSet<String>.identity());
|
||||
testSet(() => new HashSet<String>(
|
||||
equals: (x, y) => identical(x, y), hashCode: (x) => identityHashCode(x)));
|
||||
testIdentitySet(() => new LinkedHashSet<String>(
|
||||
testSet(() => new LinkedHashSet<String>(
|
||||
equals: (x, y) => identical(x, y), hashCode: (x) => identityHashCode(x)));
|
||||
}
|
|
@ -11,8 +11,7 @@ class Override {
|
|||
|
||||
int foo() => hash; // Just some function that can be closurized.
|
||||
|
||||
bool operator ==(Object other) =>
|
||||
other is Override && (other as Override).hash == hash;
|
||||
bool operator ==(Object other) => other is Override && other.hash == hash;
|
||||
}
|
||||
|
||||
int bar() => 42; // Some global function.
|
|
@ -14,9 +14,7 @@ file_resource_test: Skip
|
|||
from_environment_const_type_test: Skip
|
||||
from_environment_const_type_undefined_test: Skip
|
||||
growable_list_test: Skip
|
||||
hash_set_type_check_test: Skip
|
||||
http_resource_test: Skip
|
||||
int_from_environment3_test: Skip
|
||||
iterable_contains2_test: Skip
|
||||
iterable_element_at_test: Skip
|
||||
iterable_fold_test: Skip
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
// 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=
|
||||
// VMOptions=--use_internal_hash_map
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// Test program for the HashMap class.
|
||||
|
||||
class HashMapTest {
|
||||
static testMain() {
|
||||
var m = new Map();
|
||||
Expect.equals(0, m.length);
|
||||
Expect.equals(true, m.isEmpty);
|
||||
m["one"] = 1;
|
||||
Expect.equals(1, m.length);
|
||||
Expect.equals(false, m.isEmpty);
|
||||
Expect.equals(1, m["one"]);
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
HashMapTest.testMain();
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
// 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.
|
||||
|
||||
// Tests of hash set type checking.
|
||||
|
||||
library hash_set_type_check_test;
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import 'dart:collection';
|
||||
|
||||
testSet(Set<String> newSet()) {
|
||||
Set<String> s = newSet();
|
||||
Expect.throws(() => s.add(1), (e) => e is Error);
|
||||
Expect.isNull(s.lookup(1));
|
||||
}
|
||||
|
||||
void testIdentitySet(Set create()) {
|
||||
Set<String> s = create();
|
||||
Expect.throws(() => s.add(1), (e) => e is Error);
|
||||
Expect.isNull(s.lookup(1));
|
||||
}
|
||||
|
||||
bool get inCheckedMode {
|
||||
try {
|
||||
var i = 1;
|
||||
String j = i;
|
||||
} catch (_) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void main() {
|
||||
if (!inCheckedMode) return;
|
||||
|
||||
testSet(() => new Set<String>());
|
||||
testSet(() => new HashSet<String>());
|
||||
testSet(() => new LinkedHashSet<String>());
|
||||
testIdentitySet(() => new Set<String>.identity());
|
||||
testIdentitySet(() => new HashSet<String>.identity());
|
||||
testIdentitySet(() => new LinkedHashSet<String>.identity());
|
||||
testIdentitySet(() => new HashSet<String>(
|
||||
equals: (x, y) => identical(x, y), hashCode: (x) => identityHashCode(x)));
|
||||
testIdentitySet(() => new LinkedHashSet<String>(
|
||||
equals: (x, y) => identical(x, y), hashCode: (x) => identityHashCode(x)));
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
// 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";
|
||||
|
||||
double fib(double n) {
|
||||
return n <= 1.0 ? 1.0 : fib(n - 1) + fib(n - 2);
|
||||
}
|
||||
|
||||
main() {
|
||||
// Compute the same value in a way that won't be optimized away so the results
|
||||
// are different objects in memory.
|
||||
var a = fib(5.0) + 1.0;
|
||||
var b = fib(4.0) + 4.0;
|
||||
|
||||
Expect.isTrue(identical(a, b));
|
||||
Expect.equals(identityHashCode(a), identityHashCode(b));
|
||||
Expect.equals(a, b);
|
||||
Expect.equals(a.hashCode, b.hashCode);
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// 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 the internal hidden library doesn't make problems with taking
|
||||
// stack-traces.
|
||||
|
||||
main() {
|
||||
print(['x'].where((_) {
|
||||
// We actually don't really care for the successful case. We just want to
|
||||
// make sure that the test doesn't crash when it is negative.
|
||||
throw 'fisk'; // //# 01: runtime error
|
||||
return true;
|
||||
}).toList());
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
// 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 "dart:io";
|
||||
|
||||
const sampleText = "Sample text file.";
|
||||
|
||||
main() async {
|
||||
var server = await startServer();
|
||||
var uriText = "http://localhost:${server.port}/sample.txt?query#fragment";
|
||||
var resource = new Resource(uriText);
|
||||
|
||||
if (resource.uri != Uri.parse(uriText)) {
|
||||
throw "Incorrect URI: ${resource.uri}";
|
||||
}
|
||||
|
||||
var text = await resource.readAsString();
|
||||
if (text != sampleText) {
|
||||
throw "Incorrect reading of text file: $text";
|
||||
}
|
||||
|
||||
var bytes = await resource.readAsBytes();
|
||||
if (!compareBytes(bytes, sampleText.codeUnits)) {
|
||||
throw "Incorrect reading of bytes: $bytes";
|
||||
}
|
||||
|
||||
var streamBytes = [];
|
||||
await for (var byteSlice in resource.openRead()) {
|
||||
streamBytes.addAll(byteSlice);
|
||||
}
|
||||
if (!compareBytes(streamBytes, sampleText.codeUnits)) {
|
||||
throw "Incorrect reading of bytes: $bytes";
|
||||
}
|
||||
|
||||
await server.close();
|
||||
}
|
||||
|
||||
/// Checks that [bytes] and [expectedBytes] have the same contents.
|
||||
bool compareBytes(bytes, expectedBytes) {
|
||||
if (bytes.length != expectedBytes.length) return false;
|
||||
for (int i = 0; i < expectedBytes.length; i++) {
|
||||
if (bytes[i] != expectedBytes[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
startServer() async {
|
||||
var server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0);
|
||||
var expectedUri = new Uri(path: "/sample.txt", query: "query");
|
||||
server.forEach((request) async {
|
||||
await request.drain();
|
||||
var response = request.response;
|
||||
if (request.uri == expectedUri) {
|
||||
response.write(sampleText);
|
||||
} else {
|
||||
response.write("INCORRECT PATH!: ${request.uri}");
|
||||
}
|
||||
response.close();
|
||||
});
|
||||
return server;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// 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.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// Check that indexed access to lists throws correct exception if index
|
||||
// is not int.
|
||||
|
||||
main() {
|
||||
checkList(new List(10));
|
||||
var growable = new List();
|
||||
growable.add(1);
|
||||
growable.add(1);
|
||||
checkList(growable);
|
||||
}
|
||||
|
||||
checkList(var list) {
|
||||
// Check unoptimized.
|
||||
Expect.isFalse(checkCatch(getIt, list, 1));
|
||||
Expect.isTrue(checkCatch(getIt, list, "hi"));
|
||||
Expect.isFalse(checkCatch(putIt, list, 1));
|
||||
Expect.isTrue(checkCatch(putIt, list, "hi"));
|
||||
// Optimize 'getIt' and 'putIt'.
|
||||
for (int i = 0; i < 2000; i++) {
|
||||
putIt(list, 1);
|
||||
getIt(list, 1);
|
||||
}
|
||||
Expect.isTrue(checkCatch(getIt, list, "hi"));
|
||||
Expect.isTrue(checkCatch(putIt, list, "hi"));
|
||||
}
|
||||
|
||||
checkCatch(var f, var list, var index) {
|
||||
try {
|
||||
f(list, index);
|
||||
} on ArgumentError catch (e) {
|
||||
return true;
|
||||
} on TypeError catch (t) {
|
||||
return true; // thrown in type checked mode.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getIt(var a, var i) {
|
||||
return a[i];
|
||||
}
|
||||
|
||||
putIt(var a, var i) {
|
||||
a[i] = null;
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// 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';
|
||||
|
||||
main() {
|
||||
Expect.equals(0, 0.ceil());
|
||||
Expect.equals(1, 1.ceil());
|
||||
Expect.equals(0x1234, 0x1234.ceil());
|
||||
Expect.equals(0x12345678, 0x12345678.ceil());
|
||||
Expect.equals(0x123456789AB, 0x123456789AB.ceil());
|
||||
Expect.equals(0x123456789ABCDEF, 0x123456789ABCDEF.ceil());
|
||||
Expect.equals(0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF,
|
||||
0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.ceil());
|
||||
Expect.equals(-1, -1.ceil());
|
||||
Expect.equals(-0x1234, -0x1234.ceil());
|
||||
Expect.equals(-0x12345678, -0x12345678.ceil());
|
||||
Expect.equals(-0x123456789AB, -0x123456789AB.ceil());
|
||||
Expect.equals(-0x123456789ABCDEF, -0x123456789ABCDEF.ceil());
|
||||
Expect.equals(-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF,
|
||||
-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.ceil());
|
||||
|
||||
Expect.isTrue(0.ceil() is int);
|
||||
Expect.isTrue(1.ceil() is int);
|
||||
Expect.isTrue(0x1234.ceil() is int);
|
||||
Expect.isTrue(0x12345678.ceil() is int);
|
||||
Expect.isTrue(0x123456789AB.ceil() is int);
|
||||
Expect.isTrue(0x123456789ABCDEF.ceil() is int);
|
||||
Expect
|
||||
.isTrue(0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.ceil() is int);
|
||||
Expect.isTrue(-1.ceil() is int);
|
||||
Expect.isTrue(-0x1234.ceil() is int);
|
||||
Expect.isTrue(-0x12345678.ceil() is int);
|
||||
Expect.isTrue(-0x123456789AB.ceil() is int);
|
||||
Expect.isTrue(-0x123456789ABCDEF.ceil() is int);
|
||||
Expect
|
||||
.isTrue(-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.ceil() is int);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// 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';
|
||||
|
||||
main() {
|
||||
Expect.equals(0.0, 0.ceilToDouble());
|
||||
Expect.equals(1.0, 1.ceilToDouble());
|
||||
Expect.equals(0x1234, 0x1234.ceilToDouble());
|
||||
Expect.equals(0x12345678, 0x12345678.ceilToDouble());
|
||||
Expect.equals(0x123456789AB, 0x123456789AB.ceilToDouble());
|
||||
Expect.equals(81985529216486900.0, 0x123456789ABCDEF.ceilToDouble());
|
||||
Expect.equals(2.7898229935051914e+55,
|
||||
0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.ceilToDouble());
|
||||
Expect.equals(-1.0, -1.ceilToDouble());
|
||||
Expect.equals(-0x1234, -0x1234.ceilToDouble());
|
||||
Expect.equals(-0x12345678, -0x12345678.ceilToDouble());
|
||||
Expect.equals(-0x123456789AB, -0x123456789AB.ceilToDouble());
|
||||
Expect.equals(-81985529216486900.0, -0x123456789ABCDEF.ceilToDouble());
|
||||
Expect.equals(-2.7898229935051914e+55,
|
||||
-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.ceilToDouble());
|
||||
|
||||
Expect.isTrue(0.ceilToDouble() is double);
|
||||
Expect.isTrue(1.ceilToDouble() is double);
|
||||
Expect.isTrue(0x1234.ceilToDouble() is double);
|
||||
Expect.isTrue(0x12345678.ceilToDouble() is double);
|
||||
Expect.isTrue(0x123456789AB.ceilToDouble() is double);
|
||||
Expect.isTrue(0x123456789ABCDEF.ceilToDouble() is double);
|
||||
Expect.isTrue(0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.ceilToDouble()
|
||||
is double);
|
||||
Expect.isTrue(-1.ceilToDouble() is double);
|
||||
Expect.isTrue(-0x1234.ceilToDouble() is double);
|
||||
Expect.isTrue(-0x12345678.ceilToDouble() is double);
|
||||
Expect.isTrue(-0x123456789AB.ceilToDouble() is double);
|
||||
Expect.isTrue(-0x123456789ABCDEF.ceilToDouble() is double);
|
||||
Expect.isTrue(-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
|
||||
.ceilToDouble() is double);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// 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';
|
||||
|
||||
main() {
|
||||
Expect.equals(0, 0.floor());
|
||||
Expect.equals(1, 1.floor());
|
||||
Expect.equals(0x1234, 0x1234.floor());
|
||||
Expect.equals(0x12345678, 0x12345678.floor());
|
||||
Expect.equals(0x123456789AB, 0x123456789AB.floor());
|
||||
Expect.equals(0x123456789ABCDEF, 0x123456789ABCDEF.floor());
|
||||
Expect.equals(0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF,
|
||||
0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.floor());
|
||||
Expect.equals(-1, -1.floor());
|
||||
Expect.equals(-0x1234, -0x1234.floor());
|
||||
Expect.equals(-0x12345678, -0x12345678.floor());
|
||||
Expect.equals(-0x123456789AB, -0x123456789AB.floor());
|
||||
Expect.equals(-0x123456789ABCDEF, -0x123456789ABCDEF.floor());
|
||||
Expect.equals(-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF,
|
||||
-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.floor());
|
||||
|
||||
Expect.isTrue(0.floor() is int);
|
||||
Expect.isTrue(1.floor() is int);
|
||||
Expect.isTrue(0x1234.floor() is int);
|
||||
Expect.isTrue(0x12345678.floor() is int);
|
||||
Expect.isTrue(0x123456789AB.floor() is int);
|
||||
Expect.isTrue(0x123456789ABCDEF.floor() is int);
|
||||
Expect
|
||||
.isTrue(0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.floor() is int);
|
||||
Expect.isTrue(-1.floor() is int);
|
||||
Expect.isTrue(-0x1234.floor() is int);
|
||||
Expect.isTrue(-0x12345678.floor() is int);
|
||||
Expect.isTrue(-0x123456789AB.floor() is int);
|
||||
Expect.isTrue(-0x123456789ABCDEF.floor() is int);
|
||||
Expect.isTrue(
|
||||
-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.floor() is int);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// 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';
|
||||
|
||||
main() {
|
||||
Expect.equals(0.0, 0.floorToDouble());
|
||||
Expect.equals(1.0, 1.floorToDouble());
|
||||
Expect.equals(0x1234, 0x1234.floorToDouble());
|
||||
Expect.equals(0x12345678, 0x12345678.floorToDouble());
|
||||
Expect.equals(0x123456789AB, 0x123456789AB.floorToDouble());
|
||||
Expect.equals(81985529216486900.0, 0x123456789ABCDEF.floorToDouble());
|
||||
Expect.equals(2.7898229935051914e+55,
|
||||
0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.floorToDouble());
|
||||
Expect.equals(-1.0, -1.floorToDouble());
|
||||
Expect.equals(-0x1234, -0x1234.floorToDouble());
|
||||
Expect.equals(-0x12345678, -0x12345678.floorToDouble());
|
||||
Expect.equals(-0x123456789AB, -0x123456789AB.floorToDouble());
|
||||
Expect.equals(-81985529216486900.0, -0x123456789ABCDEF.floorToDouble());
|
||||
Expect.equals(-2.7898229935051914e+55,
|
||||
-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF.floorToDouble());
|
||||
|
||||
Expect.isTrue(0.floorToDouble() is double);
|
||||
Expect.isTrue(1.floorToDouble() is double);
|
||||
Expect.isTrue(0x1234.floorToDouble() is double);
|
||||
Expect.isTrue(0x12345678.floorToDouble() is double);
|
||||
Expect.isTrue(0x123456789AB.floorToDouble() is double);
|
||||
Expect.isTrue(0x123456789ABCDEF.floorToDouble() is double);
|
||||
Expect.isTrue(0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
|
||||
.floorToDouble() is double);
|
||||
Expect.isTrue(-1.floorToDouble() is double);
|
||||
Expect.isTrue(-0x1234.floorToDouble() is double);
|
||||
Expect.isTrue(-0x12345678.floorToDouble() is double);
|
||||
Expect.isTrue(-0x123456789AB.floorToDouble() is double);
|
||||
Expect.isTrue(-0x123456789ABCDEF.floorToDouble() is double);
|
||||
Expect.isTrue(-0x123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
|
||||
.floorToDouble() is double);
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
// 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.
|
||||
// SharedOptions=-Da=x -Db=- -Dc=0xg -Dd=+ -Dd=
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
main() {
|
||||
Expect.isNull(const int.fromEnvironment('a'));
|
||||
Expect.isNull(const int.fromEnvironment('b'));
|
||||
Expect.isNull(const int.fromEnvironment('c'));
|
||||
Expect.isNull(const int.fromEnvironment('d'));
|
||||
Expect.isNull(const int.fromEnvironment('e'));
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// 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.
|
||||
|
||||
main() {
|
||||
const int.fromEnvironment('NOT_FOUND', defaultValue: ''); // //# 01: compile-time error
|
||||
const int.fromEnvironment('NOT_FOUND', defaultValue: true); // //# 02: compile-time error
|
||||
const int.fromEnvironment(null); // //# 03: compile-time error
|
||||
const int.fromEnvironment(1); // //# 04: compile-time error
|
||||
const int.fromEnvironment([]); // //# 05: compile-time error
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// 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.
|
||||
// SharedOptions=-Da=1 -Db=-12 -Dc=0x123 -Dd=-0x1234 -De=+0x112296 -Df=99999999999999999999
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
main() {
|
||||
Expect.equals(1, const int.fromEnvironment('a'));
|
||||
Expect.equals(-12, const int.fromEnvironment('b'));
|
||||
Expect.equals(0x123, const int.fromEnvironment('c'));
|
||||
Expect.equals(-0x1234, const int.fromEnvironment('d'));
|
||||
Expect.equals(0x112296, const int.fromEnvironment('e'));
|
||||
Expect.equals(99999999999999999999, const int.fromEnvironment('f'));
|
||||
}
|
|
@ -1,197 +0,0 @@
|
|||
// 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";
|
||||
|
||||
import "dart:math" show pow;
|
||||
|
||||
var smallNumber = 1234567890; // is 31-bit integer.
|
||||
var mediumNumber = 1234567890123456; // is 53-bit integer
|
||||
var bigNumber = 590295810358705600000; // is > 64-bit integer, exact as double.
|
||||
|
||||
testModPow() {
|
||||
test(x, e, m, expectedResult) {
|
||||
// Check that expected result is correct, using an unoptimized version.
|
||||
assert(() {
|
||||
if (1 is double) return true; // Don't have bignums.
|
||||
slowModPow(x, e, m) {
|
||||
var r = 1;
|
||||
while (e > 0) {
|
||||
if (e.isOdd) r = (r * x) % m;
|
||||
e >>= 1;
|
||||
x = (x * x) % m;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
return slowModPow(x, e, m) == expectedResult;
|
||||
});
|
||||
var result = x.modPow(e, m);
|
||||
Expect.equals(expectedResult, result, "$x.modPow($e, $m)");
|
||||
}
|
||||
|
||||
test(10, 20, 1, 0);
|
||||
test(1234567890, 1000000001, 19, 11);
|
||||
test(1234567890, 19, 1000000001, 122998977);
|
||||
test(19, 1234567890, 1000000001, 619059596);
|
||||
test(19, 1000000001, 1234567890, 84910879);
|
||||
test(1000000001, 19, 1234567890, 872984351);
|
||||
test(1000000001, 1234567890, 19, 0);
|
||||
test(12345678901234567890, 10000000000000000001, 19, 2);
|
||||
test(12345678901234567890, 19, 10000000000000000001, 3239137215315834625);
|
||||
test(19, 12345678901234567890, 10000000000000000001, 4544207837373941034);
|
||||
test(19, 10000000000000000001, 12345678901234567890, 11135411705397624859);
|
||||
test(10000000000000000001, 19, 12345678901234567890, 2034013733189773841);
|
||||
test(10000000000000000001, 12345678901234567890, 19, 1);
|
||||
test(12345678901234567890, 19, 10000000000000000001, 3239137215315834625);
|
||||
test(12345678901234567890, 10000000000000000001, 19, 2);
|
||||
test(123456789012345678901234567890, 123456789012345678901234567891,
|
||||
123456789012345678901234567899, 116401406051033429924651549616);
|
||||
test(123456789012345678901234567890, 123456789012345678901234567899,
|
||||
123456789012345678901234567891, 123456789012345678901234567890);
|
||||
test(123456789012345678901234567899, 123456789012345678901234567890,
|
||||
123456789012345678901234567891, 35088523091000351053091545070);
|
||||
test(123456789012345678901234567899, 123456789012345678901234567891,
|
||||
123456789012345678901234567890, 18310047270234132455316941949);
|
||||
test(123456789012345678901234567891, 123456789012345678901234567899,
|
||||
123456789012345678901234567890, 1);
|
||||
test(123456789012345678901234567891, 123456789012345678901234567890,
|
||||
123456789012345678901234567899, 40128068573873018143207285483);
|
||||
}
|
||||
|
||||
testModInverse() {
|
||||
test(x, m, expectedResult) {
|
||||
//print("$x op $m == $expectedResult");
|
||||
// Check that expectedResult is an inverse.
|
||||
assert(expectedResult < m);
|
||||
// The 1 % m handles the m = 1 special case.
|
||||
// This test may overflow if we don't have bignums, so only run on VM.
|
||||
assert(1 is double || (((x % m) * expectedResult) - 1) % m == 0);
|
||||
|
||||
var result = x.modInverse(m);
|
||||
Expect.equals(expectedResult, result, "$x modinv $m");
|
||||
|
||||
if (x > m) {
|
||||
x = x % m;
|
||||
var result = x.modInverse(m);
|
||||
Expect.equals(expectedResult, result, "$x modinv $m");
|
||||
}
|
||||
}
|
||||
|
||||
testThrows(x, m) {
|
||||
// Throws if not co-prime, which is a symmetric property.
|
||||
Expect.throws(() => x.modInverse(m), null, "$x modinv $m");
|
||||
Expect.throws(() => m.modInverse(x), null, "$m modinv $x");
|
||||
}
|
||||
|
||||
test(1, 1, 0);
|
||||
|
||||
testThrows(0, 1000000001);
|
||||
testThrows(2, 4);
|
||||
testThrows(99, 9);
|
||||
testThrows(19, 1000000001);
|
||||
testThrows(123456789012345678901234567890, 123456789012345678901234567899);
|
||||
|
||||
// Co-prime numbers
|
||||
test(1234567890, 19, 11);
|
||||
test(1234567890, 1000000001, 189108911);
|
||||
test(19, 1234567890, 519818059);
|
||||
test(1000000001, 1234567890, 1001100101);
|
||||
|
||||
test(12345, 12346, 12345);
|
||||
test(12345, 12346, 12345);
|
||||
|
||||
test(smallNumber, 137, 42);
|
||||
test(137, smallNumber, 856087223);
|
||||
test(mediumNumber, 137, 77);
|
||||
test(137, mediumNumber, 540686667207353);
|
||||
test(bigNumber, 137, 128); // //# bignum: ok
|
||||
// Bigger numbers as modulo is tested in big_integer_arith_vm_test.dart.
|
||||
// Big doubles are not co-prime, so there is nothing to test for dart2js.
|
||||
}
|
||||
|
||||
testGcd() {
|
||||
// Call testFunc with all combinations and orders of plus/minus
|
||||
// value and other.
|
||||
callCombos(value, other, testFunc) {
|
||||
testFunc(value, other);
|
||||
testFunc(value, -other);
|
||||
testFunc(-value, other);
|
||||
testFunc(-value, -other);
|
||||
if (value == other) return;
|
||||
testFunc(other, value);
|
||||
testFunc(other, -value);
|
||||
testFunc(-other, value);
|
||||
testFunc(-other, -value);
|
||||
}
|
||||
|
||||
// Test that gcd of value and other (non-negative) is expectedResult.
|
||||
// Tests all combinations of positive and negative values and order of
|
||||
// operands, so use positive values and order is not important.
|
||||
test(value, other, expectedResult) {
|
||||
// Check for bug in test.
|
||||
assert(expectedResult == 0 || value % expectedResult == 0);
|
||||
assert(expectedResult == 0 || other % expectedResult == 0);
|
||||
callCombos(value, other, (a, b) {
|
||||
var result = a.gcd(b);
|
||||
|
||||
/// Check that the result is a divisor.
|
||||
Expect.equals(0, result == 0 ? a : a % result, "$result | $a");
|
||||
Expect.equals(0, result == 0 ? b : b % result, "$result | $b");
|
||||
// Check for bug in test. If assert fails, the expected value is too low,
|
||||
// and the gcd call has found a greater common divisor.
|
||||
assert(result >= expectedResult);
|
||||
Expect.equals(expectedResult, result, "$a.gcd($b)");
|
||||
});
|
||||
}
|
||||
|
||||
// Test that gcd of value and other (non-negative) throws.
|
||||
testThrows(value, other) {
|
||||
callCombos(value, other, (a, b) {
|
||||
Expect.throws(() => a.gcd(b), null, "$a.gcd($b)");
|
||||
});
|
||||
}
|
||||
|
||||
testThrows(2.5, 5); // Not a method on double.
|
||||
testThrows(5, 2.5); // Not accepting non-int arguments.
|
||||
|
||||
// Format:
|
||||
// test(value1, value2, expectedResult);
|
||||
test(1, 1, 1); // both are 1
|
||||
test(1, 2, 1); // one is 1
|
||||
test(3, 5, 1); // coprime.
|
||||
test(37, 37, 37); // Same larger prime.
|
||||
|
||||
test(9999, 7272, 909); // Larger numbers
|
||||
|
||||
test(0, 1000, 1000); // One operand is zero.
|
||||
test(0, 0, 0); // Both operands are zero.
|
||||
|
||||
// Multiplying both operands by a number multiplies result by same number.
|
||||
test(693, 609, 21);
|
||||
test(693 << 5, 609 << 5, 21 << 5);
|
||||
test(693 * 937, 609 * 937, 21 * 937);
|
||||
test(693 * pow(2, 32), 609 * pow(2, 32), 21 * pow(2, 32));
|
||||
test(693 * pow(2, 52), 609 * pow(2, 52), 21 * pow(2, 52));
|
||||
test(693 * pow(2, 53), 609 * pow(2, 53), 21 * pow(2, 53)); // Regression.
|
||||
test(693 * pow(2, 99), 609 * pow(2, 99), 21 * pow(2, 99));
|
||||
|
||||
test(1234567890, 19, 1);
|
||||
test(1234567890, 1000000001, 1);
|
||||
test(19, 1000000001, 19);
|
||||
|
||||
test(0x3FFFFFFF, 0x3FFFFFFF, 0x3FFFFFFF);
|
||||
test(0x3FFFFFFF, 0x40000000, 1);
|
||||
|
||||
test(pow(2, 54), pow(2, 53), pow(2, 53));
|
||||
|
||||
test((pow(2, 52) - 1) * pow(2, 14), (pow(2, 26) - 1) * pow(2, 22),
|
||||
(pow(2, 26) - 1) * pow(2, 14));
|
||||
}
|
||||
|
||||
main() {
|
||||
testModPow(); // //# modPow: ok
|
||||
testModInverse();
|
||||
testGcd();
|
||||
}
|
Loading…
Reference in a new issue