Skip to content

Commit 291c4d5

Browse files
Merge pull request #236 from dreamer-coding/main
Rework themes
2 parents b461d4a + a00a84a commit 291c4d5

File tree

4 files changed

+1172
-1449
lines changed

4 files changed

+1172
-1449
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ The Pizza Test CLI provides an efficient way to run and manage tests directly fr
4040
| `show` | Show test cases with optional parameters. | Options: `--test-name`, `--suite-name`, `--tag`, `--result <fail/pass/all>`, `--mode <list/tree/graph>`, `--verbose <plain/ci/doge>`. Default mode is `list` and verbose is `plain`. |
4141
| `color=<mode>` | Set color mode. | Options: `enable/disable/auto` (`auto` enables color only if stdout is a terminal). |
4242
| `config=<file>` | Specify a configuration file. | Must be named `pizza_test.ini`; other filenames produce an error. |
43-
| `theme=<name>` | Set the theme for output. | Options: `fossil/catch/doctest/cpputest/tap/gtest/unity`. |
43+
| `theme=<name>` | Set the theme for output. | Options: `fossil/light/dark`. |
4444
| `timeout=<sec>` | Set the timeout for commands. | Default is 60 seconds; sets an internal timeout for all command execution. |
4545
| `report` | Export test results for CI integration. | Supported formats: `json/fson/yaml/csv`. |
4646

4747
> **Note:** In addition to the `--help` option, Pizza Test CLI supports `--help` and subcommand-specific help commands. You can use `<command> --help` (e.g., `run --help`) to display detailed usage information for any command or subcommand. This provides flexible ways to access documentation directly from the terminal.
4848
4949
| Section | Key | Description | Notes / Valid Values |
5050
|---------|----------------------|------------------------------------------------------------------|-------------------------------------------------------------------------------------|
51-
| general | theme | Set the theme for output. | Options: `fossil`, `catch`, `doctest`, `cpputest`, `tap`, `gtest`, `unity`. |
51+
| general | theme | Set the theme for output. | Options: `fossil/light/dark`. |
5252
| test | run.fail_fast | Enable or disable fail-fast mode. | `0` = disabled, `1` = enabled. |
5353
| test | run.only | Specify which tests to run. | Comma-separated list of test names; wildcards supported. |
5454
| test | run.repeat | Repeat test execution multiple times. | Integer value, e.g., `1` (default). |

code/logic/common.c

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// macro definitions
3030
// *****************************************************************************
3131

32-
#define FOSSIL_PIZZA_VERSION "1.3.4"
32+
#define FOSSIL_PIZZA_VERSION "1.3.2"
3333
#define FOSSIL_PIZZA_AUTHOR "Fossil Logic"
3434
#define FOSSIL_PIZZA_WEBSITE "https://fossillogic.com"
3535

