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

Unified Diff: test/codegen/expect/collection/src/algorithms.js

Issue 1642903004: Regen tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/codegen/expect/collection/src/algorithms.js
diff --git a/test/codegen/expect/collection/algorithms.js b/test/codegen/expect/collection/src/algorithms.js
similarity index 85%
rename from test/codegen/expect/collection/algorithms.js
rename to test/codegen/expect/collection/src/algorithms.js
index 2381efcdbe6ceb397bf373c36e9ad6da867b3de5..3c096541fd5e0a89fe174a40ac9108dd58930683 100644
--- a/test/codegen/expect/collection/algorithms.js
+++ b/test/codegen/expect/collection/src/algorithms.js
@@ -1,4 +1,4 @@
-dart_library.library('collection/algorithms', null, /* Imports */[
+dart_library.library('collection/src/algorithms', null, /* Imports */[
'dart/_runtime',
'dart/core',
'dart/math'
@@ -6,13 +6,13 @@ dart_library.library('collection/algorithms', null, /* Imports */[
], function(exports, dart, core, math) {
'use strict';
let dartx = dart.dartx;
- function _comparableBinarySearch(list, key) {
+ function _comparableBinarySearch(list, value) {
let min = 0;
let max = list[dartx.length];
while (min < dart.notNull(max)) {
let mid = min + (dart.notNull(max) - min >> 1);
let element = list[dartx.get](mid);
- let comp = element[dartx.compareTo](key);
+ let comp = element[dartx.compareTo](value);
if (comp == 0) return mid;
if (dart.notNull(comp) < 0) {
min = mid + 1;
@@ -23,17 +23,17 @@ dart_library.library('collection/algorithms', null, /* Imports */[
return -1;
}
dart.fn(_comparableBinarySearch, core.int, [core.List$(core.Comparable), core.Comparable]);
- function binarySearch(sortedList, key, opts) {
+ function binarySearch(sortedList, value, opts) {
let compare = opts && 'compare' in opts ? opts.compare : null;
if (compare == null) {
- return _comparableBinarySearch(dart.as(sortedList, core.List$(core.Comparable)), dart.as(key, core.Comparable));
+ return _comparableBinarySearch(dart.as(sortedList, core.List$(core.Comparable)), dart.as(value, core.Comparable));
}
let min = 0;
let max = sortedList[dartx.length];
while (min < dart.notNull(max)) {
let mid = min + (dart.notNull(max) - min >> 1);
let element = sortedList[dartx.get](mid);
- let comp = dart.dcall(compare, element, key);
+ let comp = dart.dcall(compare, element, value);
if (comp == 0) return mid;
if (dart.notNull(comp) < 0) {
min = mid + 1;
@@ -44,6 +44,42 @@ dart_library.library('collection/algorithms', null, /* Imports */[
return -1;
}
dart.fn(binarySearch, core.int, [core.List, dart.dynamic], {compare: dart.functionType(core.int, [dart.dynamic, dart.dynamic])});
+ function _comparableLowerBound(list, value) {
+ let min = 0;
+ let max = list[dartx.length];
+ while (min < dart.notNull(max)) {
+ let mid = min + (dart.notNull(max) - min >> 1);
+ let element = list[dartx.get](mid);
+ let comp = element[dartx.compareTo](value);
+ if (dart.notNull(comp) < 0) {
+ min = mid + 1;
+ } else {
+ max = mid;
+ }
+ }
+ return min;
+ }
+ dart.fn(_comparableLowerBound, core.int, [core.List$(core.Comparable), core.Comparable]);
+ function lowerBound(sortedList, value, opts) {
+ let compare = opts && 'compare' in opts ? opts.compare : null;
+ if (compare == null) {
+ return _comparableLowerBound(dart.as(sortedList, core.List$(core.Comparable)), dart.as(value, core.Comparable));
+ }
+ let min = 0;
+ let max = sortedList[dartx.length];
+ while (min < dart.notNull(max)) {
+ let mid = min + (dart.notNull(max) - min >> 1);
+ let element = sortedList[dartx.get](mid);
+ let comp = dart.dcall(compare, element, value);
+ if (dart.notNull(comp) < 0) {
+ min = mid + 1;
+ } else {
+ max = mid;
+ }
+ }
+ return min;
+ }
+ dart.fn(lowerBound, core.int, [core.List, dart.dynamic], {compare: dart.functionType(core.int, [dart.dynamic, dart.dynamic])});
function shuffle(list, start, end) {
if (start === void 0) start = 0;
if (end === void 0) end = null;
@@ -222,6 +258,7 @@ dart_library.library('collection/algorithms', null, /* Imports */[
dart.fn(_merge, dart.void, [dart.functionType(core.int, [dart.dynamic, dart.dynamic]), core.List, core.int, core.int, core.List, core.int, core.int, core.List, core.int]);
// Exports:
exports.binarySearch = binarySearch;
+ exports.lowerBound = lowerBound;
exports.shuffle = shuffle;
exports.reverse = reverse;
exports.insertionSort = insertionSort;
« no previous file with comments | « test/codegen/expect/collection/priority_queue.txt ('k') | test/codegen/expect/collection/src/algorithms.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698