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

Unified Diff: pkg/analysis_server/test/index/store/collection_test.dart

Issue 351453004: Move split_store.dart to the store/ folder and extract collections/codecs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/index/store/collection_test.dart
diff --git a/pkg/analysis_server/test/index/store/collection_test.dart b/pkg/analysis_server/test/index/store/collection_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..382510bd81b0eaa041ae9fc7be9e20177ffabfef
--- /dev/null
+++ b/pkg/analysis_server/test/index/store/collection_test.dart
@@ -0,0 +1,83 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.index.store.collection;
+
+import 'package:analysis_server/src/index/store/collection.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../reflective_tests.dart';
+
+
+main() {
+ groupSep = ' | ';
+ group('IntArrayToIntMap', () {
+ runReflectiveTests(_IntArrayToIntMapTest);
+ });
+ group('IntToIntSetMap', () {
+ runReflectiveTests(_IntToIntSetMapTest);
+ });
+}
+
+
+@ReflectiveTestCase()
+class _IntArrayToIntMapTest {
+ IntArrayToIntMap map = new IntArrayToIntMap();
+
+ void test_put_get() {
+ map[<int>[1, 2, 3]] = 1;
+ map[<int>[2, 3, 4, 5]] = 2;
+ expect(map[<int>[0]], isNull);
+ expect(map[<int>[1, 2, 3]], 1);
+ expect(map[<int>[2, 3, 4, 5]], 2);
+ }
+}
+
+
+@ReflectiveTestCase()
+class _IntToIntSetMapTest {
+ IntToIntSetMap map = new IntToIntSetMap();
+
+ void test_add_duplicate() {
+ map.add(1, 0);
+ map.add(1, 0);
+ List<int> set = map.get(1);
+ expect(set, hasLength(1));
+ }
+
+ void test_clear() {
+ map.add(1, 10);
+ map.add(2, 20);
+ expect(map.length, 2);
+ map.clear();
+ expect(map.length, 0);
+ }
+
+ void test_get() {
+ map.add(1, 10);
+ map.add(1, 11);
+ map.add(1, 12);
+ map.add(2, 20);
+ map.add(2, 21);
+ expect(map.get(1), unorderedEquals([10, 11, 12]));
+ expect(map.get(2), unorderedEquals([20, 21]));
+ }
+
+ void test_get_no() {
+ expect(map.get(3), []);
+ }
+
+ void test_length() {
+ expect(map.length, 0);
+ map.add(1, 10);
+ expect(map.length, 1);
+ map.add(1, 11);
+ map.add(1, 12);
+ expect(map.length, 1);
+ map.add(2, 20);
+ expect(map.length, 2);
+ map.add(2, 21);
+ expect(map.length, 2);
+ }
+}
« no previous file with comments | « pkg/analysis_server/test/index/store/codec_test.dart ('k') | pkg/analysis_server/test/index/store/split_store_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698