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

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

Issue 375693002: Move index/search to services. (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
« no previous file with comments | « pkg/analyzer/test/index/store/codec_test.dart ('k') | pkg/analyzer/test/index/store/mocks.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.engine.src.index.store.collection;
6
7 import 'package:analysis_testing/reflective_tests.dart';
8 import 'package:analyzer/src/index/store/collection.dart';
9 import 'package:unittest/unittest.dart';
10
11
12 main() {
13 groupSep = ' | ';
14 group('IntArrayToIntMap', () {
15 runReflectiveTests(_IntArrayToIntMapTest);
16 });
17 group('IntToIntSetMap', () {
18 runReflectiveTests(_IntToIntSetMapTest);
19 });
20 }
21
22
23 @ReflectiveTestCase()
24 class _IntArrayToIntMapTest {
25 IntArrayToIntMap map = new IntArrayToIntMap();
26
27 void test_put_get() {
28 map[<int>[1, 2, 3]] = 1;
29 map[<int>[2, 3, 4, 5]] = 2;
30 expect(map[<int>[0]], isNull);
31 expect(map[<int>[1, 2, 3]], 1);
32 expect(map[<int>[2, 3, 4, 5]], 2);
33 }
34 }
35
36
37 @ReflectiveTestCase()
38 class _IntToIntSetMapTest {
39 IntToIntSetMap map = new IntToIntSetMap();
40
41 void test_add_duplicate() {
42 map.add(1, 0);
43 map.add(1, 0);
44 List<int> set = map.get(1);
45 expect(set, hasLength(1));
46 }
47
48 void test_clear() {
49 map.add(1, 10);
50 map.add(2, 20);
51 expect(map.length, 2);
52 map.clear();
53 expect(map.length, 0);
54 }
55
56 void test_get() {
57 map.add(1, 10);
58 map.add(1, 11);
59 map.add(1, 12);
60 map.add(2, 20);
61 map.add(2, 21);
62 expect(map.get(1), unorderedEquals([10, 11, 12]));
63 expect(map.get(2), unorderedEquals([20, 21]));
64 }
65
66 void test_get_no() {
67 expect(map.get(3), []);
68 }
69
70 void test_length() {
71 expect(map.length, 0);
72 map.add(1, 10);
73 expect(map.length, 1);
74 map.add(1, 11);
75 map.add(1, 12);
76 expect(map.length, 1);
77 map.add(2, 20);
78 expect(map.length, 2);
79 map.add(2, 21);
80 expect(map.length, 2);
81 }
82 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/index/store/codec_test.dart ('k') | pkg/analyzer/test/index/store/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698