C++ source file with implementations for the µTest++ TAP suite reporter methods. More...
Namespaces Index
Description
C++ source file with implementations for the µTest++ TAP suite reporter methods.
This source file contains the implementations for reporter_tap, a concrete implementation of the reporter abstract interface that formats suite 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:
40#if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
41#include <micro-os-plus/config.h>
44#if defined(MICRO_OS_PLUS_TRACE)
45#include <micro-os-plus/diag/trace.h>
55#pragma GCC diagnostic ignored "-Waggregate-return"
57#pragma clang diagnostic ignored "-Wunknown-warning-option"
58#pragma clang diagnostic ignored "-Wc++98-compat"
59#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
76 std::unique_ptr<std::vector<std::string_view>> argvs)
79#if defined(MICRO_OS_PLUS_TRACE) \
80 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
81 trace::printf ("%s\n", __PRETTY_FUNCTION__);
93#if defined(MICRO_OS_PLUS_TRACE) \
94 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
95 trace::printf ("%s\n", __PRETTY_FUNCTION__);
131#if defined(MICRO_OS_PLUS_TRACE) \
132 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
133 trace::printf ("%s\n", __PRETTY_FUNCTION__);
137#pragma GCC diagnostic push
138#if defined(__clang__)
139#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
150 const char* message = "TAP version 14";
158 printf ("%s\n", message);
166#pragma GCC diagnostic pop
182#if defined(MICRO_OS_PLUS_TRACE) \
183 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
184 trace::printf ("%s\n", __PRETTY_FUNCTION__);
188#pragma GCC diagnostic push
189#if defined(__clang__)
190#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
196 uint32_t milliseconds = 0;
197 uint32_t microseconds = 0;
203 char message_summary[32];
204 snprintf (message_summary, sizeof (message_summary), "1..%zu",
207 char message_totals[160];
208 snprintf (message_totals, sizeof (message_totals),
209 "total: %zu check%s passed, %zu failed, in %zu test "
210 "case%s, %zu test suite%s",
216 total_suites_count, total_suites_count == 1 ? "" : "s");
218 char message_time[120] = "";
219 if (milliseconds > 0 || microseconds > 0)
221 snprintf (message_time, sizeof (message_time),
222 ", time: %" PRIu32 ".%03" PRIu32 " ms", milliseconds,
228 fprintf (output_file_, "%s\n# { %s%s }\n", message_summary,
229 message_totals, message_time);
241 printf ("%s\n", message_summary);
250 printf ("# { %s%s }\n", message_totals, message_time);
256#pragma GCC diagnostic pop
273#if defined(MICRO_OS_PLUS_TRACE) \
274 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
275#pragma GCC diagnostic push
276#if defined(__clang__)
277#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
279 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, suite.name ());
280#pragma GCC diagnostic pop
284#pragma GCC diagnostic push
285#if defined(__clang__)
286#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
290 char message_subtest[120];
291 snprintf (message_subtest, sizeof (message_subtest), "# Subtest: %s",
306 printf ("%s\n", message_subtest);
314#pragma GCC diagnostic pop
330#if defined(MICRO_OS_PLUS_TRACE) \
331 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
332#pragma GCC diagnostic push
333#if defined(__clang__)
334#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
337 "%s '%s' +%zu -%zu in xc%zu, xs%zu | cs%zu\n", __PRETTY_FUNCTION__,
343#pragma GCC diagnostic pop
347#pragma GCC diagnostic push
348#if defined(__clang__)
349#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
353 uint32_t milliseconds = 0;
354 uint32_t microseconds = 0;
362 char message_summary[40];
363 snprintf (message_summary, sizeof (message_summary), "%s1..%zu",
365 char message_totals[120];
368 snprintf (message_totals, sizeof (message_totals),
369 "ok %zu - %s # { passed, %zu check%s in %zu "
379 snprintf (message_totals, sizeof (message_totals),
380 "not ok %zu - %s # { FAILED, %zu check%s "
381 "passed, %zu failed, in %zu test case%s",
390 char message_time[120] = "";
391 if (milliseconds > 0 || microseconds > 0)
393 snprintf (message_time, sizeof (message_time),
394 ", time: %" PRIu32 ".%03" PRIu32 " ms", milliseconds,
402 fprintf (output_file_, "%s\n%s%s }\n", message_summary, message_totals,
426 printf ("%s\n%s%s }\n", message_summary, message_totals,
437 printf ("%s\n%s%s }\n", message_summary, message_totals,
449#pragma GCC diagnostic pop
466#if defined(MICRO_OS_PLUS_TRACE) \
467 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
468#pragma GCC diagnostic push
469#if defined(__clang__)
470#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
472 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, subtest.name ());
473#pragma GCC diagnostic pop
477#pragma GCC diagnostic push
478#if defined(__clang__)
479#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
493 char message_subtest[120];
494 snprintf (message_subtest, sizeof (message_subtest), "%s# Subtest: %s",
509 printf ("%s\n", message_subtest);
517#pragma GCC diagnostic pop
533#if defined(MICRO_OS_PLUS_TRACE) \
534 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
535#pragma GCC diagnostic push
536#if defined(__clang__)
537#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
539 trace::printf ("%s '%s' i%zu +%zu -%zu in xc%zu, xs%zu | cs%zu\n",
547#pragma GCC diagnostic pop
551#pragma GCC diagnostic push
552#if defined(__clang__)
553#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
560 char message_summary[40];
561 snprintf (message_summary, sizeof (message_summary), "%s1..%zu",
566 char message_totals[120];
569 snprintf (message_totals, sizeof (message_totals),
570 "%sok %zu - %s # { passed, %zu check%s }", indent.c_str (),
577 snprintf (message_totals, sizeof (message_totals),
578 "%snot ok %zu - %s # { FAILED, %zu check%s "
579 "passed, %zu failed }",
590 fprintf (output_file_, "%s\n%s\n", message_summary, message_totals);
611 printf ("%s\n", message_summary);
618 printf ("%s1..%zu\n", indent2.c_str (),
622 printf ("%s\n", message_totals);
633 printf ("%s\n%s\n", message_summary, message_totals);
644#pragma GCC diagnostic pop
678 *this << indent (level + 1) << "ok "
680 if (!message.empty ())
682 *this << message.c_str ();
713 std::string& message, const bool has_expression,
718 *this << indent (level + 1) << "not ok "
721 if (!message.empty ())
723 *this << " - " << message.c_str ();
729 *this << indent (level + 1) << " ---";
733 *this << indent (level + 1) << " condition: ";
751 *this << " aborted...";
758 *this << indent (level + 1) << " at:" << endl;
759 *this << indent (level + 1)
762 *this << indent (level + 1) << " line: " << location.line () << endl;
764 *this << indent (level + 1) << " ..." << endl;
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.