@@ -20,7 +20,7 @@ import 'package:test/test.dart';
2020import 'common_tests.dart' ;
2121
2222void main () {
23- group ('SupportingClasses ' , () {
23+ group ('SupportingCode ' , () {
2424 _BasicClass delegate;
2525 _RecordingClass rc;
2626 MutableRecording recording;
@@ -185,7 +185,7 @@ void main() {
185185 });
186186 });
187187
188- group ('Encode ' , () {
188+ group ('encode ' , () {
189189 test ('performsDeepEncoding' , () async {
190190 rc.basicProperty = 'foo' ;
191191 rc.basicProperty;
@@ -245,6 +245,68 @@ void main() {
245245 });
246246 });
247247 });
248+
249+ group ('deeplyEqual' , () {
250+ Map <String , dynamic > newMap ({
251+ String stringValue: 'foo' ,
252+ bool boolValue: true ,
253+ String lastListValue: 'c' ,
254+ int lastMapValue: 2 ,
255+ }) {
256+ return < String , dynamic > {
257+ 'string' : stringValue,
258+ 'bool' : boolValue,
259+ 'list' : < String > ['a' , 'b' , lastListValue],
260+ 'map' : < Symbol , int > {
261+ #foo: 1 ,
262+ #bar: lastMapValue,
263+ },
264+ };
265+ }
266+
267+ test ('primitives' , () {
268+ expect (deeplyEqual (1 , 1 ), isTrue);
269+ expect (deeplyEqual (1 , 2 ), isFalse);
270+ expect (deeplyEqual ('1' , '1' ), isTrue);
271+ expect (deeplyEqual ('1' , '2' ), isFalse);
272+ expect (deeplyEqual (true , true ), isTrue);
273+ expect (deeplyEqual (true , false ), isFalse);
274+ expect (deeplyEqual (null , null ), isTrue);
275+ expect (deeplyEqual (1 , '1' ), isFalse);
276+ });
277+
278+ test ('listOfPrimitives' , () {
279+ expect (deeplyEqual (< int > [], < int > []), isTrue);
280+ expect (deeplyEqual (< int > [1 , 2 , 3 ], < int > [1 , 2 , 3 ]), isTrue);
281+ expect (deeplyEqual (< int > [1 , 2 , 3 ], < int > [1 , 3 , 2 ]), isFalse);
282+ expect (deeplyEqual (< int > [1 , 2 , 3 ], < int > [1 , 2 ]), isFalse);
283+ expect (deeplyEqual (< int > [1 , 2 , 3 ], < int > [1 , 2 , 3 , 4 ]), isFalse);
284+ expect (deeplyEqual (< String > ['a' , 'b' ], < String > ['a' , 'b' ]), isTrue);
285+ expect (deeplyEqual (< String > ['a' , 'b' ], < String > ['b' , 'a' ]), isFalse);
286+ expect (deeplyEqual (< String > ['a' , 'b' ], < String > ['a' ]), isFalse);
287+ expect (deeplyEqual (< int > [], < dynamic > []), isFalse);
288+ expect (deeplyEqual (< int > [], null ), isFalse);
289+ });
290+
291+ test ('mapOfPrimitives' , () {
292+ expect (deeplyEqual (< String , int > {}, < String , int > {}), isTrue);
293+ expect (deeplyEqual (< int , int > {1 : 2 }, < int , int > {1 : 2 }), isTrue);
294+ expect (deeplyEqual (< int , int > {1 : 2 }, < int , int > {1 : 3 }), isFalse);
295+ expect (deeplyEqual (< int , int > {1 : 2 }, < int , int > {}), isFalse);
296+ expect (deeplyEqual (< int , int > {}, < int , int > {1 : 2 }), isFalse);
297+ expect (deeplyEqual (< String , int > {}, < int , int > {}), isFalse);
298+ expect (deeplyEqual (< String , int > {}, < dynamic , dynamic > {}), isFalse);
299+ expect (deeplyEqual (< String , int > {}, null ), isFalse);
300+ });
301+
302+ test ('listOfMaps' , () {
303+ expect (deeplyEqual (newMap (), newMap ()), isTrue);
304+ expect (deeplyEqual (newMap (), newMap (stringValue: 'bar' )), isFalse);
305+ expect (deeplyEqual (newMap (), newMap (boolValue: false )), isFalse);
306+ expect (deeplyEqual (newMap (), newMap (lastListValue: 'd' )), isFalse);
307+ expect (deeplyEqual (newMap (), newMap (lastMapValue: 3 )), isFalse);
308+ });
309+ });
248310 });
249311
250312 group ('RecordingFileSystem' , () {
0 commit comments