diff --git a/.github/workflows/meson_ci.yml b/.github/workflows/meson_ci.yml index 16372d3..fc5e751 100644 --- a/.github/workflows/meson_ci.yml +++ b/.github/workflows/meson_ci.yml @@ -5,16 +5,22 @@ on: paths: - "**.c" - "**.h" - - "**.kt" + - "**.cpp" + - "**.hpp" + - "**.rs" - "**.py" - - "meson.**" + - "**.build" + - "**.options" pull_request: paths: - "**.c" - "**.h" - - "**.kt" + - "**.cpp" + - "**.hpp" + - "**.rs" - "**.py" - - "meson.**" + - "**.build" + - "**.options" jobs: build_msvc: @@ -211,7 +217,7 @@ jobs: strategy: matrix: - distro: [ubuntu, debian, fedora, archlinux] + distro: [ubuntu, fedora, archlinux, debian] steps: - name: Checkout code @@ -243,7 +249,8 @@ jobs: -w /workspace \ ${GITHUB_REPOSITORY}:${{ matrix.distro }} \ /bin/bash -c " - meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 -Dc_std=c17 -Dfossil-test:c_std=c17 + apt-get update + meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 meson compile -C builddir meson test -C builddir -v" diff --git a/README.md b/README.md index 9087bc1..3a8e6ae 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Before using Fossil Lib, ensure you have the following: # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-lib.git - revision = v0.1.0 + revision = v0.1.1 [provide] fossil-lib = fossil_lib_dep diff --git a/code/tests/test_arguments.c b/code/tests/cases/test_arguments.c similarity index 66% rename from code/tests/test_arguments.c rename to code/tests/cases/test_arguments.c index 8c68d96..b18bc45 100644 --- a/code/tests/test_arguments.c +++ b/code/tests/cases/test_arguments.c @@ -11,16 +11,39 @@ * Copyright (C) 2024 Fossil Logic. All rights reserved. * ----------------------------------------------------------------------------- */ -#include -#include +#include #include "fossil/lib/framework.h" // * * * * * * * * * * * * * * * * * * * * * * * * -// * Fossil Logic Test +// * Fossil Logic Test Utilities // * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(c_args_suite); + +// Setup function for the test suite +FOSSIL_SETUP(c_args_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(c_args_suite) { + // Teardown code here +} -FOSSIL_TEST(test_fossil_arg_parse_has) { +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_CASE(c_test_arg_parse_has) { // Test fossil_arg_parse_has function fossil_option_t options[] = { {"option1", COPTION_TYPE_BOOL, {.bool_val = 0}, cnull, 0, 0}, @@ -32,7 +55,7 @@ FOSSIL_TEST(test_fossil_arg_parse_has) { ASSUME_ITS_EQUAL_I32(0, fossil_arg_parse_has(options, num_options, "option1")); } -FOSSIL_TEST(test_fossil_arg_parse) { +FOSSIL_TEST_CASE(c_test_arg_parse) { // Test fossil_arg_parse function const char* argv[] = {"program", "-number", "42", "-name", "John", "-flag", "-choice", "choice2", "-feature", "enable"}; const int argc = sizeof(argv) / sizeof(argv[0]); @@ -57,6 +80,8 @@ FOSSIL_TEST(test_fossil_arg_parse) { // * * * * * * * * * * * * * * * * * * * * * * * * FOSSIL_TEST_GROUP(c_commandline_tests) { - ADD_TEST(test_fossil_arg_parse_has); - ADD_TEST(test_fossil_arg_parse); + FOSSIL_TEST_ADD(c_args_suite, c_test_arg_parse_has); + FOSSIL_TEST_ADD(c_args_suite, c_test_arg_parse); + + FOSSIL_TEST_REGISTER(c_args_suite); } diff --git a/code/tests/cases/test_arguments.cpp b/code/tests/cases/test_arguments.cpp new file mode 100644 index 0000000..5219962 --- /dev/null +++ b/code/tests/cases/test_arguments.cpp @@ -0,0 +1,113 @@ +/* + * ----------------------------------------------------------------------------- + * Project: Fossil Logic + * + * This file is part of the Fossil Logic project, which aims to develop high- + * performance, cross-platform applications and libraries. The code contained + * herein is subject to the terms and conditions defined in the project license. + * + * Author: Michael Gene Brockus (Dreamer) + * + * Copyright (C) 2024 Fossil Logic. All rights reserved. + * ----------------------------------------------------------------------------- + */ +#include + +#include "fossil/lib/framework.h" + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(cpp_args_suite); + +// Setup function for the test suite +FOSSIL_SETUP(cpp_args_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(cpp_args_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_CASE(cpp_test_arg_parse_has) { + // Test fossil_arg_parse_has function + fossil_option_t option1; + option1.name = "option1"; + option1.type = COPTION_TYPE_BOOL; + option1.num_choices = 0; + option1.value.bool_val = 0; + option1.extra_data = cnull; + option1.parsed = 0; + + fossil_option_t option2; + option2.name = "option2"; + option2.type = COPTION_TYPE_INT; + option2.num_choices = 0; + option2.value.int_val = 42; + option2.extra_data = cnull; + option2.parsed = 0; + + fossil_option_t options[] = {option1, option2}; + int num_options = sizeof(options) / sizeof(options[0]); + + // Assuming fossil_arg_parse_has returns 1 for the existing option + ASSUME_ITS_EQUAL_I32(0, fossil_arg_parse_has(options, num_options, "option1")); +} + +FOSSIL_TEST_CASE(cpp_test_arg_parse) { + // Test fossil_arg_parse function + const char* argv[] = {"program", "-number", "42", "-name", "John", "-flag", "-choice", "choice2", "-feature", "enable"}; + const int argc = sizeof(argv) / sizeof(argv[0]); + + fossil_command_line_t cmd = {argc, (char **)argv}; + + fossil_option_t option1; + option1.name = "option1"; + option1.type = COPTION_TYPE_INT; + option1.value.int_val = 0; + option1.num_choices = 0; + option1.extra_data = cnull; + option1.parsed = 0; + + fossil_option_t option2; + option2.name = "option2"; + option2.type = COPTION_TYPE_BOOL; + option2.num_choices = 0; + option2.value.bool_val = 0; + option2.extra_data = cnull; + option2.parsed = 0; + + fossil_option_t options[] = {option1, option2}; + int num_options = sizeof(options) / sizeof(options[0]); + + // Assuming fossil_arg_parse modifies the options array + fossil_arg_parse(&cmd, options, num_options); + + ASSUME_ITS_EQUAL_I32(0, options[0].value.int_val); + ASSUME_ITS_EQUAL_I32(0, options[1].value.bool_val); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Pool +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_GROUP(cpp_commandline_tests) { + FOSSIL_TEST_ADD(cpp_args_suite, cpp_test_arg_parse_has); + FOSSIL_TEST_ADD(cpp_args_suite, cpp_test_arg_parse); + + FOSSIL_TEST_REGISTER(cpp_args_suite); +} diff --git a/code/tests/test_cnullptr.c b/code/tests/cases/test_cnullptr.c similarity index 52% rename from code/tests/test_cnullptr.c rename to code/tests/cases/test_cnullptr.c index 02f7ee1..eb2bf14 100644 --- a/code/tests/test_cnullptr.c +++ b/code/tests/cases/test_cnullptr.c @@ -2,8 +2,8 @@ * ----------------------------------------------------------------------------- * Project: Fossil Logic * - * This file is part of the Fossil Logic project, which aims to develop high- * performance, cross-platform applications and libraries. The code contained + * This file is part of the Fossil Logic project, which aims to develop high- * herein is subject to the terms and conditions defined in the project license. * * Author: Michael Gene Brockus (Dreamer) @@ -11,8 +11,7 @@ * Copyright (C) 2024 Fossil Logic. All rights reserved. * ----------------------------------------------------------------------------- */ -#include -#include +#include #include "fossil/lib/framework.h" @@ -25,11 +24,35 @@ #endif // * * * * * * * * * * * * * * * * * * * * * * * * -// * Fossil Logic Test +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(c_null_suite); + +// Setup function for the test suite +FOSSIL_SETUP(c_null_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(c_null_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. // * * * * * * * * * * * * * * * * * * * * * * * * // Test cases for cnull -FOSSIL_TEST(test_cnull_definition) { +FOSSIL_TEST_CASE(c_test_cnull_definition) { // Test cnull definition #if __cplusplus >= 201103L || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) // C++11 or later, C23 or later @@ -49,20 +72,26 @@ FOSSIL_TEST(test_cnull_definition) { #endif } -// Test cases for cterminator and related constants -FOSSIL_TEST(test_cterminator_definition) { - // Check if the terminator constants are defined correctly - ASSUME_ITS_EQUAL_CHAR(cterminator, '\0'); - ASSUME_ITS_EQUAL_WCHAR(wterminator, L'\0'); - ASSUME_ITS_EQUAL_CHAR(cterm, '\0'); - ASSUME_ITS_EQUAL_WCHAR(wterm, L'\0'); +FOSSIL_TEST_CASE(c_test_cnull_assignment) { + // Test cnull assignment + void *ptr = cnull; + ASSUME_ITS_EQUAL_PTR(ptr, cnull); +} + +FOSSIL_TEST_CASE(c_test_cnull_comparison) { + // Test cnull comparison + void *ptr = cnull; + ASSUME_ITS_TRUE(ptr == cnull); + ASSUME_ITS_FALSE(ptr != cnull); } // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Pool // * * * * * * * * * * * * * * * * * * * * * * * * +FOSSIL_TEST_GROUP(c_null_tests) { + FOSSIL_TEST_ADD(c_null_suite, c_test_cnull_definition); + FOSSIL_TEST_ADD(c_null_suite, c_test_cnull_assignment); + FOSSIL_TEST_ADD(c_null_suite, c_test_cnull_comparison); -FOSSIL_TEST_GROUP(cnull_tests) { - ADD_TEST(test_cnull_definition); - ADD_TEST(test_cterminator_definition); + FOSSIL_TEST_REGISTER(c_null_suite); } diff --git a/code/tests/cases/test_cnullptr.cpp b/code/tests/cases/test_cnullptr.cpp new file mode 100644 index 0000000..d9c2c0b --- /dev/null +++ b/code/tests/cases/test_cnullptr.cpp @@ -0,0 +1,98 @@ +/* + * ----------------------------------------------------------------------------- + * Project: Fossil Logic + * + * This file is part of the Fossil Logic project, which aims to develop high- + * performance, cross-platform applications and libraries. The code contained + * herein is subject to the terms and conditions defined in the project license. + * + * Author: Michael Gene Brockus (Dreamer) + * + * Copyright (C) 2024 Fossil Logic. All rights reserved. + * ----------------------------------------------------------------------------- + */ +#include + +#include "fossil/lib/framework.h" + +#ifndef cnull +#error "cnull is not defined." +#endif + +#ifndef cnullptr +#error "cnullptr is not defined." +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(cpp_null_suite); + +// Setup function for the test suite +FOSSIL_SETUP(cpp_null_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(cpp_null_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Test cases for cnull +FOSSIL_TEST_CASE(cpp_test_cnull_definition) { + // Test cnull definition +#if __cplusplus >= 201103L || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) + // C++11 or later, C23 or later + ASSUME_ITS_EQUAL_PTR(cnull, nullptr); + ASSUME_ITS_EQUAL_PTR(cnullptr, nullptr); +#else + // Pre-C++11 or C23 + #if defined(_WIN64) || defined(_WIN32) + // Windows + ASSUME_ITS_EQUAL_PTR(cnull, 0); + ASSUME_ITS_EQUAL_PTR(cnullptr, 0); + #else + // POSIX, macOS, and embedded systems + ASSUME_ITS_EQUAL_PTR(cnull, (void *)(0)); + ASSUME_ITS_EQUAL_PTR(cnullptr, (void *)(0)); + #endif +#endif +} + +FOSSIL_TEST_CASE(cpp_test_cnull_assignment) { + // Test cnull assignment + void *ptr = cnull; + ASSUME_ITS_EQUAL_PTR(ptr, cnull); +} + +FOSSIL_TEST_CASE(cpp_test_cnull_comparison) { + // Test cnull comparison + void *ptr = cnull; + ASSUME_ITS_TRUE(ptr == cnull); + ASSUME_ITS_FALSE(ptr != cnull); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Pool +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_GROUP(cpp_null_tests) { + FOSSIL_TEST_ADD(cpp_null_suite, cpp_test_cnull_definition); + FOSSIL_TEST_ADD(cpp_null_suite, cpp_test_cnull_assignment); + FOSSIL_TEST_ADD(cpp_null_suite, cpp_test_cnull_comparison); + + FOSSIL_TEST_REGISTER(cpp_null_suite); +} diff --git a/code/tests/test_command.c b/code/tests/cases/test_command.c similarity index 60% rename from code/tests/test_command.c rename to code/tests/cases/test_command.c index 8702d0b..7e090eb 100644 --- a/code/tests/test_command.c +++ b/code/tests/cases/test_command.c @@ -11,16 +11,39 @@ * Copyright (C) 2024 Fossil Logic. All rights reserved. * ----------------------------------------------------------------------------- */ -#include -#include +#include #include "fossil/lib/framework.h" // * * * * * * * * * * * * * * * * * * * * * * * * -// * Fossil Logic Test +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(c_command_suite); + +// Setup function for the test suite +FOSSIL_SETUP(c_command_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(c_command_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. // * * * * * * * * * * * * * * * * * * * * * * * * -FOSSIL_TEST(test_fossil_command) { +FOSSIL_TEST_CASE(c_test_command) { int32_t result; // Test valid command @@ -32,7 +55,7 @@ FOSSIL_TEST(test_fossil_command) { ASSUME_NOT_EQUAL_I32(0, result); } -FOSSIL_TEST(test_fossil_command_success) { +FOSSIL_TEST_CASE(c_test_command_success) { int32_t result; // Test valid command @@ -44,7 +67,7 @@ FOSSIL_TEST(test_fossil_command_success) { ASSUME_NOT_EQUAL_I32(0, result); } -FOSSIL_TEST(test_fossil_command_output) { +FOSSIL_TEST_CASE(c_test_command_output) { char output[128]; int32_t result; @@ -60,7 +83,7 @@ FOSSIL_TEST(test_fossil_command_output) { #endif } -FOSSIL_TEST(test_fossil_command_exists) { +FOSSIL_TEST_CASE(c_test_command_exists) { int32_t result; #ifdef _WIN32 @@ -82,7 +105,7 @@ FOSSIL_TEST(test_fossil_command_exists) { ASSUME_ITS_EQUAL_I32(0, result); } -FOSSIL_TEST(test_fossil_command_strcat_safe) { +FOSSIL_TEST_CASE(c_test_command_strcat_safe) { char buffer[16]; // Initialize buffer @@ -97,7 +120,7 @@ FOSSIL_TEST(test_fossil_command_strcat_safe) { ASSUME_ITS_EQUAL_CSTR("Hello World1234", buffer); } -FOSSIL_TEST(test_fossil_command_erase_exists) { +FOSSIL_TEST_CASE(c_test_command_erase_exists) { int32_t result; #ifdef _WIN32 @@ -120,13 +143,20 @@ FOSSIL_TEST(test_fossil_command_erase_exists) { // * * * * * * * * * * * * * * * * * * * * * * * * FOSSIL_TEST_GROUP(c_command_tests) { #ifdef __unix__ - ADD_TEST(test_fossil_command); - ADD_TEST(test_fossil_command_success); - ADD_TEST(test_fossil_command_output); - ADD_TEST(test_fossil_command_exists); - ADD_TEST(test_fossil_command_strcat_safe); - ADD_TEST(test_fossil_command_erase_exists); + FOSSIL_TEST_ADD(c_command_suite, c_test_command); + FOSSIL_TEST_ADD(c_command_suite, c_test_command_success); + FOSSIL_TEST_ADD(c_command_suite, c_test_command_output); + FOSSIL_TEST_ADD(c_command_suite, c_test_command_exists); + FOSSIL_TEST_ADD(c_command_suite, c_test_command_strcat_safe); + FOSSIL_TEST_ADD(c_command_suite, c_test_command_erase_exists); #else - (void)test_env; // test cases need to be updated to adress the Windows platform + // test cases need to be updated to adress the Windows platform + FOSSIL_TEST_SKIP(c_test_command, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(c_test_command_success, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(c_test_command_output, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(c_test_command_exists, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(c_test_command_strcat_safe, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(c_test_command_erase_exists, "Test case not supported on Windows"); #endif + FOSSIL_TEST_REGISTER(c_command_suite); } diff --git a/code/tests/cases/test_command.cpp b/code/tests/cases/test_command.cpp new file mode 100644 index 0000000..5d0663f --- /dev/null +++ b/code/tests/cases/test_command.cpp @@ -0,0 +1,162 @@ +/* + * ----------------------------------------------------------------------------- + * Project: Fossil Logic + * + * This file is part of the Fossil Logic project, which aims to develop high- + * performance, cross-platform applications and libraries. The code contained + * herein is subject to the terms and conditions defined in the project license. + * + * Author: Michael Gene Brockus (Dreamer) + * + * Copyright (C) 2024 Fossil Logic. All rights reserved. + * ----------------------------------------------------------------------------- + */ +#include + +#include "fossil/lib/framework.h" + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(cpp_command_suite); + +// Setup function for the test suite +FOSSIL_SETUP(cpp_command_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(cpp_command_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_CASE(cpp_test_command) { + int32_t result; + + // Test valid command + result = fossil_command((char *)"echo Hello World"); + ASSUME_ITS_EQUAL_I32(0, result); + + // Test invalid command + result = fossil_command((char *)"invalid_command"); + ASSUME_NOT_EQUAL_I32(0, result); +} + +FOSSIL_TEST_CASE(cpp_test_command_success) { + int32_t result; + + // Test valid command + result = fossil_command_success((char *)"echo Hello World"); + ASSUME_ITS_EQUAL_I32(0, result); + + // Test invalid command + result = fossil_command_success((char *)"invalid_command"); + ASSUME_NOT_EQUAL_I32(0, result); +} + +FOSSIL_TEST_CASE(cpp_test_command_output) { + char output[128]; + int32_t result; + + // Test valid command + result = fossil_command_output((char *)"echo Hello World", output, sizeof(output)); + ASSUME_ITS_EQUAL_I32(0, result); + +#ifdef _WIN32 + // On Windows, the newline is "\r\n" instead of "\n" + ASSUME_ITS_EQUAL_CSTR("Hello World\n", output); +#else + ASSUME_ITS_EQUAL_CSTR("Hello World\n", output); +#endif +} + +FOSSIL_TEST_CASE(cpp_test_command_exists) { + int32_t result; + +#ifdef _WIN32 + // Use "where" on Windows + result = fossil_command_exists((char *)"where echo"); +#else + // Use "which" on Unix-like systems + result = fossil_command_exists((char *)"which echo"); +#endif + + ASSUME_ITS_EQUAL_I32(0, result); + + // Test a non-existing command +#ifdef _WIN32 + result = fossil_command_exists((char *)"where invalid_command"); +#else + result = fossil_command_exists((char *)"which invalid_command"); +#endif + ASSUME_ITS_EQUAL_I32(0, result); +} + +FOSSIL_TEST_CASE(cpp_test_command_strcat_safe) { + char buffer[16]; + + // Initialize buffer + strcpy(buffer, "Hello"); + + // Test appending within buffer limits + fossil_command_strcat_safe(buffer, (char *)" World", sizeof(buffer)); + ASSUME_ITS_EQUAL_CSTR("Hello World", buffer); + + // Test appending with truncation + fossil_command_strcat_safe(buffer, (char *)"12345678901234567890", sizeof(buffer)); + ASSUME_ITS_EQUAL_CSTR("Hello World1234", buffer); +} + +FOSSIL_TEST_CASE(cpp_test_command_erase_exists) { + int32_t result; + +#ifdef _WIN32 + // Use a different path on Windows, e.g., "C:\\" + result = fossil_command_erase_exists((char *)"C:\\"); +#else + // Use "/tmp" on Unix-like systems + result = fossil_command_erase_exists((char *)"/tmp"); +#endif + + ASSUME_ITS_EQUAL_I32(1, result); + + // Test non-existing directory + result = fossil_command_erase_exists((char *)"non_existing_directory"); + ASSUME_ITS_EQUAL_I32(0, result); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Pool +// * * * * * * * * * * * * * * * * * * * * * * * * +FOSSIL_TEST_GROUP(cpp_command_tests) { +#ifdef __unix__ + FOSSIL_TEST_ADD(cpp_command_suite, cpp_test_command); + FOSSIL_TEST_ADD(cpp_command_suite, cpp_test_command_success); + FOSSIL_TEST_ADD(cpp_command_suite, cpp_test_command_output); + FOSSIL_TEST_ADD(cpp_command_suite, cpp_test_command_exists); + FOSSIL_TEST_ADD(cpp_command_suite, cpp_test_command_strcat_safe); + FOSSIL_TEST_ADD(cpp_command_suite, cpp_test_command_erase_exists); +#else + // test cases need to be updated to adress the Windows platform + FOSSIL_TEST_SKIP(cpp_test_command, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(cpp_test_command_success, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(cpp_test_command_output, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(cpp_test_command_exists, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(cpp_test_command_strcat_safe, "Test case not supported on Windows"); + FOSSIL_TEST_SKIP(cpp_test_command_erase_exists, "Test case not supported on Windows"); +#endif + FOSSIL_TEST_REGISTER(cpp_command_suite); +} diff --git a/code/tests/test_hostsys.c b/code/tests/cases/test_hostsys.c similarity index 52% rename from code/tests/test_hostsys.c rename to code/tests/cases/test_hostsys.c index 28a8d92..abb2f6f 100644 --- a/code/tests/test_hostsys.c +++ b/code/tests/cases/test_hostsys.c @@ -11,23 +11,46 @@ * Copyright (C) 2024 Fossil Logic. All rights reserved. * ----------------------------------------------------------------------------- */ -#include -#include +#include #include "fossil/lib/framework.h" // * * * * * * * * * * * * * * * * * * * * * * * * -// * Fossil Logic Test +// * Fossil Logic Test Utilities // * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(c_hostsys_suite); + +// Setup function for the test suite +FOSSIL_SETUP(c_hostsys_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(c_hostsys_suite) { + // Teardown code here +} -FOSSIL_TEST(test_fossil_hostsys_get) { +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_CASE(c_test_hostsys_get) { fossil_hostsystem_t info; fossil_hostsys_get(&info); ASSUME_NOT_EQUAL_CSTR("", info.os_name); ASSUME_NOT_EQUAL_CSTR("", info.os_version); } -FOSSIL_TEST(test_fossil_hostsys_endian) { +FOSSIL_TEST_CASE(c_test_hostsys_endian) { fossil_hostsystem_t info; fossil_hostsys_get(&info); ASSUME_ITS_EQUAL_CSTR(fossil_hostsys_endian(&info), info.is_big_endian ? "Big Endian" : "Little Endian"); @@ -38,6 +61,8 @@ FOSSIL_TEST(test_fossil_hostsys_endian) { // * * * * * * * * * * * * * * * * * * * * * * * * FOSSIL_TEST_GROUP(c_hostsys_tests) { - ADD_TEST(test_fossil_hostsys_get); - ADD_TEST(test_fossil_hostsys_endian); + FOSSIL_TEST_ADD(c_hostsys_suite, c_test_hostsys_get); + FOSSIL_TEST_ADD(c_hostsys_suite, c_test_hostsys_endian); + + FOSSIL_TEST_REGISTER(c_hostsys_suite); } diff --git a/code/tests/cases/test_hostsys.cpp b/code/tests/cases/test_hostsys.cpp new file mode 100644 index 0000000..969072f --- /dev/null +++ b/code/tests/cases/test_hostsys.cpp @@ -0,0 +1,68 @@ +/* + * ----------------------------------------------------------------------------- + * Project: Fossil Logic + * + * This file is part of the Fossil Logic project, which aims to develop high- + * performance, cross-platform applications and libraries. The code contained + * herein is subject to the terms and conditions defined in the project license. + * + * Author: Michael Gene Brockus (Dreamer) + * + * Copyright (C) 2024 Fossil Logic. All rights reserved. + * ----------------------------------------------------------------------------- + */ +#include + +#include "fossil/lib/framework.h" + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(cpp_hostsys_suite); + +// Setup function for the test suite +FOSSIL_SETUP(cpp_hostsys_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(cpp_hostsys_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_CASE(cpp_test_hostsys_get) { + fossil_hostsystem_t info; + fossil_hostsys_get(&info); + ASSUME_NOT_EQUAL_CSTR("", info.os_name); + ASSUME_NOT_EQUAL_CSTR("", info.os_version); +} + +FOSSIL_TEST_CASE(cpp_test_hostsys_endian) { + fossil_hostsystem_t info; + fossil_hostsys_get(&info); + ASSUME_ITS_EQUAL_CSTR(fossil_hostsys_endian(&info), info.is_big_endian ? "Big Endian" : "Little Endian"); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Pool +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_GROUP(cpp_hostsys_tests) { + FOSSIL_TEST_ADD(cpp_hostsys_suite, cpp_test_hostsys_get); + FOSSIL_TEST_ADD(cpp_hostsys_suite, cpp_test_hostsys_endian); + + FOSSIL_TEST_REGISTER(cpp_hostsys_suite); +} diff --git a/code/tests/test_memory.c b/code/tests/cases/test_memory.c similarity index 67% rename from code/tests/test_memory.c rename to code/tests/cases/test_memory.c index 225b19f..34ea25d 100644 --- a/code/tests/test_memory.c +++ b/code/tests/cases/test_memory.c @@ -11,23 +11,46 @@ * Copyright (C) 2024 Fossil Logic. All rights reserved. * ----------------------------------------------------------------------------- */ -#include -#include +#include #include "fossil/lib/framework.h" // * * * * * * * * * * * * * * * * * * * * * * * * -// * Fossil Logic Test +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(c_memory_suite); + +// Setup function for the test suite +FOSSIL_SETUP(c_memory_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(c_memory_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. // * * * * * * * * * * * * * * * * * * * * * * * * -FOSSIL_TEST(test_memory_alloc) { +FOSSIL_TEST_CASE(c_test_memory_alloc) { size_t size = 10; fossil_memory_t ptr = fossil_memory_alloc(size); ASSUME_NOT_CNULL(ptr); fossil_memory_free(ptr); // Cleanup } -FOSSIL_TEST(test_memory_realloc) { +FOSSIL_TEST_CASE(c_test_memory_realloc) { size_t size = 10; fossil_memory_t ptr = fossil_memory_alloc(size); ASSUME_NOT_CNULL(ptr); @@ -39,7 +62,7 @@ FOSSIL_TEST(test_memory_realloc) { fossil_memory_free(ptr); // Cleanup } -FOSSIL_TEST(test_memory_dup) { +FOSSIL_TEST_CASE(c_test_memory_dup) { size_t size = 10; fossil_memory_t src = fossil_memory_alloc(size); ASSUME_NOT_CNULL(src); @@ -52,7 +75,7 @@ FOSSIL_TEST(test_memory_dup) { fossil_memory_free(dest); // Cleanup } -FOSSIL_TEST(test_memory_zero) { +FOSSIL_TEST_CASE(c_test_memory_zero) { size_t size = 10; fossil_memory_t ptr = fossil_memory_alloc(size); ASSUME_NOT_CNULL(ptr); @@ -65,7 +88,7 @@ FOSSIL_TEST(test_memory_zero) { fossil_memory_free(ptr); // Cleanup } -FOSSIL_TEST(test_memory_compare) { +FOSSIL_TEST_CASE(c_test_memory_compare) { size_t size = 10; fossil_memory_t ptr1 = fossil_memory_alloc(size); fossil_memory_t ptr2 = fossil_memory_alloc(size); @@ -83,7 +106,7 @@ FOSSIL_TEST(test_memory_compare) { fossil_memory_free(ptr2); // Cleanup } -FOSSIL_TEST(test_memory_move) { +FOSSIL_TEST_CASE(c_test_memory_move) { size_t size = 10; fossil_memory_t src = fossil_memory_alloc(size); ASSUME_NOT_CNULL(src); @@ -99,7 +122,7 @@ FOSSIL_TEST(test_memory_move) { fossil_memory_free(dest); // Cleanup } -FOSSIL_TEST(test_memory_resize) { +FOSSIL_TEST_CASE(c_test_memory_resize) { size_t size = 10; fossil_memory_t ptr = fossil_memory_alloc(size); ASSUME_NOT_CNULL(ptr); @@ -110,7 +133,7 @@ FOSSIL_TEST(test_memory_resize) { fossil_memory_free(ptr); // Cleanup } -FOSSIL_TEST(test_memory_is_valid) { +FOSSIL_TEST_CASE(c_test_memory_is_valid) { fossil_memory_t ptr = fossil_memory_alloc(10); ASSUME_ITS_TRUE(fossil_memory_is_valid(ptr)); // Should be valid ASSUME_ITS_TRUE(!fossil_memory_is_valid(NULL)); // NULL should not be valid @@ -123,12 +146,14 @@ FOSSIL_TEST(test_memory_is_valid) { // * * * * * * * * * * * * * * * * * * * * * * * * FOSSIL_TEST_GROUP(c_memory_tests) { - ADD_TEST(test_memory_alloc); - ADD_TEST(test_memory_realloc); - ADD_TEST(test_memory_dup); - ADD_TEST(test_memory_zero); - ADD_TEST(test_memory_compare); - ADD_TEST(test_memory_move); - ADD_TEST(test_memory_resize); - ADD_TEST(test_memory_is_valid); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_alloc); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_realloc); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_dup); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_zero); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_compare); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_move); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_resize); + FOSSIL_TEST_ADD(c_memory_suite, c_test_memory_is_valid); + + FOSSIL_TEST_REGISTER(c_memory_suite); } diff --git a/code/tests/cases/test_memory.cpp b/code/tests/cases/test_memory.cpp new file mode 100644 index 0000000..bdf5474 --- /dev/null +++ b/code/tests/cases/test_memory.cpp @@ -0,0 +1,159 @@ +/* + * ----------------------------------------------------------------------------- + * Project: Fossil Logic + * + * This file is part of the Fossil Logic project, which aims to develop high- + * performance, cross-platform applications and libraries. The code contained + * herein is subject to the terms and conditions defined in the project license. + * + * Author: Michael Gene Brockus (Dreamer) + * + * Copyright (C) 2024 Fossil Logic. All rights reserved. + * ----------------------------------------------------------------------------- + */ +#include + +#include "fossil/lib/framework.h" + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Utilities +// * * * * * * * * * * * * * * * * * * * * * * * * +// Setup steps for things like test fixtures and +// mock objects are set here. +// * * * * * * * * * * * * * * * * * * * * * * * * + +// Define the test suite and add test cases +FOSSIL_TEST_SUITE(cpp_memory_suite); + +// Setup function for the test suite +FOSSIL_SETUP(cpp_memory_suite) { + // Setup code here +} + +// Teardown function for the test suite +FOSSIL_TEARDOWN(cpp_memory_suite) { + // Teardown code here +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Cases +// * * * * * * * * * * * * * * * * * * * * * * * * +// The test cases below are provided as samples, inspired +// by the Meson build system's approach of using test cases +// as samples for library usage. +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_CASE(cpp_test_memory_alloc) { + size_t size = 10; + fossil_memory_t ptr = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(ptr); + fossil_memory_free(ptr); // Cleanup +} + +FOSSIL_TEST_CASE(cpp_test_memory_realloc) { + size_t size = 10; + fossil_memory_t ptr = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(ptr); + + size *= 2; + ptr = fossil_memory_realloc(ptr, size); + ASSUME_NOT_CNULL(ptr); + + fossil_memory_free(ptr); // Cleanup +} + +FOSSIL_TEST_CASE(cpp_test_memory_dup) { + size_t size = 10; + fossil_memory_t src = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(src); + + fossil_memory_t dest = fossil_memory_dup(src, size); + ASSUME_NOT_CNULL(dest); + + ASSUME_ITS_TRUE(memcmp(src, dest, size) == 0); // Ensure that both blocks are identical + fossil_memory_free(src); + fossil_memory_free(dest); // Cleanup +} + +FOSSIL_TEST_CASE(cpp_test_memory_zero) { + size_t size = 10; + fossil_memory_t ptr = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(ptr); + + fossil_memory_zero(ptr, size); + for (size_t i = 0; i < size; ++i) { + ASSUME_ITS_TRUE(((unsigned char*)ptr)[i] == 0); // Ensure all bytes are zero + } + + fossil_memory_free(ptr); // Cleanup +} + +FOSSIL_TEST_CASE(cpp_test_memory_compare) { + size_t size = 10; + fossil_memory_t ptr1 = fossil_memory_alloc(size); + fossil_memory_t ptr2 = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(ptr1); + ASSUME_NOT_CNULL(ptr2); + + fossil_memory_set(ptr1, 0xAA, size); // Set all bytes to 0xAA + fossil_memory_set(ptr2, 0xAA, size); // Set all bytes to 0xAA + ASSUME_ITS_TRUE(fossil_memory_compare(ptr1, ptr2, size) == 0); // Should be equal + + fossil_memory_set(ptr2, 0xBB, size); // Change ptr2 + ASSUME_ITS_TRUE(fossil_memory_compare(ptr1, ptr2, size) != 0); // Should not be equal + + fossil_memory_free(ptr1); + fossil_memory_free(ptr2); // Cleanup +} + +FOSSIL_TEST_CASE(cpp_test_memory_move) { + size_t size = 10; + fossil_memory_t src = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(src); + + fossil_memory_t dest = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(dest); + + fossil_memory_set(src, 0xAA, size); + fossil_memory_move(dest, src, size); + ASSUME_ITS_TRUE(memcmp(dest, src, size) == 0); // Ensure memory is moved correctly + + fossil_memory_free(src); + fossil_memory_free(dest); // Cleanup +} + +FOSSIL_TEST_CASE(cpp_test_memory_resize) { + size_t size = 10; + fossil_memory_t ptr = fossil_memory_alloc(size); + ASSUME_NOT_CNULL(ptr); + + ptr = fossil_memory_resize(ptr, size, size * 2); + ASSUME_NOT_CNULL(ptr); // Ensure resizing works + + fossil_memory_free(ptr); // Cleanup +} + +FOSSIL_TEST_CASE(cpp_test_memory_is_valid) { + fossil_memory_t ptr = fossil_memory_alloc(10); + ASSUME_ITS_TRUE(fossil_memory_is_valid(ptr)); // Should be valid + ASSUME_ITS_TRUE(!fossil_memory_is_valid(nullptr)); // nullptr should not be valid + + fossil_memory_free(ptr); // Cleanup +} + +// * * * * * * * * * * * * * * * * * * * * * * * * +// * Fossil Logic Test Pool +// * * * * * * * * * * * * * * * * * * * * * * * * + +FOSSIL_TEST_GROUP(cpp_memory_tests) { + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_alloc); + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_realloc); + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_dup); + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_zero); + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_compare); + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_move); + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_resize); + FOSSIL_TEST_ADD(cpp_memory_suite, cpp_test_memory_is_valid); + + FOSSIL_TEST_REGISTER(cpp_memory_suite); +} diff --git a/code/tests/meson.build b/code/tests/meson.build index d28ff32..19a5ab9 100644 --- a/code/tests/meson.build +++ b/code/tests/meson.build @@ -1,20 +1,15 @@ if get_option('with_test').enabled() run_command(['python3', 'tools' / 'generate-runner.py'], check: true) - test_src = ['unit_runner.c'] - test_cubes = [ - 'cnullptr', 'memory', 'hostsys', 'arguments', 'command', - ] + test_c = ['unit_runner.c'] + test_cases = ['cnullptr', 'memory', 'hostsys', 'arguments', 'command',] - foreach cube : test_cubes - test_src += ['test_' + cube + '.c'] + foreach cases : test_cases + test_c += ['cases' / 'test_' + cases + '.c'] + test_c += ['cases' / 'test_' + cases + '.cpp'] endforeach - pizza = executable('runner', test_src, - include_directories: dir, - dependencies: [ - dependency('fossil-test'), - fossil_lib_dep]) + pizza_c = executable('testbed-c', test_c, include_directories: dir, dependencies: [dependency('fossil-test'), fossil_lib_dep]) - test('xunit_tests', pizza) # Renamed the test target for clarity -endif + test('fossil testing C', pizza_c) +endif \ No newline at end of file diff --git a/code/tests/tools/generate-runner.py b/code/tests/tools/generate-runner.py index cdc3e06..848b24e 100644 --- a/code/tests/tools/generate-runner.py +++ b/code/tests/tools/generate-runner.py @@ -4,15 +4,18 @@ class TestRunnerGenerator: def __init__(self): - self.directory = os.getcwd() + # Set the directory to a subdirectory named 'cases' within the current working directory + self.directory = os.path.join(os.getcwd(), "cases") def find_test_groups(self): test_groups = set() pattern = r"FOSSIL_TEST_GROUP\((\w+)\)" + # Walk through files in the specified directory, 'cases' for root, _, files in os.walk(self.directory): for file in files: - if file.startswith("test_") and file.endswith(".c"): + # Search for C and C++ files + if (file.startswith("test_") and file.endswith(".c")) or file.endswith(".cpp"): with open(os.path.join(root, file), "r") as f: content = f.read() matches = re.findall(pattern, content) @@ -20,55 +23,55 @@ def find_test_groups(self): return list(test_groups) - def generate_test_runner(self, test_groups): + def generate_c_runner(self, test_groups): + # Prepare header content for the test runner header = """ -// Generated Fossil Logic Test -""" - - header += """ -#include -""" - - header += """ +// Generated Fossil Logic Test Runner +#include // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test List -// * * * * * * * * * * * * * * * * * * * * * * * *\n""" +// * * * * * * * * * * * * * * * * * * * * * * * * +""" - extern_pools = "\n".join( + # Declare test group externs + extern_test_groups = "\n".join( [f"FOSSIL_TEST_EXPORT({group});" for group in test_groups] ) - runner = """ - + # Prepare runner content + runner = """\n // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Runner -// * * * * * * * * * * * * * * * * * * * * * * * *""" - - runner += """ +// * * * * * * * * * * * * * * * * * * * * * * * * int main(int argc, char **argv) { - FOSSIL_TEST_CREATE(argc, argv);\n""" + FOSSIL_TEST_START(argc, argv);\n""" - import_pools = "\n".join( + # Import test groups in the main function + import_test_groups = "\n".join( [f" FOSSIL_TEST_IMPORT({group});" for group in test_groups] ) - footer = """ + # Complete with footer + footer = """\n FOSSIL_TEST_RUN(); - return FOSSIL_TEST_ERASE(); -} // end of func + FOSSIL_TEST_SUMMARY(); + FOSSIL_TEST_END(); +} // end of main """ + # Write the generated test runner to 'unit_runner.c' with open("unit_runner.c", "w") as file: file.write(header) - file.write("\n") - file.write(extern_pools) + file.write(extern_test_groups) file.write(runner) - file.write(import_pools) - file.write("\n") + file.write(import_test_groups) file.write(footer) +# Instantiate the generator, find test groups, and generate the test runner generator = TestRunnerGenerator() test_groups = generator.find_test_groups() -generator.generate_test_runner(test_groups) + +# Generate the test runner for C and C++ tests +generator.generate_c_runner(test_groups) diff --git a/meson.build b/meson.build index 6ce63d8..aa656b2 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('Fossil Lib', 'c', 'cpp', meson_version: '>=1.3.0', license: 'MPL-2.0', - version: '0.1.0', - default_options: ['c_std=c18', 'cpp_std=c++20']) + version: '0.1.1', + default_options: ['c_std=c17,c18', 'cpp_std=c++20']) subdir('code') diff --git a/subprojects/fossil-test.wrap b/subprojects/fossil-test.wrap index a5e6783..d1554d1 100644 --- a/subprojects/fossil-test.wrap +++ b/subprojects/fossil-test.wrap @@ -3,9 +3,7 @@ # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-test.git -revision = v1.0.3 +revision = v1.1.4 [provide] -fossil-test = fossil_test_dep -fossil-mock = fossil_mock_dep -fossil-mark = fossil_mark_dep \ No newline at end of file +fossil-test = fossil_test_dep \ No newline at end of file