diff --git a/.github/ciimage/Dockerfile.debian b/.github/ciimage/Dockerfile.debian index 2e8a063e..52d13b94 100644 --- a/.github/ciimage/Dockerfile.debian +++ b/.github/ciimage/Dockerfile.debian @@ -25,7 +25,7 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* # Install Meson and Ninja using pip -RUN python3 -m pip install --no-cache-dir meson==1.3.0 ninja==1.10.2 --break-system-packages +RUN python3 -m pip install --no-cache-dir meson==1.8.0 ninja==1.10.2 --break-system-packages # Set environment variables ENV CC=clang \ diff --git a/.github/workflows/conan_ci.yml b/.github/workflows/conan_ci.yml index 634ff947..a63440bb 100644 --- a/.github/workflows/conan_ci.yml +++ b/.github/workflows/conan_ci.yml @@ -1,12 +1,17 @@ name: Conan CI on: + schedule: + - cron: '15 21 * * *' push: branches: - - main + # Match branches with version numbers like 1.2.8, 2.0.0, etc. + - '[0-9]+.[0-9]+.[0-9]+' + tags: + - 'v*' # Tag releases like v1.2.8 pull_request: branches: - - main + - '[0-9]+.[0-9]+.[0-9]+' jobs: build: @@ -21,15 +26,27 @@ jobs: with: python-version: "3.11" + - name: Cache pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + + - name: Cache Conan + uses: actions/cache@v3 + with: + path: ~/.conan + key: ${{ runner.os }}-conan + - name: Install system packages run: | - sudo apt-get update - sudo apt-get install -y ninja-build pkg-config python3-pip build-essential + sudo apt update + sudo apt install -y ninja-build pkg-config python3-pip build-essential - name: Install Meson and Conan run: | pip install --upgrade pip - pip install meson==1.3.2 conan==2.3.2 + pip install meson==1.8.0 conan==2.3.2 - name: Detect Conan profile run: conan profile detect @@ -39,11 +56,11 @@ jobs: - name: Build run: | - meson setup builddir - meson compile -C builddir + meson setup -Dwith_test=enabled builddir + meson compile -C builddir -v - name: Test - run: meson test -C builddir + run: meson test -C builddir -v - name: Package - run: conan create . --name=pizza_test --version=1.2.7 + run: conan create . --name=pizza_test --version=1.2.8 diff --git a/.github/workflows/crossfile_ci.yml b/.github/workflows/crossfile_ci.yml index a2f1cecc..aa196f78 100644 --- a/.github/workflows/crossfile_ci.yml +++ b/.github/workflows/crossfile_ci.yml @@ -1,20 +1,14 @@ name: Crossfile CI on: + schedule: + - cron: '15 21 * * *' push: - paths: - - "**.c" - - "**.h" - - "**.py" - - "**.build" - - "**.options" + branches: + - main pull_request: - paths: - - "**.c" - - "**.h" - - "**.py" - - "**.build" - - "**.options" + branches: + - main jobs: build_cross: diff --git a/.github/workflows/meson_ci.yml b/.github/workflows/meson_ci.yml index ac765315..ad677218 100644 --- a/.github/workflows/meson_ci.yml +++ b/.github/workflows/meson_ci.yml @@ -1,20 +1,14 @@ name: Meson CI on: + schedule: + - cron: '15 21 * * *' push: - paths: - - "**.c" - - "**.h" - - "**.py" - - "**.build" - - "**.options" + branches: + - main pull_request: - paths: - - "**.c" - - "**.h" - - "**.py" - - "**.build" - - "**.options" + branches: + - main jobs: build_msvc: @@ -22,7 +16,7 @@ jobs: runs-on: windows-latest strategy: matrix: - msvc_version: [2015, 2017, 2019, 2022, 2025] + msvc_version: [2019, 2022, 2025] steps: - name: Checkout code uses: actions/checkout@v5 @@ -39,11 +33,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install meson ninja - if ($env:msvc_version -eq "2015") { - choco install visualstudio2015buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --includeRecommended --includeOptional --passive" - } elseif ($env:msvc_version -eq "2017") { - choco install visualstudio2017buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive" - } elseif ($env:msvc_version -eq "2019") { + if ($env:msvc_version -eq "2019") { choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive" } elseif ($env:msvc_version -eq "2022") { choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive" @@ -62,9 +52,6 @@ jobs: build_macosx: name: Building on macOS with Xcode ${{ matrix.xcode_version }} runs-on: macos-latest - strategy: - matrix: - xcode_version: ["15.0", "15.1", "15.2", "15.3", "15.4"] steps: - name: Checkout code uses: actions/checkout@v5 @@ -76,9 +63,16 @@ jobs: with: python-version: '3.12' + - name: Install Xcode Command Line Tools + run: | + if ! xcode-select -p &>/dev/null; then + sudo xcode-select --install + until xcode-select -p &>/dev/null; do sleep 5; done + fi + - name: Install Xcode - run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode_version }}.app - + run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer + - name: Install Meson and Ninja run: | python -m pip install meson ninja diff --git a/README.md b/README.md index a4cbc3f3..8b7d1d86 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,29 @@ Pizza Test is a smart unit testing framework developed by Fossil Logic for C and | **Tag-Based Test Filtering** | Execute subsets of tests based on custom tags for better test suite organization and faster iteration. | | **Detailed Performance Insights** | In-depth statistics on execution time, memory usage, and test stability to help improve code performance and reliability. | ---- +## Command-Line + +The Pizza Test CLI provides an efficient way to run and manage tests directly from the terminal. Here are the available commands and options: + +### Commands and Options + +| Command | Description | Notes | +|-----------------------------------|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| +| `--version` | Show version information. | Useful for verifying the version of the tool in use. | +| `--dry-run` | Perform a dry run without executing commands. | Ideal for verifying test selection criteria before actual execution. | +| `--host` | Show information about the current host. | Useful for looking up the system you are running tests on. | +| `--help` | Show this help message. | Provides a quick reference for all available commands. | +| `run` | Execute tests with optional parameters. | Supports additional options like `--fail-fast` and `--repeat`. | +| `filter` | Filter tests based on criteria. | Options include filtering by test name, suite name, or tags. | +| `sort` | Sort tests by specified criteria. | Allows sorting in ascending or descending order. | +| `shuffle` | Shuffle tests with optional parameters. | Includes options for specifying a seed or shuffle criteria. | +| `show` | Show test cases with optional parameters. | Useful for listing and inspecting available test cases. | +| `color=` | Set color mode (`enable`, `disable`, `auto`). | Enhances readability in supported terminals. | +| `config=` | Specify a configuration file (must be `pizza_test.ini`). | Allows loading custom settings for test execution. | +| `theme=` | Set the theme (`fossil`, `catch`, `doctest`, etc.). | Customizes the appearance of test output. | +| `timeout=` | Set the timeout for commands (default: 60 seconds). | Ensures commands do not exceed the specified duration, helping to identify long-running tests.| -Pizza Test is a first-class citizen of the **Truthful Intelligence** ecosystem, using **Jellyfish AI** as its foundation for test integrity, learning from outcomes over time, and enabling tamper-proof validation across distributed development environments. +> **Note:** In addition to the `--help` option, Pizza Test CLI supports `--help` and subcommand-specific help commands. You can use ` --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. --- @@ -29,15 +49,25 @@ Pizza Test is a first-class citizen of the **Truthful Intelligence** ecosystem, To get started with Pizza Test, ensure you have the following installed: - **Meson Build System**: If you don’t have Meson installed, follow the installation instructions on the official [Meson website](https://mesonbuild.com/Getting-meson.html). +- **Conan Package Manager**: If you prefer using Conan, ensure it is installed by following the instructions on the official [Conan website](https://docs.conan.io/en/latest/installation.html). --- -### Adding Pizza Test Dependency +### Adding Dependency + +#### Adding via Conan GitHub repository + +Conan can install packages directly from a GitHub repository if it contains a valid conanfile.py. + +```bash +conan install git+https://github.com/fossillogic/fossil-test.git#v1.2.7 --name pizza_test --build=missing +``` #### Adding via Meson Build System 1. **Install Meson Build System**: - Install Meson version `1.3` or newer: + Install Meson version `1.8.0` or newer: + ```bash python -m pip install meson # To install Meson python -m pip install --upgrade meson # To upgrade Meson @@ -52,7 +82,7 @@ python -m pip install --upgrade meson # To upgrade Meson # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-test.git -revision = v1.2.7 +revision = v1.2.8 [provide] fossil-test = fossil_test_dep @@ -60,45 +90,13 @@ fossil-test = fossil_test_dep 3. **Integrate the Dependency**: In your `meson.build` file, integrate Fossil Test by adding the following line: + ```meson dep = dependency('fossil-test') ``` -#### Adding via Conan GitHub repository - -Conan can install packages directly from a GitHub repository if it contains a valid conanfile.py. - -```bash -# Install from GitHub (replace branch/tag if needed) -conan install git+https://github.com/fossillogic/fossil-test.git#v1.2.7 --name pizza_test --build=missing -``` - **Note**: For the best experience, always use the latest release of Pizza Test. Visit the [Pizza Test Releases](https://github.com/pizzalogic/pizza-test/releases) page for the latest versions. -## Pizza Test CLI Usage - -The Pizza Test CLI provides an efficient way to run and manage tests directly from the terminal. Here are the available commands and options: - -### Commands and Options - -| Command | Description | Notes | -|-----------------------------------|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| -| `--version` | Show version information. | Useful for verifying the version of the tool in use. | -| `--dry-run` | Perform a dry run without executing commands. | Ideal for verifying test selection criteria before actual execution. | -| `--host` | Show information about the current host. | Useful for looking up the system you are running tests on. | -| `--help` | Show this help message. | Provides a quick reference for all available commands. | -| `run` | Execute tests with optional parameters. | Supports additional options like `--fail-fast` and `--repeat`. | -| `filter` | Filter tests based on criteria. | Options include filtering by test name, suite name, or tags. | -| `sort` | Sort tests by specified criteria. | Allows sorting in ascending or descending order. | -| `shuffle` | Shuffle tests with optional parameters. | Includes options for specifying a seed or shuffle criteria. | -| `show` | Show test cases with optional parameters. | Useful for listing and inspecting available test cases. | -| `color=` | Set color mode (`enable`, `disable`, `auto`). | Enhances readability in supported terminals. | -| `config=` | Specify a configuration file (must be `pizza_test.ini`). | Allows loading custom settings for test execution. | -| `theme=` | Set the theme (`fossil`, `catch`, `doctest`, etc.). | Customizes the appearance of test output. | -| `timeout=` | Set the timeout for commands (default: 60 seconds). | Ensures commands do not exceed the specified duration, helping to identify long-running tests.| - -> **Note:** In addition to the `--help` option, Pizza Test CLI supports `--help` and subcommand-specific help commands. You can use ` --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. - ## Configure Build Options To configure the build system with testing enabled, use the following command: diff --git a/code/logic/common.c b/code/logic/common.c index b841c8a7..81448df7 100644 --- a/code/logic/common.c +++ b/code/logic/common.c @@ -19,7 +19,7 @@ // macro definitions // ***************************************************************************** -#define FOSSIL_PIZZA_VERSION "1.2.7" +#define FOSSIL_PIZZA_VERSION "1.2.8" #define FOSSIL_PIZZA_AUTHOR "Fossil Logic" #define FOSSIL_PIZZA_WEBSITE "https://fossillogic.com" diff --git a/code/logic/fossil/pizza/common.h b/code/logic/fossil/pizza/common.h index 68e5c844..9ea65602 100644 --- a/code/logic/fossil/pizza/common.h +++ b/code/logic/fossil/pizza/common.h @@ -211,7 +211,7 @@ typedef const char* ccstr; * @param output The output string to combine with the input. * @param hash_out Pointer to an array where the resulting hash will be stored. */ -void fossil_pizza_hash(const char *input, const char *output, uint8_t *hash_out); +FOSSIL_PIZZA_API void fossil_pizza_hash(const char *input, const char *output, uint8_t *hash_out); // ***************************************************************************** // Command Pallet @@ -309,7 +309,7 @@ extern fossil_pizza_cli_theme_t G_PIZZA_THEME; * @param argc The number of command line arguments. * @param argv The command line arguments. */ -fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv); +FOSSIL_PIZZA_API fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv); // ***************************************************************************** // INI Parser @@ -328,7 +328,7 @@ fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv); * @param pallet Pointer to the pallet structure to populate. * @return 0 on success, or a negative error code on failure. */ -int fossil_pizza_ini_parse(const char *filename, fossil_pizza_pallet_t *pallet); +FOSSIL_PIZZA_API int fossil_pizza_ini_parse(const char *filename, fossil_pizza_pallet_t *pallet); // ***************************************************************************** // Host information @@ -368,7 +368,7 @@ typedef struct { * @param info A pointer to a structure that will be filled with system information. * @return 0 on success, or a negative error code on failure. */ -int pizza_sys_hostinfo_get_system(pizza_sys_hostinfo_system_t *info); +FOSSIL_PIZZA_API int pizza_sys_hostinfo_get_system(pizza_sys_hostinfo_system_t *info); /** * Retrieve memory information. @@ -376,7 +376,7 @@ int pizza_sys_hostinfo_get_system(pizza_sys_hostinfo_system_t *info); * @param info A pointer to a structure that will be filled with memory information. * @return 0 on success, or a negative error code on failure. */ -int pizza_sys_hostinfo_get_memory(pizza_sys_hostinfo_memory_t *info); +FOSSIL_PIZZA_API int pizza_sys_hostinfo_get_memory(pizza_sys_hostinfo_memory_t *info); /** * Retrieve endianness information. @@ -384,7 +384,7 @@ int pizza_sys_hostinfo_get_memory(pizza_sys_hostinfo_memory_t *info); * @param info A pointer to a structure that will be filled with endianness information. * @return 0 on success, or a negative error code on failure. */ -int pizza_sys_hostinfo_get_endianness(pizza_sys_hostinfo_endianness_t *info); +FOSSIL_PIZZA_API int pizza_sys_hostinfo_get_endianness(pizza_sys_hostinfo_endianness_t *info); // ***************************************************************************** // Soap sanitizer @@ -396,7 +396,7 @@ int pizza_sys_hostinfo_get_endianness(pizza_sys_hostinfo_endianness_t *info); * @param text The input text to sanitize. * @return A dynamically allocated sanitized string (must be freed by the caller). */ -char *pizza_io_soap_sanitize(const char *text); +FOSSIL_PIZZA_API char *pizza_io_soap_sanitize(const char *text); /** * @brief Suggest proper alternatives for rot-brain words or grammar fixes. @@ -404,7 +404,7 @@ char *pizza_io_soap_sanitize(const char *text); * @param text The input text. * @return A dynamically allocated string with suggestions (must be freed by the caller). */ -char *pizza_io_soap_suggest(const char *text); +FOSSIL_PIZZA_API char *pizza_io_soap_suggest(const char *text); /** * @brief Add a custom word or phrase to the filter. @@ -412,12 +412,12 @@ char *pizza_io_soap_suggest(const char *text); * @param phrase The phrase to add. * @return 0 on success, nonzero on failure. */ -int pizza_io_soap_add_custom_filter(const char *phrase); +FOSSIL_PIZZA_API int pizza_io_soap_add_custom_filter(const char *phrase); /** * @brief Clear all custom filters. */ -void pizza_io_soap_clear_custom_filters(void); +FOSSIL_PIZZA_API void pizza_io_soap_clear_custom_filters(void); /** * @brief Detect the tone of a sentence. @@ -425,7 +425,7 @@ void pizza_io_soap_clear_custom_filters(void); * @param text The input text. * @return A string representing the detected tone ("formal", "casual", "sarcastic", etc.). */ -const char *pizza_io_soap_detect_tone(const char *text); +FOSSIL_PIZZA_API const char *pizza_io_soap_detect_tone(const char *text); /** * @brief Checks if the given text contains "rot-brain" language. @@ -433,7 +433,7 @@ const char *pizza_io_soap_detect_tone(const char *text); * @param text The input text to check. * @return 1 if the text contains "rot-brain" language, 0 otherwise. */ -int pizza_io_is_rot_brain(const char *text); +FOSSIL_PIZZA_API int pizza_io_is_rot_brain(const char *text); // ***************************************************************************** // Memory management @@ -449,7 +449,7 @@ typedef void* pizza_sys_memory_t; * @return A pointer to the allocated memory. * @throws Error message and exits if allocation fails. */ -pizza_sys_memory_t pizza_sys_memory_alloc(size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_alloc(size_t size); /** * Reallocate memory. @@ -459,7 +459,7 @@ pizza_sys_memory_t pizza_sys_memory_alloc(size_t size); * @return A pointer to the reallocated memory. * @throws Error message and exits if reallocation fails or if the pointer is NULL. */ -pizza_sys_memory_t pizza_sys_memory_realloc(pizza_sys_memory_t ptr, size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_realloc(pizza_sys_memory_t ptr, size_t size); /** * Allocate and zero memory. @@ -469,7 +469,7 @@ pizza_sys_memory_t pizza_sys_memory_realloc(pizza_sys_memory_t ptr, size_t size) * @return A pointer to the allocated and zeroed memory. * @throws Error message and exits if allocation fails. */ -pizza_sys_memory_t pizza_sys_memory_calloc(size_t num, size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_calloc(size_t num, size_t size); /** * Initialize allocated memory to a known state. @@ -479,7 +479,7 @@ pizza_sys_memory_t pizza_sys_memory_calloc(size_t num, size_t size); * @param value The value to initialize the memory with (e.g., zero). * @return A pointer to the initialized memory. */ -pizza_sys_memory_t pizza_sys_memory_init(pizza_sys_memory_t ptr, size_t size, int32_t value); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_init(pizza_sys_memory_t ptr, size_t size, int32_t value); /** * Free memory. @@ -487,7 +487,7 @@ pizza_sys_memory_t pizza_sys_memory_init(pizza_sys_memory_t ptr, size_t size, in * @param ptr A pointer to the memory to free. * @throws Error message and exits if the pointer is NULL. */ -void pizza_sys_memory_free(pizza_sys_memory_t ptr); +FOSSIL_PIZZA_API void pizza_sys_memory_free(pizza_sys_memory_t ptr); /** * Copy memory. @@ -498,7 +498,7 @@ void pizza_sys_memory_free(pizza_sys_memory_t ptr); * @return A pointer to the destination memory. * @throws Error message and exits if copying fails or if either source or destination is NULL. */ -pizza_sys_memory_t pizza_sys_memory_copy(pizza_sys_memory_t dest, const pizza_sys_memory_t src, size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_copy(pizza_sys_memory_t dest, const pizza_sys_memory_t src, size_t size); /** * Set memory. @@ -509,7 +509,7 @@ pizza_sys_memory_t pizza_sys_memory_copy(pizza_sys_memory_t dest, const pizza_sy * @return A pointer to the memory. * @throws Error message and exits if setting fails or if the pointer is NULL. */ -pizza_sys_memory_t pizza_sys_memory_set(pizza_sys_memory_t ptr, int32_t value, size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_set(pizza_sys_memory_t ptr, int32_t value, size_t size); /** * Duplicate memory. @@ -519,7 +519,7 @@ pizza_sys_memory_t pizza_sys_memory_set(pizza_sys_memory_t ptr, int32_t value, s * @return A pointer to the duplicated memory. * @throws Error message and exits if duplication fails or if the source is NULL. */ -pizza_sys_memory_t pizza_sys_memory_dup(const pizza_sys_memory_t src, size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_dup(const pizza_sys_memory_t src, size_t size); /** * Zero memory. @@ -528,7 +528,7 @@ pizza_sys_memory_t pizza_sys_memory_dup(const pizza_sys_memory_t src, size_t siz * @param size The size of the memory to zero. * @throws Error message and exits if the pointer is NULL. */ -pizza_sys_memory_t pizza_sys_memory_zero(pizza_sys_memory_t ptr, size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_zero(pizza_sys_memory_t ptr, size_t size); /** * Compare memory. @@ -539,7 +539,7 @@ pizza_sys_memory_t pizza_sys_memory_zero(pizza_sys_memory_t ptr, size_t size); * @return The result of the comparison. * @throws Error message and exits if the pointers are NULL or if the size is zero. */ -int pizza_sys_memory_compare(const pizza_sys_memory_t ptr1, const pizza_sys_memory_t ptr2, size_t size); +FOSSIL_PIZZA_API int pizza_sys_memory_compare(const pizza_sys_memory_t ptr1, const pizza_sys_memory_t ptr2, size_t size); /** * Move memory. @@ -550,7 +550,7 @@ int pizza_sys_memory_compare(const pizza_sys_memory_t ptr1, const pizza_sys_memo * @return A pointer to the destination memory. * @throws Error message and exits if moving fails or if either source or destination is NULL. */ -pizza_sys_memory_t pizza_sys_memory_move(pizza_sys_memory_t dest, const pizza_sys_memory_t src, size_t size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_move(pizza_sys_memory_t dest, const pizza_sys_memory_t src, size_t size); /** * Resize memory. @@ -561,7 +561,7 @@ pizza_sys_memory_t pizza_sys_memory_move(pizza_sys_memory_t dest, const pizza_sy * @return A pointer to the resized memory. * @throws Error message and exits if resizing fails or if the pointer is NULL. */ -pizza_sys_memory_t pizza_sys_memory_resize(pizza_sys_memory_t ptr, size_t old_size, size_t new_size); +FOSSIL_PIZZA_API pizza_sys_memory_t pizza_sys_memory_resize(pizza_sys_memory_t ptr, size_t old_size, size_t new_size); /** * Check if a memory pointer is valid. @@ -569,7 +569,7 @@ pizza_sys_memory_t pizza_sys_memory_resize(pizza_sys_memory_t ptr, size_t old_si * @param ptr A pointer to the memory. * @return 1 if the memory is valid, 0 otherwise. */ -bool pizza_sys_memory_is_valid(const pizza_sys_memory_t ptr); +FOSSIL_PIZZA_API bool pizza_sys_memory_is_valid(const pizza_sys_memory_t ptr); // ***************************************************************************** // output management @@ -650,7 +650,7 @@ extern int32_t PIZZA_IO_COLOR_ENABLE; // Flag to enable/disable color output * * @param stream The output stream where subsequent output should be redirected. */ -void pizza_io_redirect_output(pizza_fstream_t *stream); +FOSSIL_PIZZA_API void pizza_io_redirect_output(pizza_fstream_t *stream); /** * Prints a string to the output. @@ -661,7 +661,7 @@ void pizza_io_redirect_output(pizza_fstream_t *stream); * * @param str The string to be printed. This should be a null-terminated string. */ -void pizza_io_puts(const char *str); +FOSSIL_PIZZA_API void pizza_io_puts(const char *str); /** * Prints a formatted string to the output. @@ -682,7 +682,7 @@ void pizza_io_puts(const char *str); * @param ... The additional arguments to be formatted. These arguments are inserted into the format string * in the order they appear, based on the format specifiers. */ -void pizza_io_printf(const char *format, ...); +FOSSIL_PIZZA_API void pizza_io_printf(const char *format, ...); /** * Prints a formatted string to a buffer using a va_list. @@ -706,7 +706,7 @@ void pizza_io_printf(const char *format, ...); * @param args The variable argument list containing the values to be formatted. * @return The number of characters written (excluding the null terminator), or a negative value if an error occurs. */ -int pizza_io_vsnprintf(char *buffer, size_t size, const char *format, va_list args); +FOSSIL_PIZZA_API int pizza_io_vsnprintf(char *buffer, size_t size, const char *format, va_list args); /** * Prints a character to the output. @@ -721,7 +721,7 @@ int pizza_io_vsnprintf(char *buffer, size_t size, const char *format, va_list ar * * @param c The character to be printed. This should be a single character. */ -void pizza_io_putchar(char c); +FOSSIL_PIZZA_API void pizza_io_putchar(char c); /** * Prints a string to the specified output stream. @@ -740,7 +740,7 @@ void pizza_io_putchar(char c); * @param stream The output stream where the string should be printed. This should be a valid pointer to a `FILE` object. * @param str The string to be printed. This should be a null-terminated string. */ -void pizza_io_fputs(pizza_fstream_t *stream, const char *str); +FOSSIL_PIZZA_API void pizza_io_fputs(pizza_fstream_t *stream, const char *str); /** * Prints a formatted string to the specified output stream. @@ -761,7 +761,7 @@ void pizza_io_fputs(pizza_fstream_t *stream, const char *str); * @param ... The additional arguments to be formatted. These arguments are inserted into the format string * in the order they appear, based on the format specifiers. */ -void pizza_io_fprintf(pizza_fstream_t *stream, const char *format, ...); +FOSSIL_PIZZA_API void pizza_io_fprintf(pizza_fstream_t *stream, const char *format, ...); // TUI part of the API @@ -772,7 +772,7 @@ void pizza_io_fprintf(pizza_fstream_t *stream, const char *format, ...); * and move the cursor to the top-left corner. It is useful when creating full-screen * terminal applications or refreshing the display. */ -void pizza_io_clear_screen(void); +FOSSIL_PIZZA_API void pizza_io_clear_screen(void); /** * Moves the cursor to a specific row and column on the terminal. @@ -780,19 +780,19 @@ void pizza_io_clear_screen(void); * @param row The row position (starting from 1). * @param col The column position (starting from 1). */ -void pizza_io_move_cursor(int row, int col); +FOSSIL_PIZZA_API void pizza_io_move_cursor(int row, int col); /** * Hides the cursor from the terminal screen. * * This is useful for creating cleaner UIs without a blinking cursor. */ -void pizza_io_hide_cursor(void); +FOSSIL_PIZZA_API void pizza_io_hide_cursor(void); /** * Shows the cursor on the terminal screen. */ -void pizza_io_show_cursor(void); +FOSSIL_PIZZA_API void pizza_io_show_cursor(void); /** * Draws a horizontal line using a specified character. @@ -800,7 +800,7 @@ void pizza_io_show_cursor(void); * @param length The number of characters to draw. * @param ch The character to use for drawing. */ -void pizza_io_draw_horizontal_line(int length, char ch); +FOSSIL_PIZZA_API void pizza_io_draw_horizontal_line(int length, char ch); /** * Draws a vertical line using a specified character. @@ -808,14 +808,14 @@ void pizza_io_draw_horizontal_line(int length, char ch); * @param length The number of characters to draw. * @param ch The character to use for drawing. */ -void pizza_io_draw_vertical_line(int length, char ch); +FOSSIL_PIZZA_API void pizza_io_draw_vertical_line(int length, char ch); /** * Flushes the output stream, ensuring all buffered text is written. * * Useful when mixing multiple output functions or when printing from threads. */ -void pizza_io_flush(void); +FOSSIL_PIZZA_API void pizza_io_flush(void); // ***************************************************************************** // string management @@ -827,14 +827,14 @@ void pizza_io_flush(void); * @param init The initial value for the cstr. * @return A new cstr initialized with the given value. */ -cstr pizza_io_cstr_create(const char *init); +FOSSIL_PIZZA_API cstr pizza_io_cstr_create(const char *init); /** * @brief Frees the memory allocated for the given cstr. * * @param str The cstr to be freed. */ -void pizza_io_cstr_free(cstr str); +FOSSIL_PIZZA_API void pizza_io_cstr_free(cstr str); /** * @brief Creates a copy of the given cstr. @@ -842,7 +842,7 @@ void pizza_io_cstr_free(cstr str); * @param str The cstr to be copied. * @return A new cstr that is a copy of the given cstr. */ -cstr pizza_io_cstr_copy(ccstr str); +FOSSIL_PIZZA_API cstr pizza_io_cstr_copy(ccstr str); /** * @brief Duplicates the given cstr. @@ -850,7 +850,7 @@ cstr pizza_io_cstr_copy(ccstr str); * @param str The cstr to be duplicated. * @return A new cstr that is a duplicate of the given cstr. */ -cstr pizza_io_cstr_dup(ccstr str); +FOSSIL_PIZZA_API cstr pizza_io_cstr_dup(ccstr str); /** * @brief Concatenates two cstrings into a new cstr. @@ -859,7 +859,7 @@ cstr pizza_io_cstr_dup(ccstr str); * @param s2 The second cstr. * @return A new cstr that is the concatenation of s1 and s2. */ -cstr pizza_io_cstr_concat(ccstr s1, ccstr s2); +FOSSIL_PIZZA_API cstr pizza_io_cstr_concat(ccstr s1, ccstr s2); /** * @brief Returns the length of the given cstr. @@ -867,7 +867,7 @@ cstr pizza_io_cstr_concat(ccstr s1, ccstr s2); * @param str The cstr whose length is to be determined. * @return The length of the given cstr. */ -size_t pizza_io_cstr_length(ccstr str); +FOSSIL_PIZZA_API size_t pizza_io_cstr_length(ccstr str); /** * @brief Compares two cstrings. @@ -876,14 +876,14 @@ size_t pizza_io_cstr_length(ccstr str); * @param s2 The second cstr. * @return An integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. */ -int pizza_io_cstr_compare(ccstr s1, ccstr s2); +FOSSIL_PIZZA_API int pizza_io_cstr_compare(ccstr s1, ccstr s2); /** * @brief Trims whitespace from the beginning and end of the given cstr. * * @param str The cstr to be trimmed. */ -void pizza_io_cstr_trim(cstr str); +FOSSIL_PIZZA_API void pizza_io_cstr_trim(cstr str); /** * @brief Splits the given cstr by the specified delimiter. @@ -893,7 +893,7 @@ void pizza_io_cstr_trim(cstr str); * @param count Pointer to a size_t variable where the number of resulting substrings will be stored. * @return An array of cstrings resulting from the split operation. */ -cstr *pizza_io_cstr_split(ccstr str, char delimiter, size_t *count); +FOSSIL_PIZZA_API cstr *pizza_io_cstr_split(ccstr str, char delimiter, size_t *count); /** * @brief Replaces all occurrences of a substring within a cstr with another substring. @@ -903,7 +903,7 @@ cstr *pizza_io_cstr_split(ccstr str, char delimiter, size_t *count); * @param new_str The substring to replace with. * @return A new cstr with the replacements made. */ -cstr pizza_io_cstr_replace(ccstr str, ccstr old, ccstr new_str); +FOSSIL_PIZZA_API cstr pizza_io_cstr_replace(ccstr str, ccstr old, ccstr new_str); /** * @brief Converts all characters in the given cstr to uppercase. @@ -911,7 +911,7 @@ cstr pizza_io_cstr_replace(ccstr str, ccstr old, ccstr new_str); * @param str The cstr to be converted. * @return The cstr with all characters converted to uppercase. */ -cstr pizza_io_cstr_to_upper(cstr str); +FOSSIL_PIZZA_API cstr pizza_io_cstr_to_upper(cstr str); /** * @brief Converts all characters in the given cstr to lowercase. @@ -919,7 +919,7 @@ cstr pizza_io_cstr_to_upper(cstr str); * @param str The cstr to be converted. * @return The cstr with all characters converted to lowercase. */ -cstr pizza_io_cstr_to_lower(cstr str); +FOSSIL_PIZZA_API cstr pizza_io_cstr_to_lower(cstr str); /** * @brief Checks if the given cstr starts with the specified prefix. @@ -928,7 +928,7 @@ cstr pizza_io_cstr_to_lower(cstr str); * @param prefix The prefix to check for. * @return 1 if the cstr starts with the prefix, 0 otherwise. */ -int pizza_io_cstr_starts_with(ccstr str, ccstr prefix); +FOSSIL_PIZZA_API int pizza_io_cstr_starts_with(ccstr str, ccstr prefix); /** * @brief Checks if the given cstr ends with the specified suffix. @@ -937,7 +937,7 @@ int pizza_io_cstr_starts_with(ccstr str, ccstr prefix); * @param suffix The suffix to check for. * @return 1 if the cstr ends with the suffix, 0 otherwise. */ -int pizza_io_cstr_ends_with(ccstr str, ccstr suffix); +FOSSIL_PIZZA_API int pizza_io_cstr_ends_with(ccstr str, ccstr suffix); /** * @brief Extracts a substring from the given cstr. @@ -947,7 +947,7 @@ int pizza_io_cstr_ends_with(ccstr str, ccstr suffix); * @param length The length of the substring. * @return A new cstr that is the specified substring of the original cstr. */ -cstr pizza_io_cstr_substring(ccstr str, size_t start, size_t length); +FOSSIL_PIZZA_API cstr pizza_io_cstr_substring(ccstr str, size_t start, size_t length); /** * @brief Reverses the given cstr. @@ -955,7 +955,7 @@ cstr pizza_io_cstr_substring(ccstr str, size_t start, size_t length); * @param str The cstr to be reversed. * @return A new cstr that is the reverse of the given cstr. */ -cstr pizza_io_cstr_reverse(cstr str); +FOSSIL_PIZZA_API cstr pizza_io_cstr_reverse(cstr str); /** * @brief Checks if the given cstr contains the specified substring. @@ -964,7 +964,7 @@ cstr pizza_io_cstr_reverse(cstr str); * @param substr The substring to check for. * @return 1 if the cstr contains the substring, 0 otherwise. */ -int pizza_io_cstr_contains(ccstr str, ccstr substr); +FOSSIL_PIZZA_API int pizza_io_cstr_contains(ccstr str, ccstr substr); /** * @brief Repeats the given cstr the specified number of times. @@ -973,7 +973,7 @@ int pizza_io_cstr_contains(ccstr str, ccstr substr); * @param count The number of times to repeat the cstr. * @return A new cstr that is the original cstr repeated the specified number of times. */ -cstr pizza_io_cstr_repeat(ccstr str, size_t count); +FOSSIL_PIZZA_API cstr pizza_io_cstr_repeat(ccstr str, size_t count); /** * @brief Strips the given character from the beginning and end of the cstr. @@ -982,7 +982,7 @@ cstr pizza_io_cstr_repeat(ccstr str, size_t count); * @param ch The character to strip. * @return A new cstr that is the original cstr with the specified character stripped from the beginning and end. */ -cstr pizza_io_cstr_strip(ccstr str, char ch); +FOSSIL_PIZZA_API cstr pizza_io_cstr_strip(ccstr str, char ch); /** * @brief Counts the number of occurrences of a substring within the given cstr. @@ -991,7 +991,7 @@ cstr pizza_io_cstr_strip(ccstr str, char ch); * @param substr The substring to search for. * @return The number of occurrences of the substring within the cstr. */ -size_t pizza_io_cstr_count(ccstr str, ccstr substr); +FOSSIL_PIZZA_API size_t pizza_io_cstr_count(ccstr str, ccstr substr); /** * @brief Pads the given cstr with the specified character on the left side. @@ -1001,7 +1001,7 @@ size_t pizza_io_cstr_count(ccstr str, ccstr substr); * @param pad_char The character to pad with. * @return A new cstr that is the original cstr padded on the left side. */ -cstr pizza_io_cstr_pad_left(ccstr str, size_t total_length, char pad_char); +FOSSIL_PIZZA_API cstr pizza_io_cstr_pad_left(ccstr str, size_t total_length, char pad_char); /** * @brief Pads the given cstr with the specified character on the right side. @@ -1011,11 +1011,11 @@ cstr pizza_io_cstr_pad_left(ccstr str, size_t total_length, char pad_char); * @param pad_char The character to pad with. * @return A new cstr that is the original cstr padded on the right side. */ -cstr pizza_io_cstr_pad_right(ccstr str, size_t total_length, char pad_char); +FOSSIL_PIZZA_API cstr pizza_io_cstr_pad_right(ccstr str, size_t total_length, char pad_char); // Append a string to a buffer safely with NUL-termination. // Returns true on success, false if buffer would overflow. -bool pizza_io_cstr_append(cstr dest, size_t max_len, cstr src); +FOSSIL_PIZZA_API bool pizza_io_cstr_append(cstr dest, size_t max_len, cstr src); #ifdef __cplusplus } diff --git a/code/logic/fossil/pizza/mark.h b/code/logic/fossil/pizza/mark.h index e5158f87..d43d8dcc 100644 --- a/code/logic/fossil/pizza/mark.h +++ b/code/logic/fossil/pizza/mark.h @@ -45,59 +45,59 @@ typedef struct { * @param benchmark The fossil_mark_t object to initialize. * @param name The name of the benchmark. */ -void fossil_benchmark_init(fossil_mark_t* benchmark, const char* name); +FOSSIL_PIZZA_API void fossil_benchmark_init(fossil_mark_t* benchmark, const char* name); /** * @brief Starts the benchmark timer. * @param benchmark The fossil_mark_t object to start. */ -void fossil_benchmark_start(fossil_mark_t* benchmark); +FOSSIL_PIZZA_API void fossil_benchmark_start(fossil_mark_t* benchmark); /** * @brief Stops the benchmark timer. * @param benchmark The fossil_mark_t object to stop. */ -void fossil_benchmark_stop(fossil_mark_t* benchmark); +FOSSIL_PIZZA_API void fossil_benchmark_stop(fossil_mark_t* benchmark); /** * @brief Returns the total elapsed time in seconds. * @param benchmark The fossil_mark_t object to get the elapsed time from. * @return The total elapsed time in seconds. */ -double fossil_benchmark_elapsed_seconds(const fossil_mark_t* benchmark); +FOSSIL_PIZZA_API double fossil_benchmark_elapsed_seconds(const fossil_mark_t* benchmark); /** * @brief Returns the minimum elapsed time in seconds. * @param benchmark The fossil_mark_t object to get the minimum time from. * @return The minimum elapsed time in seconds. */ -double fossil_benchmark_min_time(const fossil_mark_t* benchmark); +FOSSIL_PIZZA_API double fossil_benchmark_min_time(const fossil_mark_t* benchmark); /** * @brief Returns the maximum elapsed time in seconds. * @param benchmark The fossil_mark_t object to get the maximum time from. * @return The maximum elapsed time in seconds. */ -double fossil_benchmark_max_time(const fossil_mark_t* benchmark); +FOSSIL_PIZZA_API double fossil_benchmark_max_time(const fossil_mark_t* benchmark); /** * @brief Returns the average elapsed time in seconds. * @param benchmark The fossil_mark_t object to get the average time from. * @return The average elapsed time in seconds. */ -double fossil_benchmark_avg_time(const fossil_mark_t* benchmark); +FOSSIL_PIZZA_API double fossil_benchmark_avg_time(const fossil_mark_t* benchmark); /** * @brief Resets the benchmark statistics. * @param benchmark The fossil_mark_t object to reset. */ -void fossil_benchmark_reset(fossil_mark_t* benchmark); +FOSSIL_PIZZA_API void fossil_benchmark_reset(fossil_mark_t* benchmark); /** * @brief Prints a report of the benchmark statistics. * @param benchmark The fossil_mark_t object to report. */ -void fossil_benchmark_report(const fossil_mark_t* benchmark); +FOSSIL_PIZZA_API void fossil_benchmark_report(const fossil_mark_t* benchmark); typedef struct { fossil_mark_t* benchmark; @@ -108,13 +108,13 @@ typedef struct { * @param scoped_benchmark The fossil_scoped_mark_t object to initialize. * @param benchmark The benchmark to be scoped. */ -void fossil_scoped_benchmark_init(fossil_scoped_mark_t* scoped_benchmark, fossil_mark_t* benchmark); +FOSSIL_PIZZA_API void fossil_scoped_benchmark_init(fossil_scoped_mark_t* scoped_benchmark, fossil_mark_t* benchmark); /** * @brief Destroys a fossil_scoped_mark_t object. * @param scoped_benchmark The fossil_scoped_mark_t object to destroy. */ -void fossil_scoped_benchmark_destroy(fossil_scoped_mark_t* scoped_benchmark); +FOSSIL_PIZZA_API void fossil_scoped_benchmark_destroy(fossil_scoped_mark_t* scoped_benchmark); /** * Function to test benchmark with specified duration type, expected value, and actual value. @@ -123,19 +123,19 @@ void fossil_scoped_benchmark_destroy(fossil_scoped_mark_t* scoped_benchmark); * @param expected The expected value. * @param actual The actual value. */ -void fossil_test_benchmark(char* duration_type, double expected, double actual); +FOSSIL_PIZZA_API void fossil_test_benchmark(char* duration_type, double expected, double actual); /** * Function to start the benchmark. */ -void fossil_test_start_benchmark(void); +FOSSIL_PIZZA_API void fossil_test_start_benchmark(void); /** * Function to stop the benchmark and return the elapsed time in nanoseconds. * * @return The elapsed time in nanoseconds. */ -uint64_t fossil_test_stop_benchmark(void); +FOSSIL_PIZZA_API uint64_t fossil_test_stop_benchmark(void); // ***************************************************************************** // Macro definitions diff --git a/code/logic/fossil/pizza/mock.h b/code/logic/fossil/pizza/mock.h index 43741dac..8f6398b9 100644 --- a/code/logic/fossil/pizza/mock.h +++ b/code/logic/fossil/pizza/mock.h @@ -93,14 +93,14 @@ typedef struct { * * @param list The fossil_mock_calllist_t to initialize. */ -void fossil_mock_init(fossil_mock_calllist_t *list); +FOSSIL_PIZZA_API void fossil_mock_init(fossil_mock_calllist_t *list); /** * Destroys a fossil_mock_calllist_t and frees all associated memory. * * @param list The fossil_mock_calllist_t to destroy. */ -void fossil_mock_destroy(fossil_mock_calllist_t *list); +FOSSIL_PIZZA_API void fossil_mock_destroy(fossil_mock_calllist_t *list); /** * Adds a fossil_mock_call_t to the fossil_mock_calllist_t. @@ -110,14 +110,14 @@ void fossil_mock_destroy(fossil_mock_calllist_t *list); * @param arguments The arguments passed to the function. * @param num_args The number of arguments. */ -void fossil_mock_add_call(fossil_mock_calllist_t *list, const char *function_name, fossil_mock_pizza_t *arguments, int num_args); +FOSSIL_PIZZA_API void fossil_mock_add_call(fossil_mock_calllist_t *list, const char *function_name, fossil_mock_pizza_t *arguments, int num_args); /** * Prints the contents of a fossil_mock_calllist_t. * * @param list The fossil_mock_calllist_t to print. */ -void fossil_mock_print(fossil_mock_calllist_t *list); +FOSSIL_PIZZA_API void fossil_mock_print(fossil_mock_calllist_t *list); /** * Captures the output of a function to a buffer for testing purposes. @@ -127,7 +127,7 @@ void fossil_mock_print(fossil_mock_calllist_t *list); * @param function The function whose output is to be captured. * @return The number of characters captured. */ -int fossil_mock_capture_output(char *buffer, size_t size, void (*function)(void)); +FOSSIL_PIZZA_API int fossil_mock_capture_output(char *buffer, size_t size, void (*function)(void)); /** * Compares the captured output with the expected output. @@ -136,7 +136,7 @@ int fossil_mock_capture_output(char *buffer, size_t size, void (*function)(void) * @param expected The expected output. * @return True if the captured output matches the expected output, false otherwise. */ -bool fossil_mock_compare_output(const char *captured, const char *expected); +FOSSIL_PIZZA_API bool fossil_mock_compare_output(const char *captured, const char *expected); #ifdef __cplusplus } diff --git a/code/logic/fossil/pizza/sanity.h b/code/logic/fossil/pizza/sanity.h index 757db2c9..ec200d56 100644 --- a/code/logic/fossil/pizza/sanity.h +++ b/code/logic/fossil/pizza/sanity.h @@ -33,7 +33,7 @@ extern "C" { * @return int The exit code of the executed command. A value of 0 typically indicates * success, while non-zero values indicate errors or specific exit statuses. */ -int fossil_sanity_sys_execute(const char* command); +FOSSIL_PIZZA_API int fossil_sanity_sys_execute(const char* command); /** * @brief Retrieves the process ID of the current process. @@ -44,7 +44,7 @@ int fossil_sanity_sys_execute(const char* command); * * @return int The process ID of the current process. */ -int fossil_sanity_sys_getpid(void); +FOSSIL_PIZZA_API int fossil_sanity_sys_getpid(void); /** * @brief Suspends the execution of the current thread for a specified duration. @@ -56,7 +56,7 @@ int fossil_sanity_sys_getpid(void); * @param milliseconds The number of milliseconds to sleep. Must be a non-negative value. * A value of 0 may yield the processor to other threads without delay. */ -void fossil_sanity_sys_sleep(int milliseconds); +FOSSIL_PIZZA_API void fossil_sanity_sys_sleep(int milliseconds); /** * @brief Creates an empty file at the specified location. @@ -71,7 +71,7 @@ void fossil_sanity_sys_sleep(int milliseconds); * the file could not be created due to errors such as insufficient permissions * or invalid file paths. */ -int fossil_sanity_sys_create_file(const char* filename); +FOSSIL_PIZZA_API int fossil_sanity_sys_create_file(const char* filename); /** * @brief Checks whether a file exists at the specified location. @@ -85,7 +85,7 @@ int fossil_sanity_sys_create_file(const char* filename); * @return int Returns 1 if the file exists, and 0 if it does not exist. Note that this * function does not check for file accessibility or permissions. */ -int fossil_sanity_sys_file_exists(const char* filename); +FOSSIL_PIZZA_API int fossil_sanity_sys_file_exists(const char* filename); /** * @brief Creates an empty directory at the specified location. @@ -100,7 +100,7 @@ int fossil_sanity_sys_file_exists(const char* filename); * the directory could not be created due to errors such as insufficient permissions * or invalid paths. */ -int fossil_sanity_sys_create_dir(const char* dirname); +FOSSIL_PIZZA_API int fossil_sanity_sys_create_dir(const char* dirname); /** * @brief Checks whether a directory exists at the specified location. @@ -114,7 +114,7 @@ int fossil_sanity_sys_create_dir(const char* dirname); * @return int Returns 1 if the directory exists, and 0 if it does not exist. Note that this * function does not check for directory accessibility or permissions. */ -int fossil_sanity_sys_dir_exists(const char* dirname); +FOSSIL_PIZZA_API int fossil_sanity_sys_dir_exists(const char* dirname); /** * @brief Reads the entire contents of a file into memory. @@ -126,7 +126,7 @@ int fossil_sanity_sys_dir_exists(const char* dirname); * @return char* Pointer to allocated null-terminated buffer on success, * or NULL on failure. */ -char* fossil_sanity_sys_read_file(const char* filename); +FOSSIL_PIZZA_API char* fossil_sanity_sys_read_file(const char* filename); /** * @brief Writes data to a file, replacing any existing contents. @@ -135,7 +135,7 @@ char* fossil_sanity_sys_read_file(const char* filename); * @param data Null-terminated string to write. * @return int Returns 0 on success, negative on failure. */ -int fossil_sanity_sys_write_file(const char* filename, const char* data); +FOSSIL_PIZZA_API int fossil_sanity_sys_write_file(const char* filename, const char* data); /** * @brief Deletes a file from the filesystem. @@ -143,7 +143,7 @@ int fossil_sanity_sys_write_file(const char* filename, const char* data); * @param filename Path to the file to delete. * @return int Returns 0 on success, negative on failure. */ -int fossil_sanity_sys_delete_file(const char* filename); +FOSSIL_PIZZA_API int fossil_sanity_sys_delete_file(const char* filename); /** * @brief Retrieves the value of an environment variable. @@ -151,7 +151,7 @@ int fossil_sanity_sys_delete_file(const char* filename); * @param name Name of the environment variable. * @return const char* Value of the variable, or NULL if not found. */ -const char* fossil_sanity_sys_getenv(const char* name); +FOSSIL_PIZZA_API const char* fossil_sanity_sys_getenv(const char* name); /** * @brief Sets or overrides an environment variable. @@ -160,21 +160,21 @@ const char* fossil_sanity_sys_getenv(const char* name); * @param value Value to set. * @return int Returns 0 on success, negative on failure. */ -int fossil_sanity_sys_setenv(const char* name, const char* value); +FOSSIL_PIZZA_API int fossil_sanity_sys_setenv(const char* name, const char* value); /** * @brief Retrieves the current system timestamp as a formatted string. * * @return char* Newly allocated string with timestamp (caller must free). */ -char* fossil_sanity_sys_timestamp(void); +FOSSIL_PIZZA_API char* fossil_sanity_sys_timestamp(void); /** * @brief Returns uptime in milliseconds since process start. * * @return long long Milliseconds since process launch. */ -long long fossil_sanity_sys_uptime_ms(void); +FOSSIL_PIZZA_API long long fossil_sanity_sys_uptime_ms(void); /** * @brief Checks if a process is still running. @@ -182,7 +182,7 @@ long long fossil_sanity_sys_uptime_ms(void); * @param pid Process ID. * @return int Returns 1 if running, 0 if not, negative on error. */ -int fossil_sanity_sys_is_running(int pid); +FOSSIL_PIZZA_API int fossil_sanity_sys_is_running(int pid); /** * @brief Attempts to terminate a process by PID. @@ -190,7 +190,7 @@ int fossil_sanity_sys_is_running(int pid); * @param pid Process ID. * @return int Returns 0 on success, negative on failure. */ -int fossil_sanity_sys_kill(int pid); +FOSSIL_PIZZA_API int fossil_sanity_sys_kill(int pid); #ifdef __cplusplus } diff --git a/code/logic/fossil/pizza/test.h b/code/logic/fossil/pizza/test.h index 9eac5938..fd521a39 100644 --- a/code/logic/fossil/pizza/test.h +++ b/code/logic/fossil/pizza/test.h @@ -121,7 +121,7 @@ typedef struct { * @param argv The command line arguments. * @return 0 on success, -1 on failure. */ -int fossil_pizza_start(fossil_pizza_engine_t* engine, int argc, char** argv); +FOSSIL_PIZZA_API int fossil_pizza_start(fossil_pizza_engine_t* engine, int argc, char** argv); // --- Adding Test Suites and Cases --- @@ -130,14 +130,14 @@ int fossil_pizza_start(fossil_pizza_engine_t* engine, int argc, char** argv); * @param suite The suite to add. * @return 0 on success, -1 on failure. */ -int fossil_pizza_add_suite(fossil_pizza_engine_t* engine, fossil_pizza_suite_t suite); +FOSSIL_PIZZA_API int fossil_pizza_add_suite(fossil_pizza_engine_t* engine, fossil_pizza_suite_t suite); /** Adds a test case to a suite. * @param suite Pointer to the suite instance. * @param test_case Pointer to the test case to add. * @return 0 on success, -1 on failure. */ -int fossil_pizza_add_case(fossil_pizza_suite_t* suite, fossil_pizza_case_t test_case); +FOSSIL_PIZZA_API int fossil_pizza_add_case(fossil_pizza_suite_t* suite, fossil_pizza_case_t test_case); // --- Execution --- @@ -145,25 +145,25 @@ int fossil_pizza_add_case(fossil_pizza_suite_t* suite, fossil_pizza_case_t test_ * @param suite Pointer to the suite instance. * @return 0 on success, -1 on failure. */ -int fossil_pizza_run_suite(const fossil_pizza_engine_t* engine, fossil_pizza_suite_t* suite); +FOSSIL_PIZZA_API int fossil_pizza_run_suite(const fossil_pizza_engine_t* engine, fossil_pizza_suite_t* suite); /** Runs all test suites in the engine. * @param engine Pointer to the engine instance. * @return 0 on success, -1 on failure. */ -int fossil_pizza_run_all(fossil_pizza_engine_t* engine); +FOSSIL_PIZZA_API int fossil_pizza_run_all(fossil_pizza_engine_t* engine); // --- Summary + Teardown --- /** Prints a summary of the test results. * @param engine Pointer to the engine instance. */ -void fossil_pizza_summary(const fossil_pizza_engine_t* engine); +FOSSIL_PIZZA_API void fossil_pizza_summary(const fossil_pizza_engine_t* engine); /** Cleans up and ends the test engine. * @param engine Pointer to the engine instance. */ -int32_t fossil_pizza_end(fossil_pizza_engine_t* engine); +FOSSIL_PIZZA_API int32_t fossil_pizza_end(fossil_pizza_engine_t* engine); /** * @brief Internal function to handle assertions with anomaly detection. @@ -177,7 +177,7 @@ int32_t fossil_pizza_end(fossil_pizza_engine_t* engine); * @param line The line number where the assertion occurred. * @param func The function name where the assertion occurred. */ -void pizza_test_assert_internal(bool condition, const char *message, const char *file, int line, const char *func); +FOSSIL_PIZZA_API void pizza_test_assert_internal(bool condition, const char *message, const char *file, int line, const char *func); /** * @brief Internal function to handle assertions with message formatting. @@ -188,7 +188,7 @@ void pizza_test_assert_internal(bool condition, const char *message, const char * @param message The message to format. * @return A formatted message string. */ -char *pizza_test_assert_messagef(const char *message, ...); +FOSSIL_PIZZA_API char *pizza_test_assert_messagef(const char *message, ...); // ********************************************************************************************* // internal messages @@ -202,7 +202,7 @@ char *pizza_test_assert_messagef(const char *message, ...); * * @param description The description of the given step. */ -void _given(const char *description); +FOSSIL_PIZZA_API void _given(const char *description); /** * @brief Internal function to handle the "when" step in a test case. @@ -212,7 +212,7 @@ void _given(const char *description); * * @param description The description of the when step. */ -void _when(const char *description); +FOSSIL_PIZZA_API void _when(const char *description); /** * @brief Internal function to handle the "then" step in a test case. @@ -222,7 +222,7 @@ void _when(const char *description); * * @param description The description of the then step. */ -void _then(const char *description); +FOSSIL_PIZZA_API void _then(const char *description); /** * @brief Internal function to handle the "skip" step in a test case. @@ -232,7 +232,7 @@ void _then(const char *description); * * @param description The description of the skip step. */ -void _on_skip(const char *description); +FOSSIL_PIZZA_API void _on_skip(const char *description); #ifdef __cplusplus } diff --git a/code/logic/meson.build b/code/logic/meson.build index b73ad740..3e55b9bf 100644 --- a/code/logic/meson.build +++ b/code/logic/meson.build @@ -3,7 +3,7 @@ cc = meson.get_compiler('c') test_code = ['mock.c', 'test.c', 'mark.c', 'sanity.c', 'common.c'] -fossil_test_lib = static_library('pizza-test', +fossil_test_lib = library('pizza_test', test_code, install: true, include_directories: dir, diff --git a/conanfile.py b/conanfile.py index cac3fbc0..3441df55 100644 --- a/conanfile.py +++ b/conanfile.py @@ -5,12 +5,12 @@ class PizzaTestConan(ConanFile): name = "pizza_test" - version = "1.2.7" + version = "1.2.8" license = "MPL-2.0" author = "Fossil Logic " url = "https://github.com/fossillogic/fossil-test" - description = "Unit testing framework for software projects" - topics = ("testing", "mocking", "framework") + description = "Fossil Test is a lightweight, portable unit testing library written in pure C with zero external dependencies." + topics = ("testing", "mocking", "benchmark", "meson", "fossillogic") settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False]} @@ -51,4 +51,4 @@ def package_info(self): self.cpp_info.includedirs = ["include"] def source(self): - self.run(f"git clone --branch v{self.version} {self.url} .") + self.run(f"git clone --branch v{self.version} {self.url}") diff --git a/meson.build b/meson.build index cb5678c3..5a855d25 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('Pizza Test', 'c', 'cpp', - meson_version: '>=1.3.0', + meson_version: '>=1.8.0', license: 'MPL-2.0', - version: '1.2.7', + version: '1.2.8', default_options: [ 'c_std=c11,c18', 'cpp_std=c++20',