<commit_before>#include <config.h>
#include <stdlib.h>
#include <stdint.h>
#include <check.h>
#include "../src/roman.h"

Roman* r;

void setup(void)
{
    r = roman_create();
}

void teardown(void)
{
    roman_free(r);
}

START_TEST(test_sanity)
{
    ck_assert_int_eq(42, 42);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_simple_req_3_3)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 
    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "II", "I", result);
    ck_assert_str_eq("I", result);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_borrow_chain_req_3_3)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 
    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "MM", "I", result);
    ck_assert_str_eq("MCMXCIX", result);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_le_zero_req_3_2)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 
    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "I", "II", result);
    ck_assert_str_eq("", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "I", "X", result);
    ck_assert_str_eq("", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "I", "M", result);
    ck_assert_str_eq("", result);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_invalid_inputs_req_3_1)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "BAD", "XLII", result);
    ck_assert_str_eq("Invalid Input", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "XLII", "BAD", result);
    ck_assert_str_eq("Invalid Input", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);
    roman_subtract(r, "XLII", "XLII", result);
    ck_assert_str_ne("Invalid Input", result);<commit_msg>R3.2 - Subtraction zero result tests<commit_after>#include <config.h>
#include <stdlib.h>
#include <stdint.h>
#include <check.h>
#include "../src/roman.h"

Roman* r;

void setup(void)
{
    r = roman_create();
}

void teardown(void)
{
    roman_free(r);
}

START_TEST(test_sanity)
{
    ck_assert_int_eq(42, 42);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_simple_req_3_3)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 
    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "II", "I", result);
    ck_assert_str_eq("I", result);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_borrow_chain_req_3_3)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 
    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "MM", "I", result);
    ck_assert_str_eq("MCMXCIX", result);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_le_zero_req_3_2)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 
    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "I", "II", result);
    ck_assert_str_eq("", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "I", "X", result);
    ck_assert_str_eq("", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "I", "M", result);
    ck_assert_str_eq("", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "I", "I", result);
    ck_assert_str_eq("", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "X", "X", result);
    ck_assert_str_eq("", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "M", "M", result);
    ck_assert_str_eq("", result);
}
END_TEST

START_TEST(test_roman_numeral_subtraction_invalid_inputs_req_3_1)
{
    uint8_t result[MAX_ROMAN_LENGTH]; 

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "BAD", "XLII", result);
    ck_assert_str_eq("Invalid Input", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);    
    roman_subtract(r, "XLII", "BAD", result);
    ck_assert_str_eq("Invalid Input", result);

    memset(result, '\0', MAX_ROMAN_LENGTH);
    roman_subtract(r, "XLII", "XLII", result);
    ck_assert_str_ne("Invalid Input", result);
{'fraction_non_alphanumeric': 0.15426997245179064, 'fraction_numerical': 0.013273228149261207, 'mean_word_length': 4.6016830294530155, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3471679', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1629, 'n_words': 256}