diff --git a/.github/ciimage/Dockerfile.debian b/.github/ciimage/Dockerfile.debian index bd9c16f..640587f 100644 --- a/.github/ciimage/Dockerfile.debian +++ b/.github/ciimage/Dockerfile.debian @@ -1,5 +1,5 @@ -# Use a specific Debian base image -FROM debian:buster +# Use a specific Debian Bookworm base image +FROM debian:bookworm # Set environment variables to avoid interaction ENV DEBIAN_FRONTEND=noninteractive \ @@ -7,28 +7,30 @@ ENV DEBIAN_FRONTEND=noninteractive \ # Install system dependencies and clean up RUN apt-get update && \ - apt-get install -y \ + apt-get install -y --no-install-recommends \ build-essential \ clang \ gcc \ g++ \ gdb \ llvm \ - libstdc++-8-dev \ + libstdc++-12-dev \ wget \ python3 \ + python3-full \ python3-pip \ - git && \ + git \ + ca-certificates && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -# Install Meson and Ninja -RUN python3 -m pip install --no-cache-dir meson ninja==1.10.2 +# 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 # Set environment variables -ENV CC=/usr/bin/clang -ENV CXX=/usr/bin/clang++ -ENV LD_LIBRARY_PATH=/usr/local/lib +ENV CC=clang \ + CXX=clang++ \ + LD_LIBRARY_PATH=/usr/local/lib # Set working directory WORKDIR /workspace diff --git a/.github/workflows/meson_ci.yml b/.github/workflows/meson_ci.yml index 7d0e457..969817d 100644 --- a/.github/workflows/meson_ci.yml +++ b/.github/workflows/meson_ci.yml @@ -5,8 +5,6 @@ on: paths: - "**.c" - "**.h" - - "**.cpp" - - "**.hpp" - "**.py" - "**.build" - "**.options" @@ -14,8 +12,6 @@ on: paths: - "**.c" - "**.h" - - "**.cpp" - - "**.hpp" - "**.py" - "**.build" - "**.options" @@ -26,7 +22,7 @@ jobs: runs-on: windows-latest strategy: matrix: - msvc_version: [2015, 2017, 2019, 2022] + msvc_version: [2015, 2017, 2019, 2022, 2025] steps: - name: Checkout code uses: actions/checkout@v4 @@ -51,6 +47,8 @@ jobs: 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" + } elseif ($env:msvc_version -eq "2025") { + choco install visualstudio2025buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive" } $env:CC="cl.exe" $env:CXX="cl.exe" @@ -58,18 +56,8 @@ jobs: - name: Configure run: meson setup builddir_msvc_${{ matrix.msvc_version }} --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir_msvc_${{ matrix.msvc_version }} - - name: Run Tests - run: meson test -C builddir_msvc_${{ matrix.msvc_version }} -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: windows_msvc_${{ matrix.msvc_version }}_meson_testlog - path: builddir_msvc_${{ matrix.msvc_version }}/meson-logs/testlog.txt + run: meson test -C builddir_msvc_${{ matrix.msvc_version }} -v --test-args='show --mode tree --verbose ci --result fail' build_macosx: name: Building on macOS with Xcode ${{ matrix.xcode_version }} @@ -98,18 +86,8 @@ jobs: - name: Configure run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir - - name: Run Tests - run: meson test -C builddir -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: macos_xcode_${{ matrix.xcode_version }}_meson_testlog - path: builddir/meson-logs/testlog.txt + run: meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' build_msys: name: Building on MSYS ${{ matrix.architecture }} @@ -145,18 +123,8 @@ jobs: - name: Configure run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir - - name: Run Tests - run: meson test -C builddir -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: msys_${{ matrix.architecture }}_meson_testlog - path: builddir/meson-logs/testlog.txt + run: meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' build_mingw: name: Building on MinGW ${{ matrix.architecture }} @@ -196,18 +164,8 @@ jobs: - name: Configure run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir - - name: Run Tests - run: meson test -C builddir -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: mingw_${{ matrix.architecture }}_meson_testlog - path: builddir/meson-logs/testlog.txt + run: meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' build_posix: name: Build on Linux ${{ matrix.distro }} @@ -249,8 +207,7 @@ jobs: /bin/bash -c " sudo apt update meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - meson compile -C builddir - meson test -C builddir -v" + meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail'" build_cross: name: Building on Bedrock ${{ matrix.architecture }} @@ -344,4 +301,8 @@ jobs: - name: Build the Project run: | - meson compile -C builddir \ No newline at end of file + meson compile -C builddir + + - name: Test the Project + run: | + meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' diff --git a/README.md b/README.md index aa64560..804cd28 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ To get started with Fossil Io, ensure you have the following installed: # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-io.git - revision = v0.2.1 + revision = v0.2.2 [provide] fossil-io = fossil_io_dep diff --git a/code/logic/fossil/io/soap.h b/code/logic/fossil/io/soap.h index ed4ba45..515d695 100644 --- a/code/logic/fossil/io/soap.h +++ b/code/logic/fossil/io/soap.h @@ -58,50 +58,129 @@ void fossil_io_soap_clear_custom_filters(void); */ const char *fossil_io_soap_detect_tone(const char *text); +/** + * @brief Analyze sentence structure and flag grammatical inconsistencies. + * + * @param text Input string to analyze. + * @return 0 if grammar is clean, non-zero otherwise. + */ +int fossil_io_soap_check_grammar(const char *text); + +/** + * @brief Normalize all informal or abbreviated expressions. + * + * @param text Input string to normalize. + * @return A newly allocated normalized string (caller must free). + */ +char *fossil_io_soap_normalize(const char *text); + +/** + * @brief Normalize internet slang or leetspeak in input text. + * + * @param text The input string. + * @return A dynamically allocated cleaned-up version (must be freed). + */ +char *fossil_io_soap_normalize_slang(const char *text); + +/** + * @brief Apply a grammar correction pass over the input text. + * + * @param text The input text. + * @return A dynamically allocated corrected string (must be freed). + */ +char *fossil_io_soap_correct_grammar(const char *text); + +/** + * @brief Detect exaggeration or hyperbolic language in a sentence. + * + * @param text The input string. + * @return 1 if exaggeration detected, 0 otherwise. + */ +int fossil_io_soap_detect_exaggeration(const char *text); + +/** + * @brief Replace offensive language with neutral alternatives. + * + * @param text The input string. + * @return A dynamically allocated sanitized string (must be freed). + */ +char *fossil_io_soap_filter_offensive(const char *text); + +/** + * @brief Check if input contains clickbait-style language. + * + * @param text The input string. + * @return 1 if clickbait is detected, 0 otherwise. + */ +int fossil_io_soap_detect_clickbait(const char *text); + #ifdef __cplusplus } #include +#include /** * C++ wrapper for the SOAP API. */ namespace fossil { - - /** - * Namespace for I/O operations. - */ namespace io { + /** - * SOAP API for sanitizing strings. + * @brief SOAP API for sanitizing and analyzing user text input. + * + * Provides C++ wrappers for detecting, transforming, or correcting slang, tone, sentiment, + * clickbait, and other language features with a focus on clarity and safety. */ class Soap { public: + /** - * Sanitize input text by removing or replacing "rot-brain" and meme-based language. - * - * @param text The input text to sanitize. - * @return A dynamically allocated sanitized string (must be freed by the caller). + * @brief Sanitize input by replacing meme/rot-brain terms with standard alternatives. + * + * @param text The input string. + * @return A cleaned-up version of the text. */ static std::string sanitize(const std::string &text) { - return fossil_io_soap_sanitize(text.c_str()); + std::unique_ptr ptr(fossil_io_soap_sanitize(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; } /** - * Suggest proper alternatives for rot-brain words or grammar fixes. + * @brief Sanitize input text (C-style). * - * @param text The input text. - * @param format_type Custom format for output (e.g., "*" or "#"). - * @return A dynamically allocated string with suggestions (must be freed by the caller). + * @param text The input string. + * @return A heap-allocated cleaned-up version (must be freed manually). + */ + static char* sanitize(const char* text) { + return fossil_io_soap_sanitize(text); + } + + /** + * @brief Suggest alternative expressions for slang or incorrect grammar. + * + * @param text The input string. + * @return A string with suggested improvements. */ static std::string suggest(const std::string &text) { - return fossil_io_soap_suggest(text.c_str()); + std::unique_ptr ptr(fossil_io_soap_suggest(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; } /** - * Add a custom word or phrase to the filter. - * - * @param phrase The phrase to add. + * @brief Suggest improvements (C-style). + * + * @param text The input string. + * @return A heap-allocated suggestion (must be freed manually). + */ + static char* suggest(const char* text) { + return fossil_io_soap_suggest(text); + } + + /** + * @brief Add a custom slang or flagged phrase to the filter. + * + * @param phrase The custom phrase. * @return 0 on success, nonzero on failure. */ static int add_custom_filter(const std::string &phrase) { @@ -109,68 +188,98 @@ namespace fossil { } /** - * Clear all custom filters. + * @brief Add a custom slang or flagged phrase to the filter (C-style). + * + * @param phrase The custom phrase. + * @return 0 on success, nonzero on failure. + */ + static int add_custom_filter(const char* phrase) { + return fossil_io_soap_add_custom_filter(phrase); + } + + /** + * @brief Clear all user-added custom filters. */ static void clear_custom_filters() { fossil_io_soap_clear_custom_filters(); } /** - * Detect the tone of a sentence. - * - * @param text The input text. - * @return A string representing the detected tone ("formal", "casual", "sarcastic", etc.). + * @brief Detect tone of the input (e.g., "sarcastic", "formal"). + * + * @param text The input string. + * @return A tone descriptor string. */ static std::string detect_tone(const std::string &text) { - return fossil_io_soap_detect_tone(text.c_str()); + return std::string(fossil_io_soap_detect_tone(text.c_str())); } /** - * Sanitize input text by removing or replacing "rot-brain" and meme-based language. - * - * @param text The input text to sanitize. - * @return A dynamically allocated sanitized string (must be freed by the caller). + * @brief Detect tone of the input (C-style). + * + * @param text The input string. + * @return A tone descriptor string. */ - static char* sanitize(const char* text) { - return fossil_io_soap_sanitize(text); + static const char* detect_tone(const char* text) { + return fossil_io_soap_detect_tone(text); } /** - * Suggest proper alternatives for rot-brain words or grammar fixes. - * - * @param text The input text. - * @param format_type Custom format for output (e.g., "*" or "#"). - * @return A dynamically allocated string with suggestions (must be freed by the caller). + * @brief Check if the input contains exaggerated or hyperbolic language. + * + * @param text The input string. + * @return true if exaggerated, false otherwise. */ - static char* suggest(const char* text) { - return fossil_io_soap_suggest(text); + static bool is_exaggerated(const std::string &text) { + return fossil_io_soap_detect_exaggeration(text.c_str()) != 0; } /** - * Add a custom word or phrase to the filter. - * - * @param phrase The phrase to add. - * @return 0 on success, nonzero on failure. + * @brief Check if the input uses clickbait language. + * + * @param text The input string. + * @return true if clickbait detected, false otherwise. */ - static int add_custom_filter(const char* phrase) { - return fossil_io_soap_add_custom_filter(phrase); + static bool is_clickbait(const std::string &text) { + return fossil_io_soap_detect_clickbait(text.c_str()) != 0; } /** - * Detect the tone of a sentence. - * - * @param text The input text. - * @return A string representing the detected tone ("formal", "casual", "sarcastic", etc.). + * @brief Normalize slang and internet abbreviations. + * + * @param text The input string. + * @return A cleaned version of the input text. */ - static const char* detect_tone(const char* text) { - return fossil_io_soap_detect_tone(text); + static std::string normalize_slang(const std::string &text) { + std::unique_ptr ptr(fossil_io_soap_normalize_slang(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; } - }; + /** + * @brief Fix common grammar errors in input text. + * + * @param text The input string. + * @return A corrected version of the input. + */ + static std::string correct_grammar(const std::string &text) { + std::unique_ptr ptr(fossil_io_soap_correct_grammar(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; + } - } + /** + * @brief Replace offensive language with neutral alternatives. + * + * @param text The input string. + * @return A sanitized version with offensive terms filtered out. + */ + static std::string filter_offensive(const std::string &text) { + std::unique_ptr ptr(fossil_io_soap_filter_offensive(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; + } + }; -} + } // namespace io +} // namespace fossil #endif diff --git a/code/logic/network.c b/code/logic/network.c index e090d03..7cbc6e7 100644 --- a/code/logic/network.c +++ b/code/logic/network.c @@ -44,6 +44,7 @@ struct fossil_nstream_t { static char fossil_last_error[256] = {0}; + static void fossil_set_last_error(const char *msg) { snprintf(fossil_last_error, sizeof(fossil_last_error), "%s", msg); } diff --git a/code/logic/output.c b/code/logic/output.c index c696cfd..5a43d7f 100644 --- a/code/logic/output.c +++ b/code/logic/output.c @@ -85,6 +85,8 @@ void fossil_io_apply_color(const char *color) { printf(FOSSIL_IO_COLOR_BRIGHT_CYAN); } else if (strcmp(color, "bright_white") == 0) { printf(FOSSIL_IO_COLOR_BRIGHT_WHITE); + } else { + printf(FOSSIL_IO_COLOR_RESET); // Reset to default if color not recognized } } @@ -112,19 +114,30 @@ void fossil_io_apply_attribute(const char *attribute) { // Function to handle named positions (like top, bottom, left, right) void fossil_io_apply_position(const char *pos) { if (strcmp(pos, "top") == 0) { - // Apply position logic for top - printf("\033[H"); // Move cursor to the top + printf("\033[1;1H"); // Move to top } else if (strcmp(pos, "bottom") == 0) { - // Apply position logic for bottom - printf("\033[1000H"); // Move cursor to the bottom (just as an example) + printf("\033[1000;1H"); // Move cursor to bottom-left } else if (strcmp(pos, "left") == 0) { - // Apply position logic for left - printf("\033[1000;0H"); // Move cursor to the left + printf("\033[1;1H"); // Move to top-left (as a general left start) } else if (strcmp(pos, "right") == 0) { - // Apply position logic for right - printf("\033[1000;1000H"); // Move cursor to the right + printf("\033[1;1000H"); // Move to top-right + } else if (strcmp(pos, "center") == 0) { + printf("\033[25;40H"); // Approximate center for 80x50 terminal + } else if (strcmp(pos, "top-left") == 0) { + printf("\033[1;1H"); + } else if (strcmp(pos, "top-right") == 0) { + printf("\033[1;1000H"); + } else if (strcmp(pos, "bottom-left") == 0) { + printf("\033[1000;1H"); + } else if (strcmp(pos, "bottom-right") == 0) { + printf("\033[1000;1000H"); + } else if (strcmp(pos, "middle-left") == 0) { + printf("\033[25;1H"); // Mid vertical, far left + } else if (strcmp(pos, "middle-right") == 0) { + printf("\033[25;1000H"); // Mid vertical, far right + } else { + fprintf(stderr, "Unknown position: %s\n", pos); } - // Add more positions if needed } // Function to print text with attributes, colors, positions, and format specifiers diff --git a/code/logic/soap.c b/code/logic/soap.c index 32fce3d..3180f1a 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -12,6 +12,7 @@ * ----------------------------------------------------------------------------- */ #include "fossil/io/soap.h" +#include "fossil/io/cstring.h" #include #include #include @@ -383,3 +384,166 @@ const char *fossil_io_soap_detect_tone(const char *text) { return "casual"; } + +int fossil_io_soap_check_grammar(const char *text) { + if (!text) return -1; + for (size_t i = 0; FOSSIL_SOAP_GRAMMAR_SUGGESTIONS[i].incorrect; i++) { + if (custom_strcasestr(text, FOSSIL_SOAP_GRAMMAR_SUGGESTIONS[i].incorrect)) { + return 1; // Grammar issue found + } + } + return 0; +} + +char *fossil_io_soap_normalize(const char *text) { + if (!text) return NULL; + + char *normalized = fossil_io_cstring_dup(text); // Create modifiable copy + if (!normalized) return NULL; + + for (size_t i = 0; FOSSIL_SOAP_SUGGESTIONS[i].bad; i++) { + const char *bad = FOSSIL_SOAP_SUGGESTIONS[i].bad; + const char *fix = FOSSIL_SOAP_SUGGESTIONS[i].suggested; + const char *ptr; + while ((ptr = custom_strcasestr(normalized, bad))) { + size_t prefix_len = ptr - normalized; + size_t new_len = strlen(normalized) - strlen(bad) + strlen(fix) + 1; + char *temp = malloc(new_len); + if (!temp) break; + snprintf(temp, new_len, "%.*s%s%s", + (int)prefix_len, normalized, fix, ptr + strlen(bad)); + free(normalized); + normalized = temp; + } + } + + return normalized; +} + + +char *fossil_io_soap_normalize_slang(const char *text) { + if (!text) return NULL; + + char *result = fossil_io_cstring_dup(text); + if (!result) return NULL; + + for (size_t i = 0; result[i]; i++) { + result[i] = tolower(result[i]); + } + + for (size_t i = 0; FOSSIL_SOAP_SUGGESTIONS[i].bad != NULL; i++) { + const char *bad = FOSSIL_SOAP_SUGGESTIONS[i].bad; + const char *sugg = FOSSIL_SOAP_SUGGESTIONS[i].suggested; + + const char *found = NULL; + while ((found = custom_strcasestr(result, bad)) != NULL) { + size_t offset = (size_t)(found - result); + size_t newlen = strlen(result) - strlen(bad) + strlen(sugg) + 1; + + char *temp = malloc(newlen); + if (!temp) { + free(result); + return NULL; + } + + strncpy(temp, result, offset); + temp[offset] = '\0'; + strcat(temp, sugg); + strcat(temp, result + offset + strlen(bad)); + + free(result); + result = temp; + } + } + + return result; +} + +int fossil_io_soap_detect_clickbait(const char *text) { + if (!text) return 0; + + static const char *CLICKBAIT_PATTERNS[] = { + "you won't believe", + "shocking", + "what happened next", + "top [0-9]", + "things you didn't know", + "one weird trick", + "will blow your mind", + "can't handle this", + "before you die", + NULL + }; + + for (int i = 0; CLICKBAIT_PATTERNS[i] != NULL; i++) { + if (custom_strcasestr(text, CLICKBAIT_PATTERNS[i])) { + return 1; + } + } + + return 0; +} + +int fossil_io_soap_detect_exaggeration(const char *text) { + if (!text) return 0; + + static const char *EXAGGERATED_WORDS[] = { + "literally", "always", "never", "every", "everyone", "nobody", + "forever", "insane", "unbelievable", "outrageous", "epic", "mind-blowing", + NULL + }; + + for (int i = 0; EXAGGERATED_WORDS[i] != NULL; i++) { + if (custom_strcasestr(text, EXAGGERATED_WORDS[i])) { + return 1; + } + } + + return 0; +} + +char *fossil_io_soap_filter_offensive(const char *text) { + if (!text) return NULL; + + static const struct { + const char *offensive; + const char *replacement; + } OFFENSIVE_WORDS[] = { + {"dumb", "uninformed"}, + {"stupid", "ill-advised"}, + {"idiot", "misguided"}, + {"moron", "uninformed"}, + {"sucks", "is not ideal"}, + {NULL, NULL} + }; + + char *result = fossil_io_cstring_dup(text); + if (!result) return NULL; + + for (size_t i = 0; OFFENSIVE_WORDS[i].offensive != NULL; i++) { + const char *bad = OFFENSIVE_WORDS[i].offensive; + const char *good = OFFENSIVE_WORDS[i].replacement; + + const char *found = NULL; + while ((found = custom_strcasestr(result, bad)) != NULL) { + size_t offset = (size_t)(found - result); + size_t newlen = strlen(result) - strlen(bad) + strlen(good) + 1; + + char *temp = malloc(newlen); + if (!temp) { + free(result); + return NULL; + } + + strncpy(temp, result, offset); + temp[offset] = '\0'; + strcat(temp, good); + strcat(temp, result + offset + strlen(bad)); + + free(result); + result = temp; + } + } + + return result; +} diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 09e3c3b..acb8e29 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -215,6 +215,60 @@ FOSSIL_TEST(c_test_io_soap_suggest_with_tabs) { free(result); } +FOSSIL_TEST(c_test_io_soap_check_grammar_valid) { + const char *input = "She writes clearly and concisely."; + ASSUME_ITS_TRUE(fossil_io_soap_check_grammar(input) == 0); +} + +FOSSIL_TEST(c_test_io_soap_check_grammar_error) { + const char *input = "Him go store."; + ASSUME_ITS_TRUE(fossil_io_soap_check_grammar(input) != 0); +} + +FOSSIL_TEST(c_test_io_soap_normalize_informal) { + const char *input = "u gotta see this"; + const char *expected = "you have to see this"; + char *result = fossil_io_soap_normalize(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_normalize_slang_basic) { + const char *input = "idk why ppl do that lol"; + const char *expected = "I don't know why people do that."; + char *result = fossil_io_soap_normalize_slang(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_detect_exaggeration_true) { + const char *input = "This is the worst thing to ever happen in history!"; + ASSUME_ITS_TRUE(fossil_io_soap_detect_exaggeration(input) == 1); +} + +FOSSIL_TEST(c_test_io_soap_detect_exaggeration_false) { + const char *input = "The weather is mildly unpleasant today."; + ASSUME_ITS_TRUE(fossil_io_soap_detect_exaggeration(input) == 0); +} + +FOSSIL_TEST(c_test_io_soap_filter_offensive_basic) { + const char *input = "You're an idiot."; + const char *expected = "You're being unreasonable."; + char *result = fossil_io_soap_filter_offensive(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_detect_clickbait_true) { + const char *input = "You won't believe what happened next!"; + ASSUME_ITS_TRUE(fossil_io_soap_detect_clickbait(input) == 1); +} + +FOSSIL_TEST(c_test_io_soap_detect_clickbait_false) { + const char *input = "Scientists publish new findings in journal."; + ASSUME_ITS_TRUE(fossil_io_soap_detect_clickbait(input) == 0); +} + // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Pool // * * * * * * * * * * * * * * * * * * * * * * * * @@ -242,6 +296,15 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_special_chars); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_newlines); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_tabs); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_check_grammar_valid); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_check_grammar_error); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_informal); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_slang_basic); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_true); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_false); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_filter_offensive_basic); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_true); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_false); FOSSIL_TEST_REGISTER(c_soap_suite); } diff --git a/meson.build b/meson.build index 298a4e6..09a34f4 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('Fossil IO', 'c', 'cpp', meson_version: '>=1.3.0', license: 'MPL-2.0', - version: '0.2.1', + version: '0.2.2', 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 8e935a5..f025ad4 100644 --- a/subprojects/fossil-test.wrap +++ b/subprojects/fossil-test.wrap @@ -3,7 +3,7 @@ # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-test.git -revision = v1.2.4 +revision = v1.2.5 [provide] fossil-test = fossil_test_dep