]> sjero.net Git - wget/blobdiff - src/init.c
Test to confirm that rc commands are properly sorted.
[wget] / src / init.c
index e957e528c8cb4dbcde3b7aa5999a4d3f53b26edd..ab86c781eb86b2857303d6bf16b750e4ae155ac4 100644 (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()
 {