int main(int argc, char **argv) {
    TestSuite *suite = stream_tests();
    if (argc > 1) {
        return run_single_test(suite, argv[1], create_text_reporter());
    }
    return run_test_suite(suite, create_text_reporter());
}
int main(int argc, char **argv) {
	TestSuite *suite = create_test_suite();

	add_suite(suite, density_contrast_tests());
	add_suite(suite, cic_tests());

	if (argc > 1) {
		return run_single_test(suite, argv[1], create_text_reporter());
	}

	return run_test_suite(suite, create_text_reporter());
}
Beispiel #3
0
/*
 * Main test case entry
 */
int main(int argc, char** argv) {

    TestSuite *suite = create_test_suite();

    add_suite(suite, atmi_test_all());


    if (argc > 1) {
        return run_single_test(suite,argv[1],create_text_reporter());
    }

    return run_test_suite(suite, create_text_reporter());
}
Beispiel #4
0
int main(int argc, char *argv[])
{
    uint32_t i = 0;
    int32_t rtrn = 0;

    /* Create the stats object. */
    test_stat = create_stats_obj();
    if(test_stat == NULL)
    {
        output(ERROR, "Can't create stats object\n");
        return (-1);
    }

    /* Set stats members to zero. */
    test_stat->fails = 0;
    test_stat->test_ran = 0;
    test_stat->successes = 0;
    test_stat->asserts_ran = 0;

    if(argc == 1)
    {
        output(STD, "Starting nextgen's test suite\n");
    }
    else
    {
        run_single_test(argv);
        return (0);
    }

    /* Loop and execute each test in the test array. */
    for(i = 0; i < number_of_test; i++)
    {
        /* Execute the unit test. */
    	rtrn = exec_test(test_paths[i]); 
    	if(rtrn < 0)
        {
            output(ERROR, "Can't exec unit test\n");
            /* Continue executing the test suite. */
    	    continue;
        }
    }

    /* Output results. */
    output(STD, "[%d] %ld successful assertions, %ld tests passed, and %ld tests failed.\n", \
          (100 * test_stat->successes) / test_stat->test_ran, test_stat->asserts_ran, test_stat->successes, test_stat->fails);

	return (0);
}
Beispiel #5
0
int main(int argc, char **argv) {
    TestSuite *suite = create_test_suite();
    add_test(suite, reading_lines_from_empty_stream_gives_null);
    add_test(suite, one_character_stream_gives_one_character_line);
    add_test(suite, one_word_stream_gives_one_word_line);
    add_test(suite, drops_line_ending_from_word_and_stops);
    add_test(suite, single_line_ending_gives_empty_line);
    add_test(suite, one_character_is_made_into_a_one_letter_paragraph);
    add_test(suite, no_line_endings_makes_one_paragraph);
    add_test(suite, line_endings_generate_separate_paragraphs);
    add_test(suite, resources_are_paired_with_the_functions);
    add_test(suite, empty_paragraphs_are_ignored);
    if (argc > 1) {
        return run_single_test(suite, argv[1], create_text_reporter());
    }
    return run_test_suite(suite, create_text_reporter());
}
Beispiel #6
0
/*----------------------------------------------------------------------*/
static int run_tests(TestReporter *reporter, const char *suite_name, const char *symbolic_name,
                     void *test_library_handle, TestItem test_items[], bool verbose) {
    int status;
    ContextSuite *context_suites = NULL;
    TestSuite *suite = create_named_test_suite(suite_name);

    const int number_of_matches = add_matching_tests_to_suite(test_library_handle, symbolic_name,
                                                              test_items, suite, &context_suites);

    if (error_when_matching(number_of_matches))
        return EXIT_FAILURE;

    if (symbolic_name != NULL && number_of_matches == 1) {
        bool found = matching_test_exists(symbolic_name, test_items);
        if (verbose)
            printf(" to only run one test: '%s' ...\n", symbolic_name);
        if (!found) {
            fprintf(stderr, "ERROR: No such test: '%s' in '%s'\n", symbolic_name, suite_name);
            return EXIT_FAILURE;
        }
        status = run_single_test(suite, test_name_of(symbolic_name), reporter);
    } else {
        if (verbose) {
            if (number_of_matches != count(test_items))
                printf(" to run %d matching tests ...\n", number_of_matches);
            else
                printf(" to run all %d discovered tests ...\n", count(test_items));
        }
        if (number_of_matches > 0)
            status = run_test_suite(suite, reporter);
        else {
            fprintf(stderr, "ERROR: No such test: '%s' in '%s'\n", symbolic_name, suite_name);
            status = EXIT_FAILURE;
        }
    }

    destroy_test_suite(suite);
    destroy_context_suites(context_suites);
    return(status);
}
Beispiel #7
0
static int run_test(const char *test,
                    const uint8_t *b1, const uint8_t *b2)
{
    int i, a, ret = 0;

    for (a = 0; a < 3; a++) {
        const uint8_t *block1 = b1;
        const uint8_t *block2 = b2;

        switch (a) {
        case 0: block1++; block2++; break;
        case 1:           block2++; break;
        case 2:                     break;
        }
        for (i = 1; i <= FF_ARRAY_ELEMS(sad_c); i++) {
            int r = run_single_test(test, b1, W1, b2, W2, a, i);
            if (r)
                ret = r;
        }
    }
    return ret;
}
Beispiel #8
0
int main(int argc, char **argv)
{
    PetscInitialize(&argc, &argv, NULL, help);
    TestSuite *suite = create_test_suite();
    add_test_with_context(suite, FFT, can_be_constructed_from_DMDA);
    add_test_with_context(suite, FFT, registers_the_right_DM);
    add_test_with_context(suite, FFT, creates_output_vector_of_correct_size);
    add_test_with_context(suite, FFT, transforms_constant_into_delta_function);
    add_test_with_context(suite, FFT, can_transform_second_component);
    add_test_with_context(suite, FFT, i_transform_is_inverse_of_transform);
    add_test_with_context(suite, FFT, PSD_of_delta_function_is_flat);
    add_test_with_context(suite, FFT, yields_PSD_of_the_correct_size);
    int result;
    if (argc > 2) {
        result = run_single_test(suite, argv[1], create_text_reporter());
    } else {
        result = run_test_suite(suite, create_text_reporter());
    }
    destroy_test_suite(suite);
    PetscFinalize();
    return result;
}
int main(int argc, char **argv)
{
  PetscInitialize(&argc, &argv, NULL, help);
  TestSuite *suite = create_test_suite();
  add_test_with_context(suite, FourthOrderJacobian, can_be_built);
  add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_constant_fields);
  add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_sine_waves);
  add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_gaussian);
  add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_constant_right_moving);
  add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_sine_wave_right_moving);
  add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_gaussian_right_moving);
  /* Disable this test for now, need the right Chi3 physics
  add_test(suite, prec_consistent_sine_wave_non_zero_gamma);
  */
  int result;
  if (argc > 2) {
    result = run_single_test(suite, argv[1], create_text_reporter());
  } else {
    result = run_test_suite(suite, create_text_reporter());
  }
  destroy_test_suite(suite);
  PetscFinalize();
  return result;
}
Beispiel #10
0
int main(void)
{
    int i, align, ret;
    uint8_t *buf1 = av_malloc(W1*H1);
    uint8_t *buf2 = av_malloc(W2*H2);
    uint32_t state = 0;

    if (!buf1 || !buf2) {
        fprintf(stderr, "malloc failure\n");
        ret = 1;
        goto end;
    }

    ff_check_pixfmt_descriptors();

#define RANDOM_INIT(buf, size) do {             \
    int k;                                      \
    for (k = 0; k < size; k++) {                \
        state = state * 1664525 + 1013904223;   \
        buf[k] = state>>24;                     \
    }                                           \
} while (0)

    /* Normal test with different strides */
    RANDOM_INIT(buf1, W1*H1);
    RANDOM_INIT(buf2, W2*H2);
    ret = run_test("random", buf1, buf2);
    if (ret < 0)
        goto end;

    /* Check for maximum SAD */
    memset(buf1, 0xff, W1*H1);
    memset(buf2, 0x00, W2*H2);
    ret = run_test("max", buf1, buf2);
    if (ret < 0)
        goto end;

    /* Check for minimum SAD */
    memset(buf1, 0x90, W1*H1);
    memset(buf2, 0x90, W2*H2);
    ret = run_test("min", buf1, buf2);
    if (ret < 0)
        goto end;

    /* Exact buffer sizes, to check for overreads */
    for (i = 1; i <= 4; i++) {
        for (align = 0; align < 3; align++) {
            int size1, size2;

            av_freep(&buf1);
            av_freep(&buf2);

            size1 = size2 = 1 << (i << 1);

            switch (align) {
            case 0: size1++; size2++; break;
            case 1:          size2++; break;
            case 2:                   break;
            }

            buf1 = av_malloc(size1);
            buf2 = av_malloc(size2);
            if (!buf1 || !buf2) {
                fprintf(stderr, "malloc failure\n");
                ret = 1;
                goto end;
            }
            RANDOM_INIT(buf1, size1);
            RANDOM_INIT(buf2, size2);
            ret = run_single_test("small", buf1, 1<<i, buf2, 1<<i, align, i);
            if (ret < 0)
                goto end;
        }
    }

end:
    av_free(buf1);
    av_free(buf2);
    return ret;
}