diff --git a/morse.c b/morse.c index 2a19ee5..046212b 100644 --- a/morse.c +++ b/morse.c @@ -42,7 +42,6 @@ const char* char_to_morse(char letter){ result_set = true; } } - printf("result_ptr: %s\n", result_ptr); if (!result_set){ result_ptr = ""; } @@ -55,14 +54,13 @@ char* string_to_morse(char* string){ char result[string_len*8]; char* result_ptr = result; // sets everything to null in the string, just in case there was data there previously. - //strcpy(result, ""); + strcpy(result, ""); for (int i = 0; i < string_len; i++){ strcat(result, char_to_morse(string[i])); if (i != string_len-1){ strcat(result, " "); } } - printf("result_ptr (long): %s\n", result_ptr); return result_ptr; } diff --git a/test.c b/test.c index a516768..523c947 100644 --- a/test.c +++ b/test.c @@ -12,8 +12,8 @@ const char* PASS = "PASS"; const char* EQ = "=="; const char* NEQ = "!="; -const char* PASS_FORMAT = "[%s]: \"%s\" %s \"%s\"\n"; -const char* FAIL_FORMAT = "[%s]: \"%s\" %s \"%s\"\n"; +const char* PASS_FORMAT = "\e[32m[%s]: \"%s\" %s \"%s\"\e[0m\n"; +const char* FAIL_FORMAT = "\e[31m[%s]: \"%s\" %s \"%s\"\e[0m\n"; void assert_str_eq(const char* s1, const char* s2){ tests_run++; @@ -111,8 +111,8 @@ void test_to_morse(){ } void test_string_to_morse(){ - assert_stm("Wee!", ".-- . . . -.-.--"); - assert_stm("Hello", ".... . .-. .-. ---"); + assert_stm("Wee!", ".-- . . -.-.--"); + assert_stm("Hello", ".... . .-.. .-.. ---"); assert_stm("world", ".-- --- .-. .-.. -.."); assert_stm("Hello world!", ".... . .-.. .-.. --- / .-- --- .-. .-.. -.. -.-.--"); assert_stm("I! HATE! YOU!", ".. -.-.-- / .... .- - . -.-.-- / -.-- --- ..- -.-.--");