Esempio n. 1
0
File: main.c Progetto: txdv/cmark
int main() {
	int retval;
	test_batch_runner *runner = test_batch_runner_new();

	version(runner);
	constructor(runner);
	accessors(runner);
	node_check(runner);
	iterator(runner);
	iterator_delete(runner);
	create_tree(runner);
	hierarchy(runner);
	parser(runner);
	render_html(runner);
	utf8(runner);
	line_endings(runner);
	numeric_entities(runner);
	test_cplusplus(runner);

	test_print_summary(runner);
	retval =  test_ok(runner) ? 0 : 1;
	free(runner);

	return retval;
}
Esempio n. 2
0
/***********************************************************
 * main()
 ***********************************************************/
int main(int argc, char *argv[])
{
	test_positive_few();
	test_negative_few();
	test_many();

	test_bad_addr();

	test_print_summary();
	return 0;
}
Esempio n. 3
0
File: test.c Progetto: ariavie/bcm
cmd_result_t
test_print_list(int u, args_t *a)
/*
 * Function:    test_print_list
 * Purpose:     Print some/all of the tests and status.
 * Parameters:  u - unit #
 *              "*" for all tests
 *              List of tests
 *              Nothing for all (same as *)
 * Returns:     CMD_OK - success
 *              CMD_FAIL - failed to find test or if a test failed.
 */
{
    test_t      *test;
    char        *s;
    int         header = FALSE;
    int         i, supported, all, fail;
    cmd_result_t result = CMD_OK;
    uint32      chip = _test_chip(u);
    int         num_fail = 0;

    COMPILER_REFERENCE(u);

    /* Check for print all */

    if (ARG_CNT(a) > 0) {
        supported = (0 == strcmp(_ARG_CUR(a), "*"));
        all       = (0 == sal_strcasecmp(_ARG_CUR(a), "all"));
        fail = (0 == sal_strcasecmp(_ARG_CUR(a), "fail"));
        if (supported || all || fail) {         /* Consume Argument  */
            ARG_NEXT(a);
        }
    } else if (ARG_CNT(a) == 0) {
        supported = TRUE;
        all       = FALSE;
        fail   = FALSE;
    } else {
        supported = FALSE;
        all       = FALSE;
        fail   = FALSE;
    }   

    /* If "all" or supported, consume argument and list tests */

        if (fail) {
            for (i = 0; i < test_cnt; i++) {
                if (test_list[i].t_fail) {
                    cli_out("%d  ", test_list[i].t_test);
                    num_fail++;
                }
            }
            if (num_fail == 0) {
                    cli_out("All tests passed");
            }
            cli_out("\n");
            return(result);
        }

    if (all || supported) {
        int t_loops = 0, t_runs = 0, t_success = 0, t_fail = 0;
        if (chip == 0) {                /* No chip - print all */
            all = TRUE;
        }
        test_print_header(TRUE);
        test_print_separator();
        for (i = 0; i < test_cnt; i++) {
            if (all || 
                (supported && (chip & test_list[i].t_flags)) 
                || (test_list[i].t_flags & T_F_SEL_ALL)) {
                test_print_entry(u, &test_list[i]);
                t_loops += test_list[i].t_loops;
                t_runs += test_list[i].t_runs;
                t_success += test_list[i].t_success;
                t_fail += test_list[i].t_fail;
            }
        }
        test_print_summary(t_loops, t_runs, t_success, t_fail);
        test_print_separator();

        /*
          In order for the automated tests to automatically diagnose
          that a test failed, we need this function to return 
          something when an individual test fails.
         */
        if (t_runs == 0) {
            /*
             * We want return CMD_FAIL if no tests were run 
             */
            result = CMD_FAIL;
        } else if (t_fail > 0) {
            /*
             * We also want to return CMD_FAIL if any tests failed.
             */
            result = CMD_FAIL;
        }
        return(result);
    } 

    while ((s = ARG_GET(a)) != NULL) {
        test = test_find(s);
        if (!test) {
            cli_out("%s: Unable to locate test: %s\n", ARG_CMD(a), s);
            result = CMD_FAIL;
            continue;
        } 
        if (!header) {
            test_print_header(FALSE);
            test_print_separator();
            header = TRUE;
        }
        test_print_entry(u, test);
    }
    return(result);
}