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

Unified Diff: test/utils_test.dart

Issue 1319303004: Optimize successive calls SourceFile.getLine(). (Closed) Base URL: https://github.com/dart-lang/source_span.git@master
Patch Set: Add boundary case checking back in and remove tests for old binary search. Created 5 years, 4 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
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/utils_test.dart
diff --git a/test/utils_test.dart b/test/utils_test.dart
index 3b6238b55ac4da57a421d69b165fc4421c144f1d..5d973f58acf29578617cec0f40529602ecef0e1c 100644
--- a/test/utils_test.dart
+++ b/test/utils_test.dart
@@ -6,40 +6,6 @@ import 'package:test/test.dart';
import 'package:source_span/src/utils.dart';
main() {
- group('binary search', () {
- test('empty', () {
- expect(binarySearch([], (x) => true), -1);
- });
-
- test('single element', () {
- expect(binarySearch([1], (x) => true), 0);
- expect(binarySearch([1], (x) => false), 1);
- });
-
- test('no matches', () {
- var list = [1, 2, 3, 4, 5, 6, 7];
- expect(binarySearch(list, (x) => false), list.length);
- });
-
- test('all match', () {
- var list = [1, 2, 3, 4, 5, 6, 7];
- expect(binarySearch(list, (x) => true), 0);
- });
-
- test('compare with linear search', () {
- for (int size = 0; size < 100; size++) {
- var list = [];
- for (int i = 0; i < size; i++) {
- list.add(i);
- }
- for (int pos = 0; pos <= size; pos++) {
- expect(binarySearch(list, (x) => x >= pos),
- _linearSearch(list, (x) => x >= pos));
- }
- }
- });
- });
-
group('find line start', () {
test('skip entries in wrong column', () {
var context = '0_bb\n1_bbb\n2b____\n3bbb\n';
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698