diff --git a/exercises/practice/affine-cipher/affine_cipher_test.c b/exercises/practice/affine-cipher/affine_cipher_test.c index dcff181..14b7805 100644 --- a/exercises/practice/affine-cipher/affine_cipher_test.c +++ b/exercises/practice/affine-cipher/affine_cipher_test.c @@ -139,6 +139,14 @@ void test_decode_with_a_not_coprime_to_m(void) { TEST_ASSERT_EQUAL_STRING("", buffer); } +void test_encode_boundary_characters(void) { + TEST_IGNORE(); + char buffer[BUFFER_SIZE]; + + encode(buffer, "/09:@AMNZ[`amnz{", 25, 12); + TEST_ASSERT_EQUAL_STRING("09maz nmazn", buffer); +} + int main(void) { UNITY_BEGIN(); RUN_TEST(test_encode_yes); @@ -157,5 +165,6 @@ int main(void) { RUN_TEST(test_decode_with_no_spaces_in_input); RUN_TEST(test_decode_with_too_many_spaces); RUN_TEST(test_decode_with_a_not_coprime_to_m); + RUN_TEST(test_encode_boundary_characters); return UNITY_END(); } diff --git a/exercises/practice/atbash-cipher/atbash_cipher_test.c b/exercises/practice/atbash-cipher/atbash_cipher_test.c index 5d9815b..a210661 100644 --- a/exercises/practice/atbash-cipher/atbash_cipher_test.c +++ b/exercises/practice/atbash-cipher/atbash_cipher_test.c @@ -123,6 +123,14 @@ void test_decode_with_no_spaces(void) { TEST_ASSERT_EQUAL_STRING("anobstacleisoftenasteppingstone", buffer); } +void test_encode_boundary_characters(void) { + TEST_IGNORE(); + char buffer[BUFFER_SIZE]; + + encode(buffer, "/09:@AMNZ[`amnz{"); + TEST_ASSERT_EQUAL_STRING("09znm aznma", buffer); +} + int main(void) { UNITY_BEGIN(); RUN_TEST(test_encode_yes); @@ -139,5 +147,6 @@ int main(void) { RUN_TEST(test_decode_all_the_letters); RUN_TEST(test_decode_with_too_many_spaces); RUN_TEST(test_decode_with_no_spaces); + RUN_TEST(test_encode_boundary_characters); return UNITY_END(); } diff --git a/exercises/practice/rotational-cipher/rotational_cipher_test.c b/exercises/practice/rotational-cipher/rotational_cipher_test.c index d98f75b..bb730b3 100644 --- a/exercises/practice/rotational-cipher/rotational_cipher_test.c +++ b/exercises/practice/rotational-cipher/rotational_cipher_test.c @@ -89,6 +89,14 @@ void test_rotate_all_letters(void) { TEST_ASSERT_EQUAL_STRING("Gur dhvpx oebja sbk whzcf bire gur ynml qbt.", buffer); } +void test_rotate_boundary_characters(void) { + TEST_IGNORE(); + char buffer[BUFFER_SIZE]; + + rotate(buffer, "/09:@AMNZ[`amnz{", 13); + TEST_ASSERT_EQUAL_STRING("/09:@NZAM[`nzam{", buffer); +} + int main(void) { UNITY_BEGIN(); RUN_TEST(test_rotate_a_by_0_same_output_as_input); @@ -101,5 +109,6 @@ int main(void) { RUN_TEST(test_rotate_numbers); RUN_TEST(test_rotate_punctuation); RUN_TEST(test_rotate_all_letters); + RUN_TEST(test_rotate_boundary_characters); return UNITY_END(); } diff --git a/generators/exercises/affine_cipher.py b/generators/exercises/affine_cipher.py index 8da2dc8..a8199fa 100644 --- a/generators/exercises/affine_cipher.py +++ b/generators/exercises/affine_cipher.py @@ -8,6 +8,22 @@ extern void decode(char *buffer, const char *phrase, unsigned a, unsigned b); """ +def extra_cases(): + return [ + { + "description": "encode boundary characters", + "property": "encode", + "input": { + "phrase": "/09:@AMNZ[`amnz{", + "key": { + "a": 25, + "b": 12 + } + }, + "expected": "09maz nmazn" + } + ] + def gen_func_body(prop, inp, expected): phrase = inp["phrase"] a = inp["key"]["a"] diff --git a/generators/exercises/atbash_cipher.py b/generators/exercises/atbash_cipher.py index 540c078..2e93b1a 100644 --- a/generators/exercises/atbash_cipher.py +++ b/generators/exercises/atbash_cipher.py @@ -8,6 +8,18 @@ extern void decode(char *buffer, const char *phrase); """ +def extra_cases(): + return [ + { + "description": "encode boundary characters", + "property": "encode", + "input": { + "phrase": "/09:@AMNZ[`amnz{" + }, + "expected": "09znm aznma" + } + ] + def gen_func_body(prop, inp, expected): phrase = inp["phrase"] str_list = [] diff --git a/generators/exercises/rotational_cipher.py b/generators/exercises/rotational_cipher.py index c51b3d2..8536e8b 100644 --- a/generators/exercises/rotational_cipher.py +++ b/generators/exercises/rotational_cipher.py @@ -6,6 +6,19 @@ extern void rotate(char *buffer, const char *text, int shift_key); """ +def extra_cases(): + return [ + { + "description": "rotate boundary characters", + "property": "rotate", + "input": { + "text": "/09:@AMNZ[`amnz{", + "shiftKey": 13 + }, + "expected": "/09:@NZAM[`nzam{" + } + ] + def gen_func_body(prop, inp, expected): text = inp["text"] shift_key = inp["shiftKey"]