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:
37#if __has_include(<micro-os-plus/project-config.h>)
38#include <micro-os-plus/project-config.h>
39#elif __has_include(<micro-os-plus/config.h>)
41 "micro-os-plus/config.h is deprecated, rename to micro-os-plus/project-config.h and include it instead of micro-os-plus/config.h"
42#include <micro-os-plus/config.h>
45#if __has_include(<micro-os-plus/micro-test-plus-defines.h>)
46#include <micro-os-plus/micro-test-plus-defines.h>
49#if defined(MICRO_OS_PLUS_TRACE)
50#include <micro-os-plus/diag/trace.h>
63#pragma GCC diagnostic ignored "-Waggregate-return"
65#pragma clang diagnostic ignored "-Wunknown-warning-option"
66#pragma clang diagnostic ignored "-Wc++98-compat"
67#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
84 std::unique_ptr<std::vector<std::string_view>> argvs)
87#if defined(MICRO_OS_PLUS_TRACE) \
88 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
89 trace::printf ("%s\n", __PRETTY_FUNCTION__);
101#if defined(MICRO_OS_PLUS_TRACE) \
102 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
103 trace::printf ("%s\n", __PRETTY_FUNCTION__);
139#if defined(MICRO_OS_PLUS_TRACE) \
140 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
141 trace::printf ("%s\n", __PRETTY_FUNCTION__);
145#pragma GCC diagnostic push
146#if defined(__clang__)
147#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
158 const char* message = "TAP version 14";
166 printf ("%s\n", message);
174#pragma GCC diagnostic pop
190#if defined(MICRO_OS_PLUS_TRACE) \
191 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
192 trace::printf ("%s\n", __PRETTY_FUNCTION__);
196#pragma GCC diagnostic push
197#if defined(__clang__)
198#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
204 uint32_t milliseconds = 0;
205 uint32_t microseconds = 0;
211 char message_summary[32];
212 snprintf (message_summary, sizeof (message_summary), "1..%zu",
215 char message_totals[160];
216 snprintf (message_totals, sizeof (message_totals),
217 "total: %zu check%s passed, %zu failed, in %zu test "
218 "case%s, %zu test suite%s",
224 total_suites_count, total_suites_count == 1 ? "" : "s");
226 char message_time[120] = "";
227 if (milliseconds > 0 || microseconds > 0)
229 snprintf (message_time, sizeof (message_time),
230 ", time: %" PRIu32 ".%03" PRIu32 " ms", milliseconds,
236 fprintf (output_file_, "%s\n# { %s%s }\n", message_summary,
237 message_totals, message_time);
249 printf ("%s\n", message_summary);
258 printf ("# { %s%s }\n", message_totals, message_time);
264#pragma GCC diagnostic pop
281#if defined(MICRO_OS_PLUS_TRACE) \
282 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
283#pragma GCC diagnostic push
284#if defined(__clang__)
285#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
287 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, suite.name ());
288#pragma GCC diagnostic pop
292#pragma GCC diagnostic push
293#if defined(__clang__)
294#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
298 char message_subtest[120];
299 snprintf (message_subtest, sizeof (message_subtest), "# Subtest: %s",
314 printf ("%s\n", message_subtest);
322#pragma GCC diagnostic pop
338#if defined(MICRO_OS_PLUS_TRACE) \
339 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
340#pragma GCC diagnostic push
341#if defined(__clang__)
342#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
345 "%s '%s' +%zu -%zu in xc%zu, xs%zu | cs%zu\n", __PRETTY_FUNCTION__,
351#pragma GCC diagnostic pop
355#pragma GCC diagnostic push
356#if defined(__clang__)
357#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
361 uint32_t milliseconds = 0;
362 uint32_t microseconds = 0;
370 char message_summary[40];
371 snprintf (message_summary, sizeof (message_summary), "%s1..%zu",
373 char message_totals[120];
376 snprintf (message_totals, sizeof (message_totals),
377 "ok %zu - %s # { passed, %zu check%s in %zu "
387 snprintf (message_totals, sizeof (message_totals),
388 "not ok %zu - %s # { FAILED, %zu check%s "
389 "passed, %zu failed, in %zu test case%s",
398 char message_time[120] = "";
399 if (milliseconds > 0 || microseconds > 0)
401 snprintf (message_time, sizeof (message_time),
402 ", time: %" PRIu32 ".%03" PRIu32 " ms", milliseconds,
410 fprintf (output_file_, "%s\n%s%s }\n", message_summary, message_totals,
434 printf ("%s\n%s%s }\n", message_summary, message_totals,
445 printf ("%s\n%s%s }\n", message_summary, message_totals,
457#pragma GCC diagnostic pop
474#if defined(MICRO_OS_PLUS_TRACE) \
475 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
476#pragma GCC diagnostic push
477#if defined(__clang__)
478#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
480 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, subtest.name ());
481#pragma GCC diagnostic pop
485#pragma GCC diagnostic push
486#if defined(__clang__)
487#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
501 char message_subtest[120];
502 snprintf (message_subtest, sizeof (message_subtest), "%s# Subtest: %s",
517 printf ("%s\n", message_subtest);
525#pragma GCC diagnostic pop
541#if defined(MICRO_OS_PLUS_TRACE) \
542 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
543#pragma GCC diagnostic push
544#if defined(__clang__)
545#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
547 trace::printf ("%s '%s' i%zu +%zu -%zu in xc%zu, xs%zu | cs%zu\n",
555#pragma GCC diagnostic pop
559#pragma GCC diagnostic push
560#if defined(__clang__)
561#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
568 char message_summary[40];
569 snprintf (message_summary, sizeof (message_summary), "%s1..%zu",
574 char message_totals[120];
577 snprintf (message_totals, sizeof (message_totals),
578 "%sok %zu - %s # { passed, %zu check%s }", indent.c_str (),
585 snprintf (message_totals, sizeof (message_totals),
586 "%snot ok %zu - %s # { FAILED, %zu check%s "
587 "passed, %zu failed }",
598 fprintf (output_file_, "%s\n%s\n", message_summary, message_totals);
619 printf ("%s\n", message_summary);
626 printf ("%s1..%zu\n", indent2.c_str (),
630 printf ("%s\n", message_totals);
641 printf ("%s\n%s\n", message_summary, message_totals);
652#pragma GCC diagnostic pop
686 *this << indent (level + 1) << "ok "
688 if (!message.empty ())
690 *this << message.c_str ();
721 std::string& message, const bool has_expression,
726 *this << indent (level + 1) << "not ok "
729 if (!message.empty ())
731 *this << " - " << message.c_str ();
737 *this << indent (level + 1) << " ---";
741 *this << indent (level + 1) << " condition: ";
759 *this << " aborted...";
766 *this << indent (level + 1) << " at:" << endl;
767 *this << indent (level + 1)
770 *this << indent (level + 1) << " line: " << location.line () << endl;
772 *this << indent (level + 1) << " ..." << endl;
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.