| OLD | NEW |
| 1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 library quiver.collection.bimap_test; | 15 library quiver.collection.bimap_test; |
| 16 | 16 |
| 17 import 'package:quiver/collection.dart'; | 17 import 'package:quiver/collection.dart'; |
| 18 import 'package:test/test.dart'; | 18 import 'package:test/test.dart'; |
| 19 | 19 |
| 20 main() { | 20 main() { |
| 21 group('BiMap', () { | 21 group('BiMap', () { |
| 22 test('should construct a HashBiMap', () { | 22 test('should construct a HashBiMap', () { |
| 23 expect(new BiMap() is HashBiMap, true); | 23 expect(new BiMap() is HashBiMap, true); |
| 24 }); | 24 }); |
| 25 }); | 25 }); |
| 26 | 26 |
| 27 group('HashBiMap', () { | 27 group('HashBiMap', () { |
| 28 BiMap<String, int> map; | 28 BiMap<String, int> map; |
| 29 String k1 = 'k1', | 29 String k1 = 'k1', k2 = 'k2', k3 = 'k3'; |
| 30 k2 = 'k2', | 30 int v1 = 1, v2 = 2, v3 = 3; |
| 31 k3 = 'k3'; | |
| 32 int v1 = 1, | |
| 33 v2 = 2, | |
| 34 v3 = 3; | |
| 35 | 31 |
| 36 setUp(() { | 32 setUp(() { |
| 37 map = new HashBiMap(); | 33 map = new HashBiMap(); |
| 38 }); | 34 }); |
| 39 | 35 |
| 40 test('should initialize empty', () { | 36 test('should initialize empty', () { |
| 41 expect(map.isEmpty, true); | 37 expect(map.isEmpty, true); |
| 42 expect(map.isNotEmpty, false); | 38 expect(map.isNotEmpty, false); |
| 43 expect(map.inverse.isEmpty, true); | 39 expect(map.inverse.isEmpty, true); |
| 44 expect(map.inverse.isNotEmpty, false); | 40 expect(map.inverse.isNotEmpty, false); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 var values = []; | 322 var values = []; |
| 327 map.inverse.forEach((k, v) { | 323 map.inverse.forEach((k, v) { |
| 328 keys.add(k); | 324 keys.add(k); |
| 329 values.add(v); | 325 values.add(v); |
| 330 }); | 326 }); |
| 331 expect(keys, unorderedEquals([v1, v2])); | 327 expect(keys, unorderedEquals([v1, v2])); |
| 332 expect(values, unorderedEquals([k1, k2])); | 328 expect(values, unorderedEquals([k1, k2])); |
| 333 }); | 329 }); |
| 334 }); | 330 }); |
| 335 } | 331 } |
| OLD | NEW |