test-reporter-tap.cpp File
C++ source file with implementations for the µTest++ TAP test reporter methods. More...
Namespaces Index
Description
C++ source file with implementations for the µTest++ TAP test reporter methods.
This source file contains the implementations for test_reporter_tap, a concrete implementation of the test_reporter abstract interface that formats test results according to the Test Anything Protocol (TAP).
All definitions reside within the micro_os_plus::micro_test_plus namespace, ensuring clear separation from user code and minimising the risk of naming conflicts.
This file must be included when building the µTest++ library.
File Listing
The file content with the documentation metadata removed is:
37#if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
38#include <micro-os-plus/config.h>
47#pragma GCC diagnostic ignored "-Waggregate-return"
49#pragma clang diagnostic ignored "-Wunknown-warning-option"
50#pragma clang diagnostic ignored "-Wc++98-compat"
51#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
80 if (!message.empty ())
82 *this << message.c_str ();
122 std::string& message, [[maybe_unused]] const bool hasExpression,
132 if (!message.empty ())
134 *this << " - " << message.c_str ();
143 *this << " expect: ";
162 *this << " aborted...";
165 *this << " at:" << endl;
167 *this << " filename: "
174 *this << " ..." << endl;
261#pragma GCC diagnostic push
262#if defined(__clang__)
263#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
265 printf (" # Subtest: %s - test case started\n", name);
269 printf (" not ok %zu - %s # { test case FAILED, %zu check%s "
270 "passed, %zu failed }\n",
279#pragma GCC diagnostic pop
290#pragma GCC diagnostic push
291#if defined(__clang__)
292#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
294 printf (" # Subtest: %s - test case\n", name);
299 " ok %zu - %s # { test case passed, %zu check%s }\n",
306#pragma GCC diagnostic pop
311#pragma GCC diagnostic push
312#if defined(__clang__)
313#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
316 " ok %zu - %s # { test case passed, %zu check%s }\n",
323#pragma GCC diagnostic pop
361#pragma GCC diagnostic push
362#if defined(__clang__)
363#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
365 printf ("# Subtest: %s - test suite\n", name);
366#pragma GCC diagnostic pop
391#if defined(_WIN32) || defined(CLOCK_MONOTONIC)
392 long milliseconds = 0;
393 long microseconds = 0;
394 suite.compute_elapsed_time (suite.begin_time, suite.end_time, milliseconds,
407#pragma GCC diagnostic push
408#if defined(__clang__)
409#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
415 printf ("ok %zu - %s # { test suite passed, %zu check%s in %zu test "
421#if defined(_WIN32) || defined(CLOCK_MONOTONIC)
422 if (milliseconds > 0 || microseconds > 0)
424 printf (", time: %ld.%03ld ms", milliseconds, microseconds);
428#pragma GCC diagnostic pop
432#pragma GCC diagnostic push
433#if defined(__clang__)
434#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
440 printf ("not ok %zu - %s # { test suite FAILED, %zu check%s passed, "
441 "%zu failed, in %zu test case%s",
446#if defined(_WIN32) || defined(CLOCK_MONOTONIC)
447 if (milliseconds > 0 || microseconds > 0)
449 printf (", time: %ld.%03ld ms", milliseconds, microseconds);
453#pragma GCC diagnostic pop
464 printf ("\nTAP version 14\n");
465 printf ("1..%zu\n", test_suites_count ? test_suites_count : 1);
471#pragma GCC diagnostic push
472#pragma GCC diagnostic ignored "-Wshadow"
478#if defined(_WIN32) || defined(CLOCK_MONOTONIC)
479 long milliseconds = 0;
480 long microseconds = 0;
481 runner.default_test_suite->compute_elapsed_time (
482 runner.begin_time, runner.end_time, milliseconds, microseconds);
485#pragma GCC diagnostic push
486#if defined(__clang__)
487#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
489 printf ("\n# { total: %zu check%s passed, %zu failed, in %zu test "
490 "case%s, %zu test suite%s",
491 runner.totals.successful_checks,
492 runner.totals.successful_checks == 1 ? "" : "s",
493 runner.totals.failed_checks, runner.totals.test_cases_count,
494 runner.totals.test_cases_count == 1 ? "" : "s",
495 runner.test_suites_count (),
496 runner.test_suites_count () == 1 ? "" : "s");
498#if defined(_WIN32) || defined(CLOCK_MONOTONIC)
499 if (milliseconds > 0 || microseconds > 0)
501 printf (", time: %ld.%03ld ms", milliseconds, microseconds);
505#pragma GCC diagnostic pop
509#pragma GCC diagnostic pop
523 printf ("%s", out_.c_str ());
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.14.0.