diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2012-06-01 08:38:41 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2012-06-01 08:38:41 +0200 |
commit | 453030e01ca35ce084c775fc67610550f93d8b53 (patch) | |
tree | 800ed2dea40264879e695e81de472b52e18fae1b /test/test_hashutil.c | |
parent | 27f2ba9a15c16b226f5223dd81c28ea766f8f9ca (diff) | |
download | ccache-453030e01ca35ce084c775fc67610550f93d8b53.tar.gz |
Revert mistakenly merged parts of 27f2ba9a15c16b226f5223dd81c28ea766f8f9ca
Diffstat (limited to 'test/test_hashutil.c')
-rw-r--r-- | test/test_hashutil.c | 91 |
1 files changed, 1 insertions, 90 deletions
diff --git a/test/test_hashutil.c b/test/test_hashutil.c index 4a72d849..225841a5 100644 --- a/test/test_hashutil.c +++ b/test/test_hashutil.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2012 Joel Rosdahl + * Copyright (C) 2010 Joel Rosdahl * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -99,93 +99,4 @@ TEST(hash_multicommand_output_error_handling) CHECK(!hash_multicommand_output(&h2, "false; true", "not used")); } -TEST(hash_source_code_simple_case) -{ - struct mdfour h; - char input[] = "abc"; - size_t input_len = strlen(input); - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("a448017aaf21d8525fc10ae87aa6729d-3", hash_result(&h)); -} - -TEST(hash_source_code_with_c_style_comment) -{ - struct mdfour h; - char input[] = "a/*b*/c"; - size_t input_len = strlen(input); - - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("1c2c87080ee03418fb1279e3b1f09a68-3", hash_result(&h)); - - input[3] = 'd'; - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("1c2c87080ee03418fb1279e3b1f09a68-3", hash_result(&h)); -} - -TEST(hash_source_code_with_cplusplus_style_comment) -{ - struct mdfour h; - char input[] = "a//b\nc"; - size_t input_len = strlen(input); - - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("4a3fbbe3c140fa193227dba3814db6e6-3", hash_result(&h)); - - input[3] = 'd'; - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("4a3fbbe3c140fa193227dba3814db6e6-3", hash_result(&h)); -} - -TEST(hash_source_code_with_comment_inside_string) -{ - struct mdfour h; - char input[] = "a\"//b\"c"; - size_t input_len = strlen(input); - - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("4c2fa74b0843d8f93df5c04c98ccb0a4-7", hash_result(&h)); - - input[4] = 'd'; - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("f0069218ec640008cbfa2d150c1061bb-7", hash_result(&h)); -} - -TEST(hash_source_code_with_quote_in_string) -{ - struct mdfour h; - char input[] = "a\"\\\"b//c\""; // a"\"b//c" - size_t input_len = strlen(input); - - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("c4e45e7a7f6f29b000a51f187dc4cf06-9", hash_result(&h)); - - hash_start(&h); - input[7] = 'd'; - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("bef8fb852dddcee189b91b068a621c55-9", hash_result(&h)); -} - -TEST(hash_source_code_with_backslash_at_string_end) -{ - struct mdfour h; - char input[] = "a\"\\\\\"b//c"; // a"\\"b//c - size_t input_len = strlen(input); - - hash_start(&h); - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("7f3ccf27edadad1b90cb2cffb59775d6-6", hash_result(&h)); - - input[input_len - 1] = 'd'; - hash_source_code_string(&h, input, input_len, ""); - CHECK_STR_EQ_FREE2("7f3ccf27edadad1b90cb2cffb59775d6-6", hash_result(&h)); -} - TEST_SUITE_END |