Test to confirm that rc commands are properly sorted.

This commit is contained in:
Micah Cowan 2008-04-22 22:59:22 -07:00
parent 8896339e8d
commit 1297ab8328
3 changed files with 32 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2008-04-22 Pranab Shenoy <pranab.loosinit.shenoy@gmail.com>
* init.c: Added test_commands_sorted unit test to check is
commands are sorted. Fixes bug #21245.
* test.c: Added test_commands_sorted to the test suite.
2008-04-22 Rabin Vincent <rabin@rab.in>
* ftp.c (ftp_get_listing): Only remove .listing if it has been

View File

@ -1530,6 +1530,29 @@ cleanup (void)
#ifdef TESTING
const char *
test_commands_sorted()
{
int prev_idx = 0, next_idx = 1;
int command_count = countof (commands) - 1;
int cmp = 0;
while (next_idx <= command_count)
{
cmp = strcasecmp (commands[prev_idx].name, commands[next_idx].name);
if (cmp > 0)
{
mu_assert ("FAILED", false);
break;
}
else
{
prev_idx ++;
next_idx ++;
}
}
return NULL;
}
const char *
test_cmd_spec_restrict_file_names()
{

View File

@ -38,6 +38,7 @@ as that of the covered work. */
const char *test_parse_content_disposition();
const char *test_subdir_p();
const char *test_dir_matches_p();
const char *test_commands_sorted();
const char *test_cmd_spec_restrict_file_names();
const char *test_append_uri_pathel();
const char *test_are_urls_equal();
@ -51,6 +52,7 @@ all_tests()
mu_run_test (test_parse_content_disposition);
mu_run_test (test_subdir_p);
mu_run_test (test_dir_matches_p);
mu_run_test (test_commands_sorted);
mu_run_test (test_cmd_spec_restrict_file_names);
mu_run_test (test_append_uri_pathel);
mu_run_test (test_are_urls_equal);