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

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

Issue 1801883002: Remove old index and search implementations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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) 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.services.src.index.store.collection;
6
7 import 'package:analysis_server/src/services/index/store/collection.dart';
8 import 'package:test_reflective_loader/test_reflective_loader.dart';
9 import 'package:unittest/unittest.dart';
10
11 import '../../../utils.dart';
12
13 main() {
14 initializeTestEnvironment();
15 defineReflectiveTests(_IntArrayToIntMapTest);
16 defineReflectiveTests(_IntToIntSetMapTest);
17 }
18
19 @reflectiveTest
20 class _IntArrayToIntMapTest {
21 IntArrayToIntMap map = new IntArrayToIntMap();
22
23 void test_put_get() {
24 map[<int>[1, 2, 3]] = 1;
25 map[<int>[2, 3, 4, 5]] = 2;
26 expect(map[<int>[0]], isNull);
27 expect(map[<int>[1, 2, 3]], 1);
28 expect(map[<int>[2, 3, 4, 5]], 2);
29 }
30 }
31
32 @reflectiveTest
33 class _IntToIntSetMapTest {
34 IntToIntSetMap map = new IntToIntSetMap();
35
36 void test_add_duplicate() {
37 map.add(1, 0);
38 map.add(1, 0);
39 List<int> set = map.get(1);
40 expect(set, hasLength(1));
41 }
42
43 void test_clear() {
44 map.add(1, 10);
45 map.add(2, 20);
46 expect(map.length, 2);
47 map.clear();
48 expect(map.length, 0);
49 }
50
51 void test_get() {
52 map.add(1, 10);
53 map.add(1, 11);
54 map.add(1, 12);
55 map.add(2, 20);
56 map.add(2, 21);
57 expect(map.get(1), unorderedEquals([10, 11, 12]));
58 expect(map.get(2), unorderedEquals([20, 21]));
59 }
60
61 void test_get_no() {
62 expect(map.get(3), []);
63 }
64
65 void test_length() {
66 expect(map.length, 0);
67 map.add(1, 10);
68 expect(map.length, 1);
69 map.add(1, 11);
70 map.add(1, 12);
71 expect(map.length, 1);
72 map.add(2, 20);
73 expect(map.length, 2);
74 map.add(2, 21);
75 expect(map.length, 2);
76 }
77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698