Skip to content

Commit 7fef1f4

Browse files
committed
Replace TEMPLATE_TEST_CASE with TEST_CASE
Signed-off-by: Julien Jerphanion <[email protected]>
1 parent c7ddb3c commit 7fef1f4

File tree

1 file changed

+27
-107
lines changed

1 file changed

+27
-107
lines changed

libmamba/tests/src/util/test_synchronized_value.cpp

Lines changed: 27 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ namespace
9595
auto operator<=>(const ValueType&) const noexcept = default;
9696
};
9797

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.
103103

104104
using supported_mutex_types = std::tuple<std::mutex, std::shared_mutex, std::recursive_mutex>;
105105

@@ -281,25 +281,17 @@ namespace
281281
}
282282
}
283283

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]")
285285
{
286286
test_synchronized_value_basics<std::mutex>();
287287
}
288288

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]")
294290
{
295291
test_synchronized_value_basics<std::shared_mutex>();
296292
}
297293

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]")
303295
{
304296
test_synchronized_value_basics<std::recursive_mutex>();
305297
}
@@ -372,165 +364,93 @@ namespace
372364
);
373365
}
374366

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]")
381369
{
382370
test_synchronized_value_initializer_list<std::mutex>();
383371
}
384372

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]")
390374
{
391375
test_synchronized_value_initializer_list<std::shared_mutex>();
392376
}
393377

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]")
399379
{
400380
test_synchronized_value_initializer_list<std::recursive_mutex>();
401381
}
402382

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]")
408384
{
409385
test_synchronized_value_apply_example<std::mutex>();
410386
}
411387

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]")
417389
{
418390
test_synchronized_value_apply_example<std::shared_mutex>();
419391
}
420392

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]")
426394
{
427395
test_synchronized_value_apply_example<std::recursive_mutex>();
428396
}
429397

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]")
435399
{
436400
test_synchronized_value_threadsafe_direct_access<std::mutex>();
437401
}
438402

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]")
444404
{
445405
test_synchronized_value_threadsafe_direct_access<std::shared_mutex>();
446406
}
447407

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]")
453409
{
454410
test_synchronized_value_threadsafe_direct_access<std::recursive_mutex>();
455411
}
456412

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]")
462414
{
463415
test_synchronized_value_threadsafe_synchronize<std::mutex>();
464416
}
465417

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]")
471419
{
472420
test_synchronized_value_threadsafe_synchronize<std::shared_mutex>();
473421
}
474422

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]")
480424
{
481425
test_synchronized_value_threadsafe_synchronize<std::recursive_mutex>();
482426
}
483427

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]")
489429
{
490430
test_synchronized_value_threadsafe_apply<std::mutex>();
491431
}
492432

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]")
498434
{
499435
test_synchronized_value_threadsafe_apply<std::shared_mutex>();
500436
}
501437

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]")
507439
{
508440
test_synchronized_value_threadsafe_apply<std::recursive_mutex>();
509441
}
510442

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]")
516444
{
517445
test_synchronized_value_threadsafe_multiple_synchronize<std::mutex>();
518446
}
519447

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]")
525449
{
526450
test_synchronized_value_threadsafe_multiple_synchronize<std::shared_mutex>();
527451
}
528452

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]")
534454
{
535455
test_synchronized_value_threadsafe_multiple_synchronize<std::recursive_mutex>();
536456
}

0 commit comments

Comments
 (0)