OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library test.services.src.index.store.collection; | 5 library test.services.src.index.store.collection; |
6 | 6 |
7 import 'package:analysis_server/src/services/index/store/collection.dart'; | 7 import 'package:analysis_server/src/services/index/store/collection.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 | 9 |
10 import '../../../reflective_tests.dart'; | 10 import '../../../reflective_tests.dart'; |
11 | 11 |
12 | 12 |
13 main() { | 13 main() { |
14 groupSep = ' | '; | 14 groupSep = ' | '; |
15 runReflectiveTests(_IntArrayToIntMapTest); | 15 runReflectiveTests(_IntArrayToIntMapTest); |
16 runReflectiveTests(_IntToIntSetMapTest); | 16 runReflectiveTests(_IntToIntSetMapTest); |
17 } | 17 } |
18 | 18 |
19 | 19 |
20 @ReflectiveTestCase() | 20 @reflectiveTest |
21 class _IntArrayToIntMapTest { | 21 class _IntArrayToIntMapTest { |
22 IntArrayToIntMap map = new IntArrayToIntMap(); | 22 IntArrayToIntMap map = new IntArrayToIntMap(); |
23 | 23 |
24 void test_put_get() { | 24 void test_put_get() { |
25 map[<int>[1, 2, 3]] = 1; | 25 map[<int>[1, 2, 3]] = 1; |
26 map[<int>[2, 3, 4, 5]] = 2; | 26 map[<int>[2, 3, 4, 5]] = 2; |
27 expect(map[<int>[0]], isNull); | 27 expect(map[<int>[0]], isNull); |
28 expect(map[<int>[1, 2, 3]], 1); | 28 expect(map[<int>[1, 2, 3]], 1); |
29 expect(map[<int>[2, 3, 4, 5]], 2); | 29 expect(map[<int>[2, 3, 4, 5]], 2); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 @ReflectiveTestCase() | 34 @reflectiveTest |
35 class _IntToIntSetMapTest { | 35 class _IntToIntSetMapTest { |
36 IntToIntSetMap map = new IntToIntSetMap(); | 36 IntToIntSetMap map = new IntToIntSetMap(); |
37 | 37 |
38 void test_add_duplicate() { | 38 void test_add_duplicate() { |
39 map.add(1, 0); | 39 map.add(1, 0); |
40 map.add(1, 0); | 40 map.add(1, 0); |
41 List<int> set = map.get(1); | 41 List<int> set = map.get(1); |
42 expect(set, hasLength(1)); | 42 expect(set, hasLength(1)); |
43 } | 43 } |
44 | 44 |
(...skipping 25 matching lines...) Expand all Loading... |
70 expect(map.length, 1); | 70 expect(map.length, 1); |
71 map.add(1, 11); | 71 map.add(1, 11); |
72 map.add(1, 12); | 72 map.add(1, 12); |
73 expect(map.length, 1); | 73 expect(map.length, 1); |
74 map.add(2, 20); | 74 map.add(2, 20); |
75 expect(map.length, 2); | 75 expect(map.length, 2); |
76 map.add(2, 21); | 76 map.add(2, 21); |
77 expect(map.length, 2); | 77 expect(map.length, 2); |
78 } | 78 } |
79 } | 79 } |
OLD | NEW |