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

Side by Side Diff: pkg/analysis_server/test/index/store/collection_test.dart

Issue 365193004: Move Index and IndexStore implementations into Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 library test.index.store.collection;
6
7 import 'package:analysis_server/src/index/store/collection.dart';
8 import 'package:unittest/unittest.dart';
9
10 import '../../reflective_tests.dart';
11
12
13 main() {
14 groupSep = ' | ';
15 group('IntArrayToIntMap', () {
16 runReflectiveTests(_IntArrayToIntMapTest);
17 });
18 group('IntToIntSetMap', () {
19 runReflectiveTests(_IntToIntSetMapTest);
20 });
21 }
22
23
24 @ReflectiveTestCase()
25 class _IntArrayToIntMapTest {
26 IntArrayToIntMap map = new IntArrayToIntMap();
27
28 void test_put_get() {
29 map[<int>[1, 2, 3]] = 1;
30 map[<int>[2, 3, 4, 5]] = 2;
31 expect(map[<int>[0]], isNull);
32 expect(map[<int>[1, 2, 3]], 1);
33 expect(map[<int>[2, 3, 4, 5]], 2);
34 }
35 }
36
37
38 @ReflectiveTestCase()
39 class _IntToIntSetMapTest {
40 IntToIntSetMap map = new IntToIntSetMap();
41
42 void test_add_duplicate() {
43 map.add(1, 0);
44 map.add(1, 0);
45 List<int> set = map.get(1);
46 expect(set, hasLength(1));
47 }
48
49 void test_clear() {
50 map.add(1, 10);
51 map.add(2, 20);
52 expect(map.length, 2);
53 map.clear();
54 expect(map.length, 0);
55 }
56
57 void test_get() {
58 map.add(1, 10);
59 map.add(1, 11);
60 map.add(1, 12);
61 map.add(2, 20);
62 map.add(2, 21);
63 expect(map.get(1), unorderedEquals([10, 11, 12]));
64 expect(map.get(2), unorderedEquals([20, 21]));
65 }
66
67 void test_get_no() {
68 expect(map.get(3), []);
69 }
70
71 void test_length() {
72 expect(map.length, 0);
73 map.add(1, 10);
74 expect(map.length, 1);
75 map.add(1, 11);
76 map.add(1, 12);
77 expect(map.length, 1);
78 map.add(2, 20);
79 expect(map.length, 2);
80 map.add(2, 21);
81 expect(map.length, 2);
82 }
83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698