diff --git a/exercises/practice/collatz-conjecture/.meta/example.s b/exercises/practice/collatz-conjecture/.meta/example.s index e645852..5c622ad 100644 --- a/exercises/practice/collatz-conjecture/.meta/example.s +++ b/exercises/practice/collatz-conjecture/.meta/example.s @@ -1,3 +1,5 @@ +.equ INVALID_NUMBER, -1 + .text .globl steps @@ -26,7 +28,7 @@ steps: b .loop .invalid: - mov x0, #-1 + mov x0, INVALID_NUMBER .return: ret diff --git a/exercises/practice/collatz-conjecture/collatz_conjecture.s b/exercises/practice/collatz-conjecture/collatz_conjecture.s index 58361be..cb56d32 100644 --- a/exercises/practice/collatz-conjecture/collatz_conjecture.s +++ b/exercises/practice/collatz-conjecture/collatz_conjecture.s @@ -1,3 +1,5 @@ +.equ INVALID_NUMBER, -1 + .text .globl steps diff --git a/exercises/practice/collatz-conjecture/collatz_conjecture_test.c b/exercises/practice/collatz-conjecture/collatz_conjecture_test.c index f90e0fe..5400dd6 100644 --- a/exercises/practice/collatz-conjecture/collatz_conjecture_test.c +++ b/exercises/practice/collatz-conjecture/collatz_conjecture_test.c @@ -2,7 +2,7 @@ #include -#define ERROR_VALUE -1 +#define INVALID_NUMBER -1 extern int steps(int64_t number); @@ -33,12 +33,12 @@ void test_large_number_of_even_and_odd_steps(void) { void test_zero_is_an_error(void) { TEST_IGNORE(); - TEST_ASSERT_EQUAL_INT(-1, steps(0)); + TEST_ASSERT_EQUAL_INT(INVALID_NUMBER, steps(0)); } void test_negative_value_is_an_error(void) { TEST_IGNORE(); - TEST_ASSERT_EQUAL_INT(-1, steps(-15)); + TEST_ASSERT_EQUAL_INT(INVALID_NUMBER, steps(-15)); } void test_large_positive(void) { @@ -48,7 +48,7 @@ void test_large_positive(void) { void test_large_negative(void) { TEST_IGNORE(); - TEST_ASSERT_EQUAL_INT(-1, steps(-7001002003)); + TEST_ASSERT_EQUAL_INT(INVALID_NUMBER, steps(-7001002003)); } int main(void) { diff --git a/generators/exercises/collatz_conjecture.py b/generators/exercises/collatz_conjecture.py index e758489..bff5f1e 100644 --- a/generators/exercises/collatz_conjecture.py +++ b/generators/exercises/collatz_conjecture.py @@ -3,7 +3,7 @@ #include -#define ERROR_VALUE -1 +#define INVALID_NUMBER -1 extern int steps(int64_t number); """ @@ -33,5 +33,5 @@ def extra_cases(): def gen_func_body(prop, inp, expected): number = inp["number"] if expected.__class__ == dict: - expected = -1 + expected = 'INVALID_NUMBER' return f"TEST_ASSERT_EQUAL_INT({expected}, {prop}({number}));\n"