@@ -95,11 +95,11 @@ namespace
95
95
auto operator <=>(const ValueType&) const noexcept = default ;
96
96
};
97
97
98
- // NOTE: We do not use TEMPLATE_LIST_TEST_CASE here because code coverage tools (such as
99
- // gcov/lcov) do not properly attribute coverage to tests instantiated via
100
- // TEMPLATE_LIST_TEST_CASE . Instead, we use individual TEMPLATE_TEST_CASEs for each mutex type,
101
- // and factorize the test logic into function templates to avoid code duplication. This ensures
102
- // accurate code coverage reporting.
98
+ // NOTE: We do not use TEMPLATE_TEST_CASE or TEMPLATE_LIST_TEST_CASE here because code coverage
99
+ // tools (such as gcov/lcov) do not properly attribute coverage to tests instantiated via
100
+ // template test cases . Instead, we use individual TEST_CASEs for each mutex type, and factorize
101
+ // the test logic into function templates to avoid code duplication. This ensures accurate code
102
+ // coverage reporting.
103
103
104
104
using supported_mutex_types = std::tuple<std::mutex, std::shared_mutex, std::recursive_mutex>;
105
105
@@ -281,25 +281,17 @@ namespace
281
281
}
282
282
}
283
283
284
- TEMPLATE_TEST_CASE (" synchronized_value basics with std::mutex" , " [template][ thread-safe]" , std::mutex )
284
+ TEST_CASE (" synchronized_value basics with std::mutex" , " [thread-safe]" )
285
285
{
286
286
test_synchronized_value_basics<std::mutex>();
287
287
}
288
288
289
- TEMPLATE_TEST_CASE (
290
- " synchronized_value basics with std::shared_mutex" ,
291
- " [template][thread-safe]" ,
292
- std::shared_mutex
293
- )
289
+ TEST_CASE (" synchronized_value basics with std::shared_mutex" , " [thread-safe]" )
294
290
{
295
291
test_synchronized_value_basics<std::shared_mutex>();
296
292
}
297
293
298
- TEMPLATE_TEST_CASE (
299
- " synchronized_value basics with std::recursive_mutex" ,
300
- " [template][thread-safe]" ,
301
- std::recursive_mutex
302
- )
294
+ TEST_CASE (" synchronized_value basics with std::recursive_mutex" , " [thread-safe]" )
303
295
{
304
296
test_synchronized_value_basics<std::recursive_mutex>();
305
297
}
@@ -372,165 +364,93 @@ namespace
372
364
);
373
365
}
374
366
375
- // Now call these from the TEMPLATE_TEST_CASEs
376
- TEMPLATE_TEST_CASE (
377
- " synchronized_value initializer-list with std::mutex" ,
378
- " [template][thread-safe]" ,
379
- std::mutex
380
- )
367
+ // Individual test cases for each mutex type
368
+ TEST_CASE (" synchronized_value initializer-list with std::mutex" , " [thread-safe]" )
381
369
{
382
370
test_synchronized_value_initializer_list<std::mutex>();
383
371
}
384
372
385
- TEMPLATE_TEST_CASE (
386
- " synchronized_value initializer-list with std::shared_mutex" ,
387
- " [template][thread-safe]" ,
388
- std::shared_mutex
389
- )
373
+ TEST_CASE (" synchronized_value initializer-list with std::shared_mutex" , " [thread-safe]" )
390
374
{
391
375
test_synchronized_value_initializer_list<std::shared_mutex>();
392
376
}
393
377
394
- TEMPLATE_TEST_CASE (
395
- " synchronized_value initializer-list with std::recursive_mutex" ,
396
- " [template][thread-safe]" ,
397
- std::recursive_mutex
398
- )
378
+ TEST_CASE (" synchronized_value initializer-list with std::recursive_mutex" , " [thread-safe]" )
399
379
{
400
380
test_synchronized_value_initializer_list<std::recursive_mutex>();
401
381
}
402
382
403
- TEMPLATE_TEST_CASE (
404
- " synchronized_value apply example with std::mutex" ,
405
- " [template][thread-safe]" ,
406
- std::mutex
407
- )
383
+ TEST_CASE (" synchronized_value apply example with std::mutex" , " [thread-safe]" )
408
384
{
409
385
test_synchronized_value_apply_example<std::mutex>();
410
386
}
411
387
412
- TEMPLATE_TEST_CASE (
413
- " synchronized_value apply example with std::shared_mutex" ,
414
- " [template][thread-safe]" ,
415
- std::shared_mutex
416
- )
388
+ TEST_CASE (" synchronized_value apply example with std::shared_mutex" , " [thread-safe]" )
417
389
{
418
390
test_synchronized_value_apply_example<std::shared_mutex>();
419
391
}
420
392
421
- TEMPLATE_TEST_CASE (
422
- " synchronized_value apply example with std::recursive_mutex" ,
423
- " [template][thread-safe]" ,
424
- std::recursive_mutex
425
- )
393
+ TEST_CASE (" synchronized_value apply example with std::recursive_mutex" , " [thread-safe]" )
426
394
{
427
395
test_synchronized_value_apply_example<std::recursive_mutex>();
428
396
}
429
397
430
- TEMPLATE_TEST_CASE (
431
- " synchronized_value thread-safe direct_access with std::mutex" ,
432
- " [template][thread-safe]" ,
433
- std::mutex
434
- )
398
+ TEST_CASE (" synchronized_value thread-safe direct_access with std::mutex" , " [thread-safe]" )
435
399
{
436
400
test_synchronized_value_threadsafe_direct_access<std::mutex>();
437
401
}
438
402
439
- TEMPLATE_TEST_CASE (
440
- " synchronized_value thread-safe direct_access with std::shared_mutex" ,
441
- " [template][thread-safe]" ,
442
- std::shared_mutex
443
- )
403
+ TEST_CASE (" synchronized_value thread-safe direct_access with std::shared_mutex" , " [thread-safe]" )
444
404
{
445
405
test_synchronized_value_threadsafe_direct_access<std::shared_mutex>();
446
406
}
447
407
448
- TEMPLATE_TEST_CASE (
449
- " synchronized_value thread-safe direct_access with std::recursive_mutex" ,
450
- " [template][thread-safe]" ,
451
- std::recursive_mutex
452
- )
408
+ TEST_CASE (" synchronized_value thread-safe direct_access with std::recursive_mutex" , " [thread-safe]" )
453
409
{
454
410
test_synchronized_value_threadsafe_direct_access<std::recursive_mutex>();
455
411
}
456
412
457
- TEMPLATE_TEST_CASE (
458
- " synchronized_value thread-safe synchronize with std::mutex" ,
459
- " [template][thread-safe]" ,
460
- std::mutex
461
- )
413
+ TEST_CASE (" synchronized_value thread-safe synchronize with std::mutex" , " [thread-safe]" )
462
414
{
463
415
test_synchronized_value_threadsafe_synchronize<std::mutex>();
464
416
}
465
417
466
- TEMPLATE_TEST_CASE (
467
- " synchronized_value thread-safe synchronize with std::shared_mutex" ,
468
- " [template][thread-safe]" ,
469
- std::shared_mutex
470
- )
418
+ TEST_CASE (" synchronized_value thread-safe synchronize with std::shared_mutex" , " [thread-safe]" )
471
419
{
472
420
test_synchronized_value_threadsafe_synchronize<std::shared_mutex>();
473
421
}
474
422
475
- TEMPLATE_TEST_CASE (
476
- " synchronized_value thread-safe synchronize with std::recursive_mutex" ,
477
- " [template][thread-safe]" ,
478
- std::recursive_mutex
479
- )
423
+ TEST_CASE (" synchronized_value thread-safe synchronize with std::recursive_mutex" , " [thread-safe]" )
480
424
{
481
425
test_synchronized_value_threadsafe_synchronize<std::recursive_mutex>();
482
426
}
483
427
484
- TEMPLATE_TEST_CASE (
485
- " synchronized_value thread-safe apply with std::mutex" ,
486
- " [template][thread-safe]" ,
487
- std::mutex
488
- )
428
+ TEST_CASE (" synchronized_value thread-safe apply with std::mutex" , " [thread-safe]" )
489
429
{
490
430
test_synchronized_value_threadsafe_apply<std::mutex>();
491
431
}
492
432
493
- TEMPLATE_TEST_CASE (
494
- " synchronized_value thread-safe apply with std::shared_mutex" ,
495
- " [template][thread-safe]" ,
496
- std::shared_mutex
497
- )
433
+ TEST_CASE (" synchronized_value thread-safe apply with std::shared_mutex" , " [thread-safe]" )
498
434
{
499
435
test_synchronized_value_threadsafe_apply<std::shared_mutex>();
500
436
}
501
437
502
- TEMPLATE_TEST_CASE (
503
- " synchronized_value thread-safe apply with std::recursive_mutex" ,
504
- " [template][thread-safe]" ,
505
- std::recursive_mutex
506
- )
438
+ TEST_CASE (" synchronized_value thread-safe apply with std::recursive_mutex" , " [thread-safe]" )
507
439
{
508
440
test_synchronized_value_threadsafe_apply<std::recursive_mutex>();
509
441
}
510
442
511
- TEMPLATE_TEST_CASE (
512
- " synchronized_value thread-safe multiple synchronize with std::mutex" ,
513
- " [template][thread-safe]" ,
514
- std::mutex
515
- )
443
+ TEST_CASE (" synchronized_value thread-safe multiple synchronize with std::mutex" , " [thread-safe]" )
516
444
{
517
445
test_synchronized_value_threadsafe_multiple_synchronize<std::mutex>();
518
446
}
519
447
520
- TEMPLATE_TEST_CASE (
521
- " synchronized_value thread-safe multiple synchronize with std::shared_mutex" ,
522
- " [template][thread-safe]" ,
523
- std::shared_mutex
524
- )
448
+ TEST_CASE (" synchronized_value thread-safe multiple synchronize with std::shared_mutex" , " [thread-safe]" )
525
449
{
526
450
test_synchronized_value_threadsafe_multiple_synchronize<std::shared_mutex>();
527
451
}
528
452
529
- TEMPLATE_TEST_CASE (
530
- " synchronized_value thread-safe multiple synchronize with std::recursive_mutex" ,
531
- " [template][thread-safe]" ,
532
- std::recursive_mutex
533
- )
453
+ TEST_CASE (" synchronized_value thread-safe multiple synchronize with std::recursive_mutex" , " [thread-safe]" )
534
454
{
535
455
test_synchronized_value_threadsafe_multiple_synchronize<std::recursive_mutex>();
536
456
}
0 commit comments