@@ -257,13 +257,9 @@ static void _show_subhelp_color(void) {
257257

258258
static void _show_subhelp_theme(void) {
259259
pizza_io_printf("{blue}Theme command options:{reset}\n");
260-
pizza_io_printf("{cyan} fossil Fossil theme (C, C++ Fossil Test Framework){reset}\n");
261-
pizza_io_printf("{cyan} catch Catch theme (C++ Test Framework){reset}\n");
262-
pizza_io_printf("{cyan} doctest Doctest theme (C++ Test Framework){reset}\n");
263-
pizza_io_printf("{cyan} cpputest CppUTest theme (C Test Framework){reset}\n");
264-
pizza_io_printf("{cyan} tap TAP theme (C Test Framework){reset}\n");
265-
pizza_io_printf("{cyan} gtest GoogleTest theme (C++ Test Framework){reset}\n");
266-
pizza_io_printf("{cyan} unity Unity theme (C Test Framework){reset}\n");
260+
pizza_io_printf("{cyan} fossil Fossil theme{reset}\n");
261+
pizza_io_printf("{cyan} light Light theme{reset}\n");
262+
pizza_io_printf("{cyan} dark Dark theme{reset}\n");
267263
exit(EXIT_SUCCESS);
268264
}
269265

@@ -605,24 +601,12 @@ fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv) {
605601
if (pizza_io_cstr_compare(theme_str, "fossil") == 0) {
606602
pallet.theme = PIZZA_THEME_FOSSIL;
607603
G_PIZZA_THEME = PIZZA_THEME_FOSSIL;
608-
} else if (pizza_io_cstr_compare(theme_str, "catch") == 0) {
609-
pallet.theme = PIZZA_THEME_CATCH;
610-
G_PIZZA_THEME = PIZZA_THEME_CATCH;
611-
} else if (pizza_io_cstr_compare(theme_str, "doctest") == 0) {
612-
pallet.theme = PIZZA_THEME_DOCTEST;
613-
G_PIZZA_THEME = PIZZA_THEME_DOCTEST;
614-
} else if (pizza_io_cstr_compare(theme_str, "cpputest") == 0) {
615-
pallet.theme = PIZZA_THEME_CPPUTEST;
616-
G_PIZZA_THEME = PIZZA_THEME_CPPUTEST;
617-
} else if (pizza_io_cstr_compare(theme_str, "tap") == 0) {
618-
pallet.theme = PIZZA_THEME_TAP;
619-
G_PIZZA_THEME = PIZZA_THEME_TAP;
620-
} else if (pizza_io_cstr_compare(theme_str, "gtest") == 0) {
621-
pallet.theme = PIZZA_THEME_GOOGLETEST;
622-
G_PIZZA_THEME = PIZZA_THEME_GOOGLETEST;
623-
} else if (pizza_io_cstr_compare(theme_str, "unity") == 0) {
624-
pallet.theme = PIZZA_THEME_UNITY;
625-
G_PIZZA_THEME = PIZZA_THEME_UNITY;
604+
} else if (pizza_io_cstr_compare(theme_str, "dark") == 0) {
605+
pallet.theme = PIZZA_THEME_DARK;
606+
G_PIZZA_THEME = PIZZA_THEME_DARK;
607+
} else if (pizza_io_cstr_compare(theme_str, "light") == 0) {
608+
pallet.theme = PIZZA_THEME_LIGHT;
609+
G_PIZZA_THEME = PIZZA_THEME_LIGHT;
626610
}
627611
} else if (pizza_io_cstr_compare(argv[i], "theme") == 0) {
628612
if (i + 1 < argc && pizza_io_cstr_compare(argv[i + 1], "--help") == 0) {
@@ -762,18 +746,10 @@ int fossil_pizza_ini_parse(const char *filename, fossil_pizza_pallet_t *pallet)
762746
if (pizza_io_cstr_compare(key, "theme") == 0) {
763747
if (pizza_io_cstr_compare(value, "fossil") == 0) {
764748
pallet->theme = PIZZA_THEME_FOSSIL;
765-
} else if (pizza_io_cstr_compare(value, "catch") == 0) {
766-
pallet->theme = PIZZA_THEME_CATCH;
767-
} else if (pizza_io_cstr_compare(value, "doctest") == 0) {
768-
pallet->theme = PIZZA_THEME_DOCTEST;
769-
} else if (pizza_io_cstr_compare(value, "cpputest") == 0) {
770-
pallet->theme = PIZZA_THEME_CPPUTEST;
771-
} else if (pizza_io_cstr_compare(value, "tap") == 0) {
772-
pallet->theme = PIZZA_THEME_TAP;
773-
} else if (pizza_io_cstr_compare(value, "gtest") == 0) {
774-
pallet->theme = PIZZA_THEME_GOOGLETEST;
775-
} else if (pizza_io_cstr_compare(value, "unity") == 0) {
776-
pallet->theme = PIZZA_THEME_UNITY;
749+
} else if (pizza_io_cstr_compare(value, "dark") == 0) {
750+
pallet->theme = PIZZA_THEME_DARK;
751+
} else if (pizza_io_cstr_compare(value, "light") == 0) {
752+
pallet->theme = PIZZA_THEME_LIGHT;
777753
}
778754
}
779755
} else if (pizza_io_cstr_compare(section, "test") == 0) {
@@ -1199,7 +1175,7 @@ static const struct {
11991175
};
12001176

12011177
/** Lookup table for sarcastic phrases */
1202-
static const char *SARCASTIC_PHRASES[] = {
1178+
static const char *SARCASTIcpp_PHRASES[] = {
12031179
"Oh, great",
12041180
"Yeah, right",
12051181
"Nice job",
@@ -1516,8 +1492,8 @@ void pizza_io_soap_clear_custom_filters(void) {
15161492
* AI trick: prioritize sarcastic, then formal, else casual.
15171493
*/
15181494
const char *pizza_io_soap_detect_tone(const char *text) {
1519-
for (size_t i = 0; SARCASTIC_PHRASES[i] != null; i++) {
1520-
if (custom_strcasestr(text, SARCASTIC_PHRASES[i])) {
1495+
for (size_t i = 0; SARCASTIcpp_PHRASES[i] != null; i++) {
1496+
if (custom_strcasestr(text, SARCASTIcpp_PHRASES[i])) {
15211497
return "sarcastic";
15221498
}
15231499
}
@@ -2416,13 +2392,13 @@ bool pizza_io_cstr_append(cstr dest, size_t max_len, cstr src) {
24162392
// If no null-terminator found in range, dest is not safe
24172393
if (dest_len == max_len) return false;
24182394

2419-
size_t src_len = strlen(src);
2395+
size_t srcpp_len = strlen(src);
24202396

24212397
// Make sure there's enough space (including null terminator)
2422-
if (dest_len + src_len >= max_len) return false;
2398+
if (dest_len + srcpp_len >= max_len) return false;
24232399

2424-
memcpy(dest + dest_len, src, src_len);
2425-
dest[dest_len + src_len] = '\0';
2400+
memcpy(dest + dest_len, src, srcpp_len);
2401+
dest[dest_len + srcpp_len] = '\0';
24262402

24272403
return true;
24282404
}

code/logic/fossil/pizza/common.h

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ typedef const char* ccstr;
9393
* The definitions ensure compatibility across different language versions, providing
9494
* a clear and consistent way to represent null pointers.
9595
*
96-
* - **C23 and Later:** In C23 (`__STDC_VERSION__ >= 202311L`), `null` is introduced
96+
* - **C23 and Later:** In C23 (`__STDcpp_VERSION__ >= 202311L`), `null` is introduced
9797
* as a type-safe null pointer constant. The `null` macro directly maps to this
9898
* standard definition.
9999
*
@@ -105,7 +105,7 @@ typedef const char* ccstr;
105105
* across different compilers and platforms, reducing the risk of undefined behavior
106106
* in pointer operations.
107107
*/
108-
#if __cplusplus >= 201103L || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
108+
#if __cplusplus >= 201103L || (defined(__STDcpp_VERSION__) && __STDcpp_VERSION__ >= 202311L)
109109
#define null nullptr
110110
#else
111111
#define null ((void*)0)
@@ -138,7 +138,7 @@ typedef const char* ccstr;
138138
* @return The casted pointer or `null` if the input pointer is null.
139139
*/
140140
#ifdef __cplusplus
141-
#define safe_cast(type, ptr) ((notnull(ptr)) ? (static_cast<type>(ptr)) : null)
141+
#define safe_cast(type, ptr) ((notnull(ptr)) ? (staticpp_cast<type>(ptr)) : null)
142142
#else
143143
#define safe_cast(type, ptr) ((notnull(ptr)) ? ((type)(ptr)) : null)
144144
#endif
@@ -147,7 +147,7 @@ typedef const char* ccstr;
147147
* @brief Marks a variable as intentionally unused to prevent warnings.
148148
*/
149149
#ifndef unused
150-
#if defined(__GNUC__) || defined(__clang__)
150+
#if defined(__GNUcpp__) || defined(__clang__)
151151
#define unused(x) (void)(x)
152152
#else
153153
#define unused(x) /* no-op */
@@ -159,10 +159,10 @@ typedef const char* ccstr;
159159
*
160160
* Provides stronger safety checks at compile time.
161161
*/
162-
#if defined(__clang__) || defined(__GNUC__)
162+
#if defined(__clang__) || defined(__GNUcpp__)
163163
#define nullable __attribute__((nullable))
164164
#define nonnull __attribute__((nonnull))
165-
#elif defined(_MSC_VER)
165+
#elif defined(_MScpp_VER)
166166
#define nullable _Null_terminated_
167167
#define nonnull _In_
168168
#else
@@ -175,7 +175,7 @@ typedef const char* ccstr;
175175
*
176176
* Helps the compiler optimize branches based on expected conditions.
177177
*/
178-
#if defined(__GNUC__) || defined(__clang__)
178+
#if defined(__GNUcpp__) || defined(__clang__)
179179
#define likely(x) __builtin_expect(!!(x), 1)
180180
#define unlikely(x) __builtin_expect(!!(x), 0)
181181
#else
@@ -221,16 +221,9 @@ FOSSIL_PIZZA_API void fossil_pizza_hash(const char *input, const char *output, u
221221
// *****************************************************************************
222222

223223
typedef enum {
224-
PIZZA_THEME_FOSSIL, // C,C++ Fossil Test Framework
225-
PIZZA_THEME_CATCH, // C++ Test Framework
226-
PIZZA_THEME_DOCTEST, // C++ Test Framework
227-
PIZZA_THEME_CPPUTEST, // C Test Framework
228-
PIZZA_THEME_TAP, // C Test Framework
229-
PIZZA_THEME_GOOGLETEST, // C++ Test Framework
230-
PIZZA_THEME_UNITY, // C Test Framework
231-
PIZZA_THEME_ACUTEST, // C Test Framework
232-
PIZZA_THEME_MINUNIT, // C Test Framework
233-
PIZZA_THEME_CMOCKA // C Test Framework
224+
PIZZA_THEME_FOSSIL, // Default Fossil Logic Theme for Fossil Test Framework
225+
PIZZA_THEME_LIGHT, // Light Theme for Fossil Test Framework
226+
PIZZA_THEME_DARK, // Dark Theme for Fossil Test Framework
234227
} fossil_pizza_cli_theme_t;
235228

236229
typedef enum {

0 commit comments

Comments
 (0)