-main (void)
-{
- run_test (test_push_pop, "push/pop");
- run_test (test_insert_remove, "insert/remove");
- run_test (test_swap, "swap");
- run_test (test_swap_range, "swap_range");
- run_test (test_remove_range, "remove_range");
- run_test (test_remove_equal, "remove_equal");
- run_test (test_remove_if, "remove_if");
- run_test (test_find_equal, "find_equal");
- run_test (test_find_if, "find_if");
- run_test (test_find_adjacent_equal, "find_adjacent_equal");
- run_test (test_count_range, "count_range");
- run_test (test_count_equal, "count_equal");
- run_test (test_count_if, "count_if");
- run_test (test_min_max, "min/max");
- run_test (test_lexicographical_compare_3way, "lexicographical_compare_3way");
- run_test (test_apply, "apply");
- run_test (test_destroy, "destroy");
- run_test (test_reverse, "reverse");
- run_test (test_permutations_no_dups, "permutations (no dups)");
- run_test (test_permutations_with_dups, "permutations (with dups)");
- run_test (test_merge_no_dups, "merge (no dups)");
- run_test (test_merge_with_dups, "merge (with dups)");
- run_test (test_sort_exhaustive, "sort (exhaustive)");
- run_test (test_sort_stable, "sort (stability)");
- run_test (test_sort_subset, "sort (subset)");
- run_test (test_sort_big, "sort (big)");
- run_test (test_unique, "unique");
- run_test (test_sort_unique, "sort_unique");
- run_test (test_insert_ordered, "insert_ordered");
- run_test (test_partition, "partition");
- run_test (test_allocation_failure, "allocation failure");
- putchar ('\n');
-
- return 0;
-}
-
-/*
- Local Variables:
- compile-command: "gcc -Wall -Wstrict-prototypes -Wmissing-prototypes ll.c llx.c llx-test.c -o llx-test -g"
- End:
- */
+main (int argc, char *argv[])
+{
+ int i;
+
+ if (argc != 2)
+ {
+ fprintf (stderr, "exactly one argument required; use --help for help\n");
+ return EXIT_FAILURE;
+ }
+ else if (!strcmp (argv[1], "--help"))
+ {
+ printf ("%s: test doubly linked list of pointers (llx) library\n"
+ "usage: %s TEST-NAME\n"
+ "where TEST-NAME is one of the following:\n",
+ argv[0], argv[0]);
+ for (i = 0; i < N_TESTS; i++)
+ printf (" %s\n %s\n", tests[i].name, tests[i].description);
+ return 0;
+ }
+ else
+ {
+ for (i = 0; i < N_TESTS; i++)
+ if (!strcmp (argv[1], tests[i].name))
+ {
+ tests[i].function ();
+ return 0;
+ }
+
+ fprintf (stderr, "unknown test %s; use --help for help\n", argv[1]);
+ return EXIT_FAILURE;
+ }
+}