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

Side by Side Diff: pkg/kernel/test/heap_test.dart

Issue 2848083002: Implement Dart 1.0 LUB algorithm (for interface types) in kernel. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:kernel/heap.dart';
6 import 'package:test/test.dart';
7
8 main() {
9 test('sort', () {
10 var values = <int>[3, 1, 4, 1, 5, 9, 2, 6];
ahe 2017/05/01 16:50:34 Would it make sense to test a list that is sorted,
Paul Berry 2017/05/01 18:12:14 Yes, good idea. Done.
11 var heap = new _intHeap();
12 values.forEach(heap.add);
13 values.sort();
14 var result = <int>[];
15 while (heap.isNotEmpty) {
16 expect(heap.isEmpty, isFalse);
17 result.add(heap.remove());
18 }
19 expect(heap.isEmpty, isTrue);
20 expect(result, values);
21 });
22 }
23
24 class _intHeap extends Heap<int> {
25 bool sortsBefore(int a, int b) => a < b;
26 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698