@@ -26,6 +26,18 @@ use matchers::{
26
26
use matchers:: { contains_each, is_contained_in, unordered_elements_are} ;
27
27
use std:: collections:: HashMap ;
28
28
29
+ #[ google_test]
30
+ fn unordered_elements_are_matches_empty_vector ( ) -> Result < ( ) > {
31
+ let value: Vec < u32 > = vec ! [ ] ;
32
+ verify_that ! ( value, unordered_elements_are![ ] )
33
+ }
34
+
35
+ #[ google_test]
36
+ fn unordered_elements_are_matches_empty_vector_with_trailing_comma ( ) -> Result < ( ) > {
37
+ let value: Vec < u32 > = vec ! [ ] ;
38
+ verify_that ! ( value, unordered_elements_are![ , ] )
39
+ }
40
+
29
41
#[ google_test]
30
42
fn unordered_elements_are_matches_vector ( ) -> Result < ( ) > {
31
43
let value = vec ! [ 1 , 2 , 3 ] ;
@@ -250,11 +262,35 @@ fn contains_each_supports_trailing_comma() -> Result<()> {
250
262
verify_that ! ( vec![ 2 , 3 , 4 ] , contains_each!( eq( 2 ) , eq( 3 ) , eq( 4 ) , ) )
251
263
}
252
264
265
+ #[ google_test]
266
+ fn contains_each_matches_hash_map ( ) -> Result < ( ) > {
267
+ let value: HashMap < u32 , & ' static str > =
268
+ HashMap :: from_iter ( [ ( 1 , "One" ) , ( 2 , "Two" ) , ( 3 , "Three" ) ] ) ;
269
+ verify_that ! ( value, contains_each![ ( eq( 2 ) , eq( "Two" ) ) , ( eq( 1 ) , eq( "One" ) ) ] )
270
+ }
271
+
272
+ #[ google_test]
273
+ fn contains_each_matches_hash_map_with_trailing_comma ( ) -> Result < ( ) > {
274
+ let value: HashMap < u32 , & ' static str > =
275
+ HashMap :: from_iter ( [ ( 1 , "One" ) , ( 2 , "Two" ) , ( 3 , "Three" ) ] ) ;
276
+ verify_that ! ( value, contains_each![ ( eq( 2 ) , eq( "Two" ) ) , ( eq( 1 ) , eq( "One" ) ) , ] )
277
+ }
278
+
253
279
#[ google_test]
254
280
fn contains_each_matches_when_no_matchers_present ( ) -> Result < ( ) > {
255
281
verify_that ! ( vec![ 2 , 3 , 4 ] , contains_each!( ) )
256
282
}
257
283
284
+ #[ google_test]
285
+ fn contains_each_matches_when_no_matchers_present_and_trailing_comma ( ) -> Result < ( ) > {
286
+ verify_that ! ( vec![ 2 , 3 , 4 ] , contains_each!( , ) )
287
+ }
288
+
289
+ #[ google_test]
290
+ fn contains_each_matches_when_list_is_empty_and_no_matchers_present ( ) -> Result < ( ) > {
291
+ verify_that ! ( Vec :: <u32 >:: new( ) , contains_each!( ) )
292
+ }
293
+
258
294
#[ google_test]
259
295
fn contains_each_matches_when_excess_elements_present ( ) -> Result < ( ) > {
260
296
verify_that ! ( vec![ 1 , 2 , 3 , 4 ] , contains_each!( eq( 2 ) , eq( 3 ) , eq( 4 ) ) )
@@ -302,6 +338,18 @@ fn contains_each_explains_mismatch_due_to_no_graph_matching_found() -> Result<()
302
338
) )
303
339
}
304
340
341
+ #[ google_test]
342
+ fn is_contained_in_matches_with_empty_vector ( ) -> Result < ( ) > {
343
+ let value: Vec < u32 > = vec ! [ ] ;
344
+ verify_that ! ( value, is_contained_in!( ) )
345
+ }
346
+
347
+ #[ google_test]
348
+ fn is_contained_in_matches_with_empty_vector_and_trailing_comma ( ) -> Result < ( ) > {
349
+ let value: Vec < u32 > = vec ! [ ] ;
350
+ verify_that ! ( value, is_contained_in!( , ) )
351
+ }
352
+
305
353
#[ google_test]
306
354
fn is_contained_in_matches_when_one_to_one_correspondence_present ( ) -> Result < ( ) > {
307
355
verify_that ! ( vec![ 2 , 3 , 4 ] , is_contained_in!( eq( 2 ) , eq( 3 ) , eq( 4 ) ) )
@@ -312,6 +360,24 @@ fn is_contained_supports_trailing_comma() -> Result<()> {
312
360
verify_that ! ( vec![ 2 , 3 , 4 ] , is_contained_in!( eq( 2 ) , eq( 3 ) , eq( 4 ) , ) )
313
361
}
314
362
363
+ #[ google_test]
364
+ fn is_contained_in_matches_hash_map ( ) -> Result < ( ) > {
365
+ let value: HashMap < u32 , & ' static str > = HashMap :: from_iter ( [ ( 1 , "One" ) , ( 2 , "Two" ) ] ) ;
366
+ verify_that ! (
367
+ value,
368
+ is_contained_in![ ( eq( 2 ) , eq( "Two" ) ) , ( eq( 1 ) , eq( "One" ) ) , ( eq( 3 ) , eq( "Three" ) ) ]
369
+ )
370
+ }
371
+
372
+ #[ google_test]
373
+ fn is_contained_in_matches_hash_map_with_trailing_comma ( ) -> Result < ( ) > {
374
+ let value: HashMap < u32 , & ' static str > = HashMap :: from_iter ( [ ( 1 , "One" ) , ( 2 , "Two" ) ] ) ;
375
+ verify_that ! (
376
+ value,
377
+ is_contained_in![ ( eq( 2 ) , eq( "Two" ) ) , ( eq( 1 ) , eq( "One" ) ) , ( eq( 3 ) , eq( "Three" ) ) , ]
378
+ )
379
+ }
380
+
315
381
#[ google_test]
316
382
fn is_contained_in_matches_when_container_is_empty ( ) -> Result < ( ) > {
317
383
verify_that ! ( vec![ ] , is_contained_in!( eq( 2 ) , eq( 3 ) , eq( 4 ) ) )
0 commit comments