| 1 | #cxx . . $ `<file>/src/cute_reporter.c`/include <cgreen/cute_reporter.h>cxx . . $ `<file>/include/cgreen/cute_reporter.h`/ |
| 2 | #include <cgreen/breadcrumb.h>cxx . . $ `<file>/include/cgreen/breadcrumb.h`/ |
| 3 | #include <stdlib.h> |
| 4 | #include <stdio.h> |
| 5 | #include <string.h> |
| 6 | |
| 7 | #include "cute_reporter_internal.h"cxx . . $ `<file>/src/cute_reporter_internal.h`/ |
| 8 | |
| 9 | #ifdef __ANDROID__ |
| 10 | #include "cgreen/internal/android_headers/androidcompat.h" |
| 11 | #endif // #ifdef __ANDROID__ |
| 12 | |
| 13 | typedef structcxx . . $ $anonymous_type_3beb84fc77943988_0# { |
| 14 | CutePrintercxx . . $ CutePrinter# *printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.; |
| 15 | CuteVPrintercxx . . $ CuteVPrinter# *vprintercxx . . $ $anonymous_type_3beb84fc77943988_0#vprinter.; |
| 16 | int error_countcxx . . $ $anonymous_type_3beb84fc77943988_0#error_count.; // For status within the test case process |
| 17 | int previous_errorcxx . . $ $anonymous_type_3beb84fc77943988_0#previous_error.; // For status outside the test case process |
| 18 | } CuteMemocxx . . $ CuteMemo#; |
| 19 | |
| 20 | static void cute_start_suitecxx . . $ cute_start_suite(8490445735e6bcce).(TestReportercxx . . $ TestReporter# *reporter, |
| 21 | const char *name, const int number_of_tests); |
| 22 | static void cute_start_testcxx . . $ cute_start_test(499118f5be74126f).(TestReportercxx . . $ TestReporter# *reporter, |
| 23 | const char *name); |
| 24 | static void show_failcxx . . $ show_fail(fabf0cf23815ef65).(TestReportercxx . . $ TestReporter# *reporter, const char *file, int line, |
| 25 | const char *message, va_listcxx . . $ va_list# arguments); |
| 26 | static void show_passcxx . . $ show_pass(fabf0cf23815ef65).(TestReportercxx . . $ TestReporter# *reporter, const char *file, int line, |
| 27 | const char *message, va_listcxx . . $ va_list# arguments); |
| 28 | static void cute_failed_to_completecxx . . $ cute_failed_to_complete(fabf0cf23815ef65).(TestReportercxx . . $ TestReporter# *reporter, |
| 29 | const char *file, int line, const char *message, va_listcxx . . $ va_list# arguments); |
| 30 | static void cute_finish_testcxx . . $ cute_finish_test(4c7a3a1bff8d25e8).(TestReportercxx . . $ TestReporter# *reporter, |
| 31 | const char *filename, int line, const char *message); |
| 32 | static void cute_finish_suitecxx . . $ cute_finish_suite(8490445735e6bcce).(TestReportercxx . . $ TestReporter# *reporter, |
| 33 | const char *filename, int line); |
| 34 | |
| 35 | |
| 36 | void set_cute_reporter_printercxx . . $ set_cute_reporter_printer(ecb5d6da6d3395c).(TestReportercxx . . $ TestReporter# *reporter, CutePrintercxx . . $ CutePrinter# *new_printer) { |
| 37 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *)reporter->memocxx . . $ TestReporter_#memo.; |
| 38 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer. = new_printer; |
| 39 | } |
| 40 | |
| 41 | void set_cute_reporter_vprintercxx . . $ set_cute_reporter_vprinter(6046060cadba98d3).(TestReportercxx . . $ TestReporter# *reporter, CuteVPrintercxx . . $ CuteVPrinter# *new_vprinter) { |
| 42 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *)reporter->memocxx . . $ TestReporter_#memo.; |
| 43 | memo->vprintercxx . . $ $anonymous_type_3beb84fc77943988_0#vprinter. = new_vprinter; |
| 44 | } |
| 45 | |
| 46 | TestReportercxx . . $ TestReporter# *create_cute_reportercxx . . $ create_cute_reporter(a6a8ef953e197a65).(void) { |
| 47 | CuteMemocxx . . $ CuteMemo# *memo; |
| 48 | TestReportercxx . . $ TestReporter# *reporter; |
| 49 | |
| 50 | reporter = create_reportercxx . . $ create_reporter(a6a8ef953e197a65).(); |
| 51 | if (reporter == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!) { |
| 52 | return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!; |
| 53 | } |
| 54 | |
| 55 | memo = (CuteMemocxx . . $ CuteMemo# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(CuteMemocxx . . $ CuteMemo#) + 100); |
| 56 | if (memo == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!) { |
| 57 | destroy_reportercxx . . $ destroy_reporter(1083e9dac9de8fd0).(reporter); |
| 58 | return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!; |
| 59 | } |
| 60 | reporter->memocxx . . $ TestReporter_#memo. = memo; |
| 61 | |
| 62 | set_cute_reporter_printercxx . . $ set_cute_reporter_printer(ecb5d6da6d3395c).(reporter, printfcxx . . $ printf(581fddd72a8db8fc).); |
| 63 | set_cute_reporter_vprintercxx . . $ set_cute_reporter_vprinter(6046060cadba98d3).(reporter, vprintfcxx . . $ vprintf(5c80dbd47e6ebfbb).); |
| 64 | |
| 65 | reporter->start_suitecxx . . $ TestReporter_#start_suite. = &cute_start_suitecxx . . $ cute_start_suite(8490445735e6bcce).; |
| 66 | reporter->start_testcxx . . $ TestReporter_#start_test. = &cute_start_testcxx . . $ cute_start_test(499118f5be74126f).; |
| 67 | reporter->show_failcxx . . $ TestReporter_#show_fail. = &show_failcxx . . $ show_fail(fabf0cf23815ef65).; |
| 68 | reporter->show_passcxx . . $ TestReporter_#show_pass. = &show_passcxx . . $ show_pass(fabf0cf23815ef65).; |
| 69 | reporter->show_incompletecxx . . $ TestReporter_#show_incomplete. = &cute_failed_to_completecxx . . $ cute_failed_to_complete(fabf0cf23815ef65).; |
| 70 | reporter->finish_testcxx . . $ TestReporter_#finish_test. = &cute_finish_testcxx . . $ cute_finish_test(4c7a3a1bff8d25e8).; |
| 71 | reporter->finish_suitecxx . . $ TestReporter_#finish_suite. = &cute_finish_suitecxx . . $ cute_finish_suite(8490445735e6bcce).; |
| 72 | reporter->memocxx . . $ TestReporter_#memo. = memo; |
| 73 | |
| 74 | return reporter; |
| 75 | } |
| 76 | |
| 77 | static void cute_start_suitecxx . . $ cute_start_suite(8490445735e6bcce).(TestReportercxx . . $ TestReporter# *reporter, |
| 78 | const char *name, const int number_of_tests) { |
| 79 | reporter->passescxx . . $ TestReporter_#passes. = 0; |
| 80 | reporter->failurescxx . . $ TestReporter_#failures. = 0; |
| 81 | reporter->skipscxx . . $ TestReporter_#skips. = 0; |
| 82 | reporter->exceptionscxx . . $ TestReporter_#exceptions. = 0; |
| 83 | |
| 84 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *)reporter->memocxx . . $ TestReporter_#memo.; |
| 85 | reporter_start_testcxx . . $ reporter_start_test(499118f5be74126f).(reporter, name); |
| 86 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("#beginning %s %d\n", name, number_of_tests); |
| 87 | } |
| 88 | |
| 89 | static void cute_start_testcxx . . $ cute_start_test(499118f5be74126f).(TestReportercxx . . $ TestReporter# *reporter, |
| 90 | const char *name) { |
| 91 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *) reporter->memocxx . . $ TestReporter_#memo.; |
| 92 | memo->error_countcxx . . $ $anonymous_type_3beb84fc77943988_0#error_count. = reporter->failurescxx . . $ TestReporter_#failures. + reporter->exceptionscxx . . $ TestReporter_#exceptions.; |
| 93 | memo->previous_errorcxx . . $ $anonymous_type_3beb84fc77943988_0#previous_error. = 0; |
| 94 | reporter_start_testcxx . . $ reporter_start_test(499118f5be74126f).(reporter, name); |
| 95 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("#starting %s\n", name); |
| 96 | } |
| 97 | |
| 98 | static void cute_finish_testcxx . . $ cute_finish_test(4c7a3a1bff8d25e8).(TestReportercxx . . $ TestReporter# *reporter, const char *filename, int line, const char *message) { |
| 99 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *) reporter->memocxx . . $ TestReporter_#memo.; |
| 100 | const char *name = get_current_from_breadcrumbcxx . . $ get_current_from_breadcrumb(fb00be60b058c643).((CgreenBreadcrumbcxx . . $ CgreenBreadcrumb# *)reporter->breadcrumbcxx . . $ TestReporter_#breadcrumb.); |
| 101 | |
| 102 | reporter_finish_testcxx . . $ reporter_finish_test(4c7a3a1bff8d25e8).(reporter, filename, line, message); |
| 103 | if (memo->error_countcxx . . $ $anonymous_type_3beb84fc77943988_0#error_count. == reporter->failurescxx . . $ TestReporter_#failures. + reporter->exceptionscxx . . $ TestReporter_#exceptions.) { |
| 104 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("#success %s OK\n", name); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | static void cute_finish_suitecxx . . $ cute_finish_suite(8490445735e6bcce).(TestReportercxx . . $ TestReporter# *reporter, const char *filename, int line) { |
| 109 | const char *name = get_current_from_breadcrumbcxx . . $ get_current_from_breadcrumb(fb00be60b058c643).((CgreenBreadcrumbcxx . . $ CgreenBreadcrumb# *)reporter->breadcrumbcxx . . $ TestReporter_#breadcrumb.); |
| 110 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *)reporter->memocxx . . $ TestReporter_#memo.; |
| 111 | |
| 112 | reporter_finish_testcxx . . $ reporter_finish_test(4c7a3a1bff8d25e8).(reporter, filename, line, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!); |
| 113 | |
| 114 | reporter->total_passescxx . . $ TestReporter_#total_passes. += reporter->passescxx . . $ TestReporter_#passes.; |
| 115 | reporter->total_failurescxx . . $ TestReporter_#total_failures. += reporter->failurescxx . . $ TestReporter_#failures.; |
| 116 | reporter->total_skipscxx . . $ TestReporter_#total_skips. += reporter->skipscxx . . $ TestReporter_#skips.; |
| 117 | reporter->total_exceptionscxx . . $ TestReporter_#total_exceptions. += reporter->exceptionscxx . . $ TestReporter_#exceptions.; |
| 118 | |
| 119 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("#ending %s", name); |
| 120 | if (get_breadcrumb_depthcxx . . $ get_breadcrumb_depth(8ca6eaf309ea46b8).((CgreenBreadcrumbcxx . . $ CgreenBreadcrumb# *) reporter->breadcrumbcxx . . $ TestReporter_#breadcrumb.) == 0) { |
| 121 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.(": %d pass%s, %d failure%s, %d exception%s, %d ms.\n", |
| 122 | reporter->total_passescxx . . $ TestReporter_#total_passes., reporter->total_passescxx . . $ TestReporter_#total_passes. == 1 ? "" : "es", |
| 123 | reporter->total_failurescxx . . $ TestReporter_#total_failures., reporter->total_failurescxx . . $ TestReporter_#total_failures. == 1 ? "" : "s", |
| 124 | reporter->total_exceptionscxx . . $ TestReporter_#total_exceptions., reporter->total_exceptionscxx . . $ TestReporter_#total_exceptions. == 1 ? "" : "s", |
| 125 | reporter->total_durationcxx . . $ TestReporter_#total_duration.); |
| 126 | } else |
| 127 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("\n"); |
| 128 | } |
| 129 | |
| 130 | static void show_failcxx . . $ show_fail(fabf0cf23815ef65).(TestReportercxx . . $ TestReporter# *reporter, const char *file, int line, |
| 131 | const char *message, va_listcxx . . $ va_list# arguments) { |
| 132 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *) reporter->memocxx . . $ TestReporter_#memo.; |
| 133 | if (!memo->previous_errorcxx . . $ $anonymous_type_3beb84fc77943988_0#previous_error.) { |
| 134 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("#failure %s", |
| 135 | get_current_from_breadcrumbcxx . . $ get_current_from_breadcrumb(fb00be60b058c643).((CgreenBreadcrumbcxx . . $ CgreenBreadcrumb# *) reporter->breadcrumbcxx . . $ TestReporter_#breadcrumb.)); |
| 136 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.(" %s:%d ", file, line); |
| 137 | if (message == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!) { |
| 138 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("<FATAL: NULL for failure message>"); |
| 139 | } else { |
| 140 | memo->vprintercxx . . $ $anonymous_type_3beb84fc77943988_0#vprinter.(message, arguments); |
| 141 | } |
| 142 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("\n"); |
| 143 | memo->previous_errorcxx . . $ $anonymous_type_3beb84fc77943988_0#previous_error. = 1; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | static void show_passcxx . . $ show_pass(fabf0cf23815ef65).(TestReportercxx . . $ TestReporter# *reporter, const char *file, int line, |
| 148 | const char *message, va_listcxx . . $ va_list# arguments) { |
| 149 | (void) reporter; |
| 150 | (void) file; |
| 151 | (void) line; |
| 152 | (void) message; |
| 153 | (void) arguments; |
| 154 | } |
| 155 | |
| 156 | static void cute_failed_to_completecxx . . $ cute_failed_to_complete(fabf0cf23815ef65).(TestReportercxx . . $ TestReporter# *reporter, |
| 157 | const char *file, int line, const char *message, va_listcxx . . $ va_list# arguments) { |
| 158 | CuteMemocxx . . $ CuteMemo# *memo = (CuteMemocxx . . $ CuteMemo# *)reporter->memocxx . . $ TestReporter_#memo.; |
| 159 | |
| 160 | /* TODO: add additional message to output */ |
| 161 | (void)file; |
| 162 | (void)line; |
| 163 | (void)message; |
| 164 | (void)arguments; |
| 165 | |
| 166 | memo->printercxx . . $ $anonymous_type_3beb84fc77943988_0#printer.("#error %s failed to complete\n", |
| 167 | get_current_from_breadcrumbcxx . . $ get_current_from_breadcrumb(fb00be60b058c643).((CgreenBreadcrumbcxx . . $ CgreenBreadcrumb# *)reporter->breadcrumbcxx . . $ TestReporter_#breadcrumb.)); |
| 168 | } |
| 169 | /* vim: set ts=4 sw=4 et cindent: */ |