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

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

Issue 484733003: Import analysis_services.dart into analysis_server.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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.services.src.index.store.collection;
6
7 import 'package:analysis_services/src/index/store/collection.dart';
8 import 'package:analysis_testing/reflective_tests.dart';
9 import 'package:unittest/unittest.dart';
10
11
12 main() {
13 groupSep = ' | ';
14 runReflectiveTests(_IntArrayToIntMapTest);
15 runReflectiveTests(_IntToIntSetMapTest);
16 }
17
18
19 @ReflectiveTestCase()
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
33 @ReflectiveTestCase()
34 class _IntToIntSetMapTest {
35 IntToIntSetMap map = new IntToIntSetMap();
36
37 void test_add_duplicate() {
38 map.add(1, 0);
39 map.add(1, 0);
40 List<int> set = map.get(1);
41 expect(set, hasLength(1));
42 }
43
44 void test_clear() {
45 map.add(1, 10);
46 map.add(2, 20);
47 expect(map.length, 2);
48 map.clear();
49 expect(map.length, 0);
50 }
51
52 void test_get() {
53 map.add(1, 10);
54 map.add(1, 11);
55 map.add(1, 12);
56 map.add(2, 20);
57 map.add(2, 21);
58 expect(map.get(1), unorderedEquals([10, 11, 12]));
59 expect(map.get(2), unorderedEquals([20, 21]));
60 }
61
62 void test_get_no() {
63 expect(map.get(3), []);
64 }
65
66 void test_length() {
67 expect(map.length, 0);
68 map.add(1, 10);
69 expect(map.length, 1);
70 map.add(1, 11);
71 map.add(1, 12);
72 expect(map.length, 1);
73 map.add(2, 20);
74 expect(map.length, 2);
75 map.add(2, 21);
76 expect(map.length, 2);
77 }
78 }
OLDNEW
« no previous file with comments | « pkg/analysis_services/test/index/store/codec_test.dart ('k') | pkg/analysis_services/test/index/store/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698