diff options
Diffstat (limited to 'Converter/src/test.c')
-rw-r--r-- | Converter/src/test.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Converter/src/test.c b/Converter/src/test.c index ff42fb3..82f8cd0 100644 --- a/Converter/src/test.c +++ b/Converter/src/test.c @@ -5,5 +5,23 @@ void test_header_depths(void) { + const int test_size = 5; + string test_strings[] = {"Header", "#Header", "##Header", "#Header#", + "#####Header"}; + string expected_results[] = {"Header", "<h1>Header</h1>", "<h2>Header</h2>", + "<h1>Header#</h1>", "<h5>Header</h5>"}; + for (int i = 0; i < test_size; ++i) + { + const string test_string = test_strings[i]; + const string expected_result = expected_results[i]; + const int length_of_test = strnlen(test_string, 512); + const int length_of_expected = strnlen(expected_result, 512); + const string test_result = compile_line(test_string, length_of_test); + + fprintf(stderr, "Testing %s => %s\n", test_string, expected_result); + fprintf(stderr, "Result: %s\n\n", test_result); + + assert(strncmp(test_result, expected_result, length_of_expected) == 0); + } } |