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:
41#if __has_include("micro-os-plus/diag/trace.h")
42#include "micro-os-plus/diag/trace.h"
51#pragma GCC diagnostic ignored "-Waggregate-return"
53#pragma clang diagnostic ignored "-Wunknown-warning-option"
54#pragma clang diagnostic ignored "-Wc++98-compat"
55#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
56#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
62#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_ENABLED)
77 std::unique_ptr<std::vector<std::string_view>> argvs)
80#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
81 trace::printf ("%s\n", __PRETTY_FUNCTION__);
93#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
94 trace::printf ("%s\n", __PRETTY_FUNCTION__);
130#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
131 trace::printf ("%s\n", __PRETTY_FUNCTION__);
141 const char* message = "TAP version 14";
149 printf ("%s\n", message);
169#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
170 trace::printf ("%s\n", __PRETTY_FUNCTION__);
175 uint32_t milliseconds = 0;
176 uint32_t microseconds = 0;
182 char message_summary[32];
183 snprintf (message_summary, sizeof (message_summary), "1..%zu",
186 char message_totals[160];
187 snprintf (message_totals, sizeof (message_totals),
188 "total: %zu check%s passed, %zu failed, in %zu test "
189 "case%s, %zu test suite%s",
195 total_suites_count, total_suites_count == 1 ? "" : "s");
197 char message_time[120] = "";
198 if (milliseconds > 0 || microseconds > 0)
200 snprintf (message_time, sizeof (message_time),
201 ", time: %" PRIu32 ".%03" PRIu32 " ms", milliseconds,
207 fprintf (output_file_, "%s\n# { %s%s }\n", message_summary,
208 message_totals, message_time);
220 printf ("%s\n", message_summary);
229 printf ("# { %s%s }\n", message_totals, message_time);
248#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
249 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, suite.name ());
252 char message_subtest[120];
253 snprintf (message_subtest, sizeof (message_subtest), "# Subtest: %s",
268 printf ("%s\n", message_subtest);
288#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
290 "%s '%s' +%zu -%zu in xc%zu, xs%zu | cs%zu\n", __PRETTY_FUNCTION__,
297 uint32_t milliseconds = 0;
298 uint32_t microseconds = 0;
306 char message_summary[40];
307 snprintf (message_summary, sizeof (message_summary), "%s1..%zu",
309 char message_totals[120];
312 snprintf (message_totals, sizeof (message_totals),
313 "ok %zu - %s # { passed, %zu check%s in %zu "
323 snprintf (message_totals, sizeof (message_totals),
324 "not ok %zu - %s # { FAILED, %zu check%s "
325 "passed, %zu failed, in %zu test case%s",
334 char message_time[120] = "";
335 if (milliseconds > 0 || microseconds > 0)
337 snprintf (message_time, sizeof (message_time),
338 ", time: %" PRIu32 ".%03" PRIu32 " ms", milliseconds,
346 fprintf (output_file_, "%s\n%s%s }\n", message_summary, message_totals,
370 printf ("%s\n%s%s }\n", message_summary, message_totals,
381 printf ("%s\n%s%s }\n", message_summary, message_totals,
406#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
407 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, subtest.name ());
420 char message_subtest[120];
421 snprintf (message_subtest, sizeof (message_subtest), "%s# Subtest: %s",
436 printf ("%s\n", message_subtest);
456#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
457 trace::printf ("%s '%s' i%zu +%zu -%zu in xc%zu, xs%zu | cs%zu\n",
470 char message_summary[40];
471 snprintf (message_summary, sizeof (message_summary), "%s1..%zu",
476 char message_totals[120];
479 snprintf (message_totals, sizeof (message_totals),
480 "%sok %zu - %s # { passed, %zu check%s }", indent.c_str (),
487 snprintf (message_totals, sizeof (message_totals),
488 "%snot ok %zu - %s # { FAILED, %zu check%s "
489 "passed, %zu failed }",
500 fprintf (output_file_, "%s\n%s\n", message_summary, message_totals);
521 printf ("%s\n", message_summary);
528 printf ("%s1..%zu\n", indent2.c_str (),
532 printf ("%s\n", message_totals);
543 printf ("%s\n%s\n", message_summary, message_totals);
584 *this << indent (level + 1) << "ok "
586 if (!message.empty ())
588 *this << message.c_str ();
619 std::string& message, const bool has_expression,
624 *this << indent (level + 1) << "not ok "
627 if (!message.empty ())
629 *this << " - " << message.c_str ();
635 *this << indent (level + 1) << " ---";
639 *this << indent (level + 1) << " condition: ";
657 *this << " aborted...";
664 *this << indent (level + 1) << " at:" << endl;
665 *this << indent (level + 1)
668 *this << indent (level + 1) << " line: " << location.line () << endl;
670 *this << indent (level + 1) << " ..." << endl;
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.