diff options
author | dx <aryadevchavali1@gmail.com> | 2020-05-06 03:44:02 +0100 |
---|---|---|
committer | dx <aryadevchavali1@gmail.com> | 2020-05-06 03:44:02 +0100 |
commit | ef22f048087a79d99ac7e1cf7c7a3d83d7b66a7a (patch) | |
tree | 380ad5538613201f435d9896552e52a6ac214f97 /Converter | |
parent | 3aef989bf97185e4c01084dc6b99aeafcca215ff (diff) | |
download | mdhtml-ef22f048087a79d99ac7e1cf7c7a3d83d7b66a7a.tar.gz mdhtml-ef22f048087a79d99ac7e1cf7c7a3d83d7b66a7a.tar.bz2 mdhtml-ef22f048087a79d99ac7e1cf7c7a3d83d7b66a7a.zip |
+test for header depths
Diffstat (limited to 'Converter')
-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); + } } |