| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:unittest/unittest.dart'; | 5 import 'package:unittest/unittest.dart'; |
| 6 import 'package:source_span/src/utils.dart'; | 6 import 'package:source_span/src/utils.dart'; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 group('binary search', () { | 9 group('binary search', () { |
| 10 test('empty', () { | 10 test('empty', () { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 }); | 41 }); |
| 42 } | 42 } |
| 43 | 43 |
| 44 _linearSearch(list, predicate) { | 44 _linearSearch(list, predicate) { |
| 45 if (list.length == 0) return -1; | 45 if (list.length == 0) return -1; |
| 46 for (int i = 0; i < list.length; i++) { | 46 for (int i = 0; i < list.length; i++) { |
| 47 if (predicate(list[i])) return i; | 47 if (predicate(list[i])) return i; |
| 48 } | 48 } |
| 49 return list.length; | 49 return list.length; |
| 50 } | 50 } |
| 51 | |
| OLD | NEW |