Index: ossp-pkg/xds/xds_test_lib.c RCS File: /v/ossp/cvs/ossp-pkg/xds/xds_test_lib.c,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/xds/xds_test_lib.c,v' 2>/dev/null --- xds_test_lib.c 2001/08/22 20:21:32 1.5 +++ xds_test_lib.c 2001/08/23 08:41:34 1.6 @@ -74,111 +74,6 @@ #endif /* XDS_TEST_XDS_CORE */ -#ifdef XDS_TEST_XDS_FIND_ENGINE - -int main(int argc, char *argv[]) -{ - const engine_map_t engines[] = { - {"alan", NULL, 0}, - {"berta", NULL, 0}, - {"caesar", NULL, 0}, - {"doris", NULL, 0}, - {"egon", NULL, 0}, - {"franziska", NULL, 0}, - {"gudrun", NULL, 0}, - {"heinz", NULL, 0}, - {"igor", NULL, 0}, - {"jamila", NULL, 0}, - {"karin", NULL, 0}, - {"louis", NULL, 0}, - }; - size_t engines_len = sizeof (engines) / sizeof (engine_map_t); - size_t pos; - size_t i; - - /* Does xds_find_engine handle an empty array? */ - if (xds_find_engine(engines, 0, "whatever", &pos)) { - printf("xds_find_engine() said 'whatever' would be in the array, but that's wrong.\n"); - exit(1); - } - if (pos != 0) { - printf("xds_find_engine() would insert 'whatever' at position %d, but 0 is correct.\n", pos); - exit(1); - } - - /* Search for every single entry in the array and check the results. */ - for (i = 0; i < engines_len; ++i) { - if (!xds_find_engine(engines, engines_len, engines[i].name, &pos)) { - printf("xds_find_engine() said '%s' wouldn't be in the array, but that's wrong.\n", engines[i].name); - exit(1); - } - if (pos != i) { - printf("xds_find_engine() would insert '%s' at position %d, but %d is correct.\n", engines[i].name, pos, i); - exit(1); - } - } - - /* Search for non-existing name that would be inserted at the first - position. */ - if (xds_find_engine(engines, engines_len, "aaron", &pos)) { - printf("xds_find_engine() said 'aaron' would be in the array, but that's wrong.\n"); - exit(1); - } - if (pos != 0) { - printf("xds_find_engine() would insert 'aaron' at position %d, but 0 is correct.\n", pos); - exit(1); - } - - /* Search for non-existing name that would be inserted at last position. */ - if (xds_find_engine(engines, engines_len, "zerberos", &pos)) { - printf("xds_find_engine() said 'zerberos' would be in the array, but that's wrong.\n"); - exit(1); - } - if (pos != engines_len) { - printf("xds_find_engine() would insert 'zerberos' at position %d, but %d is correct.\n", pos, engines_len); - exit(1); - } - - /* Search for non-existing names that would be inserted at random positions. */ - if (xds_find_engine(engines, engines_len, "balthasar", &pos)) { - printf("xds_find_engine() said 'balthasar' would be in the array, but that's wrong.\n"); - exit(1); - } - if (pos != 1) { - printf("xds_find_engine() would insert 'balthasar' at position %d, but 1 is correct.\n", pos); - exit(1); - } - if (xds_find_engine(engines, engines_len, "bulli", &pos)) { - printf("xds_find_engine() said 'bulli' would be in the array, but that's wrong.\n"); - exit(1); - } - if (pos != 2) { - printf("xds_find_engine() would insert 'bulli' at position %d, but 2 is correct.\n", pos); - exit(1); - } - if (xds_find_engine(engines, engines_len, "hildegard", &pos)) { - printf("xds_find_engine() said 'hildegard' would be in the array, but that's wrong.\n"); - exit(1); - } - if (pos != 8) { - printf("xds_find_engine() would insert 'hildegard' at position %d, but 8 is correct.\n", pos); - exit(1); - } - if (xds_find_engine(engines, engines_len, "harald", &pos)) { - printf("xds_find_engine() said 'harald' would be in the array, but that's wrong.\n"); - exit(1); - } - if (pos != 7) { - printf("xds_find_engine() would insert 'harald' at position %d, but 7 is correct.\n", pos); - exit(1); - } - - /* Everything went fine. */ - return 0; -} - -#endif /* XDS_TEST_XDS_FIND_ENGINE */ - #ifdef XDS_TEST_XDS_REGISTER static int dummy_engine(xds_t *xds, void *engine_context,