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

Side by Side Diff: packages/quiver/test/collection/collection_test.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 2013 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 library quiver.collection.collection_test;
16
17 import 'package:quiver/collection.dart';
18 import 'package:test/test.dart';
19
20 main() {
21 group('listsEqual', () {
22 test('return true for equal lists', () {
23 expect(listsEqual(null, null), isTrue);
24 expect(listsEqual([], []), isTrue);
25 expect(listsEqual([1], [1]), isTrue);
26 expect(listsEqual(['a', 'b'], ['a', 'b']), isTrue);
27 });
28
29 test('return false for non-equal lists', () {
30 expect(listsEqual(null, []), isFalse);
31 expect(listsEqual([], null), isFalse);
32 expect(listsEqual([1], [2]), isFalse);
33 expect(listsEqual([1], []), isFalse);
34 expect(listsEqual([], [1]), isFalse);
35 });
36 });
37
38 group('listMap', () {
39 test('return true for equal maps', () {
40 expect(mapsEqual(null, null), isTrue);
41 expect(mapsEqual({}, {}), isTrue);
42 expect(mapsEqual({'a': 1}, {'a': 1}), isTrue);
43 });
44
45 test('return false for non-equal maps', () {
46 expect(mapsEqual(null, {}), isFalse);
47 expect(mapsEqual({}, null), isFalse);
48 expect(mapsEqual({'a': 1}, {'a': 2}), isFalse);
49 expect(mapsEqual({'a': 1}, {'b': 1}), isFalse);
50 expect(mapsEqual({'a': 1}, {'a': 1, 'b': 2}), isFalse);
51 expect(mapsEqual({'a': 1, 'b': 2}, {'a': 1}), isFalse);
52 });
53 });
54
55 group('setsEqual', () {
56 test('return true for equal sets', () {
57 expect(setsEqual(null, null), isTrue);
58 expect(setsEqual(new Set(), new Set()), isTrue);
59 expect(setsEqual(new Set.from([1]), new Set.from([1])), isTrue);
60 expect(setsEqual(new Set.from(['a', 'b']), new Set.from(['a', 'b'])),
61 isTrue);
62 });
63
64 test('return false for non-equal sets', () {
65 expect(setsEqual(null, new Set()), isFalse);
66 expect(setsEqual(new Set(), null), isFalse);
67 expect(setsEqual(new Set.from([1]), new Set.from([2])), isFalse);
68 expect(setsEqual(new Set.from([1]), new Set()), isFalse);
69 expect(setsEqual(new Set(), new Set.from([1])), isFalse);
70 });
71 });
72 }
OLDNEW
« no previous file with comments | « packages/quiver/test/collection/bimap_test.dart ('k') | packages/quiver/test/collection/delegates/iterable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698