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());
}
示例#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());
}
int main() {
    int err;
    TestSuite *suite = create_test_suite();

    add_test_with_context(suite, eclGetContextInteractively, runs);
    add_test_with_context(suite, eclGetContextInteractively,
                          returnsAContextIfNoErrorOccured);
    add_test_with_context(suite, eclGetContextInteractively,
                          returnsAValidContext);
    add_test_with_context(suite, eclGetContextInteractively,
                          returnsADeviceIfNoErrorOccured);
    add_test_with_context(suite, eclGetContextInteractively,
                          returnsAValidDevice);
    add_test_with_context(suite, eclGetContextInteractively,
                          returnsACommandQueueIfNoErrorOccured);
    add_test_with_context(suite, eclGetContextInteractively,
                          returnsAValidCommandQueue);
    add_test_with_context(suite, eclGetContextInteractively,
                          commandQueueConsistentWithContext);
    add_test_with_context(suite, eclGetContextInteractively,
                          commandQueueConsistentWithDevice);
    add_test_with_context(suite, eclGetContextInteractively,
                          doesntCrashDueToBogusPlatformChoice);
    add_test_with_context(suite, eclGetContextInteractively,
                          recoversFromBogusPlatformChoice);
    add_test_with_context(suite, eclGetContextInteractively,
                          doesntCrashDueToBogusDeviceChoice);
    add_test_with_context(suite, eclGetContextInteractively,
                          recoversFromBogusDeviceChoice);

    err = run_test_suite(suite, create_text_reporter());
    destroy_test_suite(suite);
    return err;
}
示例#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());
}
示例#6
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;
}
示例#8
0
int main(int argc, char **argv)
{
  PetscInitialize(&argc, &argv, NULL, help);
  TestSuite *suite = create_test_suite();
  add_test(suite, first_derivative_of_constant_is_zero);
  add_test(suite, first_derivative_fourth_order_of_constant_is_zero);
  add_test(suite, first_derivative_of_linear_function_is_computed_exactly);
  add_test(suite, first_derivative_fourth_order_of_linear_function_is_computed_exactly);
  add_test(suite, second_derivative_of_constant_is_zero);
  add_test(suite, second_derivative_fourth_order_of_constant_is_zero);
  add_test(suite, second_derivative_of_linear_function_is_zero);
  add_test(suite, second_derivative_fourth_order_of_linear_function_is_zero);
  int result = run_test_suite(suite, create_text_reporter());
  destroy_test_suite(suite);
  PetscFinalize();
  return result;
}
示例#9
0
/*======================================================================*/
int main(int argc, const char **argv) {
    int i;

    bool verbose = false;
    bool no_run = false;

    const char *prefix_option;
    const char *suite_name_option = NULL;
    const char *tmp;

    bool any_fail = false;

    atexit(cleanup);

	argc = initialize_option_handling(argc, argv);

    if (gopt_arg(options, 'x', &prefix_option))
        reporter = create_xml_reporter(prefix_option);
    else
        reporter = create_text_reporter();
    
    gopt_arg(options, 's', &suite_name_option);

    if (gopt_arg(options, 'v', &tmp))
        verbose = true;

    if (gopt_arg(options, 'n', &tmp))
        no_run = true;

    if (gopt_arg(options, 'c', &tmp))
        reporter_options.use_colours = true;
    else
        reporter_options.use_colours = false;

    if (gopt_arg(options, 'h', &tmp)) {
        usage(argv);
        return EXIT_SUCCESS;
    }

    if (argc < 2) {
        usage(argv);
        return EXIT_FAILURE;
    }


    set_reporter_options(reporter, &reporter_options);

    i = 1;
    while(i < argc) {
        const char *test_name = NULL;
        const char *test_library = argv[i++];

        bool fail;

        if (!file_exists(test_library)) {
            printf("Couldn't find library: %s\n", test_library);
            return EXIT_FAILURE;
        }

        /* Check if the next argument is not a filename, thus a test name, remember and move past it */
        if (!file_exists(argv[i])) {
            test_name = argv[i++];
        }

        fail = run_tests_in_library(suite_name_option, test_name, test_library, verbose, no_run);
        if (fail) any_fail = true;
    }
    
    return any_fail?EXIT_FAILURE:EXIT_SUCCESS;
}
示例#10
0
int main(int argc, char **argv) {
    return run_test_suite(our_tests(), create_text_reporter());
}
示例#11
0
int main(int argc, char **argv) {
    TestSuite *suite = create_test_suite();
    add_test_with_context(suite, CrashExample, seg_faults_for_null_dereference);
    add_test_with_context(suite, CrashExample, will_loop_forever);
    return run_test_suite(suite, create_text_reporter());
}
示例#12
0
int main(int argc, char **argv) {
    TestSuite *suite = create_config_suite();
    return run_test_suite(suite, create_text_reporter());
}
int main(int argc, const char **argv) {
    int status, i;

    bool verbose = false;
    bool no_run = false;

    const char *prefix_option;
    const char *suite_option = NULL;
    const char *tmp;

    atexit(cleanup);

    options = gopt_sort(&argc, argv, gopt_start(
                                                      gopt_option('x', 
                                                                  GOPT_ARG, 
                                                                  gopt_shorts('x'), 
                                                                  gopt_longs("xml")
                                                                  ),
                                                      gopt_option('s', 
                                                                  GOPT_ARG, 
                                                                  gopt_shorts('s'), 
                                                                  gopt_longs("suite")
                                                                  ),
                                                      gopt_option('v',
                                                                  GOPT_NOARG,
                                                                  gopt_shorts('v'),
                                                                  gopt_longs("verbose")
                                                                  ),
                                                      gopt_option('c',
                                                                  GOPT_NOARG,
                                                                  gopt_shorts('c'),
                                                                  gopt_longs("colours")
                                                                  ),
                                                      gopt_option('c',
                                                                  GOPT_NOARG,
                                                                  gopt_shorts('c'),
                                                                  gopt_longs("colors")
                                                                  ),
                                                      gopt_option('n',
                                                                  GOPT_NOARG,
                                                                  gopt_shorts('n'),
                                                                  gopt_longs("no-run")
                                                                  ),
                                                      gopt_option('h',
                                                                  GOPT_NOARG,
                                                                  gopt_shorts('h'),
                                                                  gopt_longs("help")
                                                                  )
                                                      )
                              );

    if (gopt_arg(options, 'x', &prefix_option))
        reporter = create_xml_reporter(prefix_option);
    else
        reporter = create_text_reporter();
    
    gopt_arg(options, 's', &suite_option);

    if (gopt_arg(options, 'v', &tmp))
        verbose = true;

    if (gopt_arg(options, 'n', &tmp))
        no_run = true;

    if (gopt_arg(options, 'c', &tmp))
        reporter_options.use_colours = true;
    else
        reporter_options.use_colours = false;

    if (gopt_arg(options, 'h', &tmp)) {
        usage(argv);
        return EXIT_SUCCESS;
    }

    if (argc < 2) {
        usage(argv);
        return EXIT_FAILURE;
    }


    set_reporter_options(reporter, &reporter_options);

    i = 1;
    while(i < argc) {
        const char *suite_name = suite_option;
        const char *test_name = NULL;
        const char *test_library = argv[i++];

        if (!file_exists(test_library)) {
            printf("Couldn't find library: %s\n", test_library);
            return EXIT_FAILURE;
        }

        suite_name = get_a_suite_name(suite_option, test_library);

        /* Check if the next argument is not a filename, thus a test name */
        if (!file_exists(argv[i])) {
            test_name = argv[i++];
        }

        status = runner(reporter, test_library, suite_name, test_name, verbose, no_run);
        if (status != 0) {
            printf("Library %s resulted in error status: %i\n", test_library, status);
            return status;
        }
    }
    
    return EXIT_SUCCESS;
}