Beispiel #1
0
int main() {
    add_test(test_run_zero_tests_has_zero_failures);
    add_test(test_expect_unexpected_fails);
    add_test(test_two_failed_tests);

    return run_tests();
}
TestSuite *unit_tests() {
	TestSuite *suite = create_test_suite();
	add_test(suite, count_tests_return_zero_for_empty_suite);
	add_test(suite, count_tests_return_one_for_suite_with_one_testcase);
	add_test(suite, count_tests_return_four_for_four_nested_suite_with_one_testcase_each);
    add_test(suite, time_out_in_only_one_second);
	return suite;
}
TestSuite *words_tests() {
    TestSuite *suite = create_test_suite();
    add_test(suite, word_count_is_returned_from_split);
    add_test(suite, spaces_are_converted_to_zeroes);
    add_test(suite, single_word_sentence_invokes_callback_once);
    add_test(suite, phrase_invokes_callback_for_each_word);
    return suite;
}
TestSuite *stream_tests() {
    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);
    return suite;
}
Beispiel #5
0
TestSuite *
common_kstring_test()
{
    TestSuite *suite = create_test_suite();
    add_test(suite, string_len_version);
    add_test(suite, string_no_len_version);
    add_test(suite, string_misc);
    return suite;
}
extern int main(int argc, char *argv[])
{
    NOT_USED(argc);
    NOT_USED(argv);

    CU_pSuite suite = NULL;
    TEST all_tests = NULL;
    TEST test;

    add_test(&all_tests,
             "tests file with short header is rejected",
             test_short_header_rejected);
    add_test(&all_tests,
             "tests file with invalid header is rejected",
             test_invalid_header_rejected);

    if (CU_initialize_registry() != CUE_SUCCESS)
    {
        return CU_get_error();
    }

    suite = CU_add_suite("chp2ppmlib_suite", init_suite, clean_suite);
    if (suite == NULL)
    {
        CU_cleanup_registry();
        return CU_get_error();
    }

    test = all_tests;

    while(test != NULL)
    {
        if (CU_add_test(suite, test->description, 
                        test->test_function) == NULL)
        {
            CU_cleanup_registry();
            return CU_get_error();
        }

        test = test->next;
    }

    test = all_tests;

    while(test != NULL)
    {
        mem_free(test);
        test = test->next;
    }

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

    CU_cleanup_registry();
    
    return CU_get_error();
}
Beispiel #7
0
TestSuite *ubf_mem_tests(void)
{
    TestSuite *suite = create_test_suite();

    add_test(suite, test_Balloc_Bfree);
    add_test(suite, test_Brealloc);

    return suite;
}
Beispiel #8
0
TestSuite *ubf_get_tests(void)
{
    TestSuite *suite = create_test_suite();

    add_test(suite, test_cbgetalloc);
    add_test(suite, test_bgetalloc);
    add_test(suite, test_bgetlast);

    return suite;
}
Beispiel #9
0
TestSuite *ubf_readwrite_tests(void)
{
    TestSuite *suite = create_test_suite();

    add_test(suite, test_readwrite);
    add_test(suite, test_readwrite_err_space);
    add_test(suite, test_readwrite_invalid_descr);

    return suite;
}
Beispiel #10
0
int		init()
{
	add_test("add_bulk", test_add);
	add_test("remove_first", test_remfirst);
	add_test("remove_first", test_remfirst);
	add_test("clear", test_clear);

	ft_dlist_init(&g_list);

	return (0);
}
Beispiel #11
0
void Explanation_Based_Chunker::attach_relational_test(test pRelational_test, condition* pCond, WME_Field pField)
{
    if (pField == VALUE_ELEMENT)
    {
        add_test(thisAgent, &(pCond->data.tests.value_test), pRelational_test, true);
    } else if (pField == ATTR_ELEMENT)
    {
        add_test(thisAgent, &(pCond->data.tests.attr_test), pRelational_test, true);
    } else
    {
        add_test(thisAgent, &(pCond->data.tests.id_test), pRelational_test, true);
    }
    thisAgent->explanationMemory->increment_stat_constraints_attached();
}
Ensure count_tests_return_four_for_four_nested_suite_with_one_testcase_each() {
	TestSuite *suite1 = create_test_suite();
	TestSuite *suite2 = create_test_suite();
	TestSuite *suite3 = create_test_suite();
	TestSuite *suite4 = create_test_suite();
	add_test(suite1, count_tests_return_one_for_suite_with_one_testcase);
	add_suite(suite1, suite2);
	add_test(suite2, count_tests_return_one_for_suite_with_one_testcase);
	add_suite(suite2, suite3);
	add_test(suite3, count_tests_return_one_for_suite_with_one_testcase);
	add_suite(suite3, suite4);
	add_test(suite4, count_tests_return_one_for_suite_with_one_testcase);
	assert_equal(count_tests(suite1), 4);
}
ObjectTransactiontestUnit::ObjectTransactiontestUnit()
  : unit_test("transaction", "transaction unit test")
{
  add_test("insert", std::bind(&ObjectTransactiontestUnit::test_insert, this), "test transaction insert");
  add_test("insert_rollback", std::bind(&ObjectTransactiontestUnit::test_insert_rollback, this), "test transaction insert rollback");
  add_test("update", std::bind(&ObjectTransactiontestUnit::test_update, this), "test transaction update");
  add_test("update_rollback", std::bind(&ObjectTransactiontestUnit::test_update_rollback, this), "test transaction update rollback");
  add_test("delete", std::bind(&ObjectTransactiontestUnit::test_delete, this), "test transaction delete");
  add_test("delete_rollback", std::bind(&ObjectTransactiontestUnit::test_delete_rollback, this), "test transaction delete rollback");
  add_test("nested", std::bind(&ObjectTransactiontestUnit::test_nested, this), "test nested transaction");
  add_test("nested_rollback", std::bind(&ObjectTransactiontestUnit::test_nested_rollback, this), "test nested transaction rollback");
  add_test("foreign", std::bind(&ObjectTransactiontestUnit::test_foreign, this), "test transaction foreign object");
  add_test("foreign_rollback", std::bind(&ObjectTransactiontestUnit::test_foreign_rollback, this), "test transaction foreign object rollback");
}
Beispiel #14
0
int main(int argc, char **argv) {
  FILE *pipe = popen("tee arithmetic.log | /usr/bin/ruby", "w");
  if (pipe == NULL) {
    handle_error(-1, "popen");
  }
  int pfd = fileno(pipe);
  handle_error(pfd, "fileno");
  int retcode = close(STDOUT_FILENO);
  handle_error(retcode, "close(STDOUT_FILENO)");
  retcode = dup(pfd);
  handle_error(retcode, "dup");
  fprintf(stderr, "doing add_test\n");
  add_test();
  fprintf(stderr, "doing sub_test\n");
  sub_test();
  fprintf(stderr, "doing sprintf_test\n");
  sprintf_test();
  fprintf(stderr, "doing mul_test\n");
  mul_test();
  fprintf(stderr, "doing divx_test\n");
  divx_test();
  fprintf(stderr, "done with C-operations\n");
  printf("puts 'DONE'\n");
  fflush(stdout);
  retcode = close(STDOUT_FILENO);
  handle_error(retcode, "close");
  retcode = pclose(pipe);
  handle_error(retcode, "pclose");
  exit(0);
}
Beispiel #15
0
TestSuite *create_log_debug_suite(void)
{
    TestSuite *suite = create_named_test_suite("debug() suite");

    add_test(suite, debug_no_output_low_verbose);
    add_test(suite, debug_default_output_stderr);
    add_test(suite, debug_stub_no_debug);
    add_test(suite, debug_output);
    add_test(suite, debug_sets_default_keeps_filename);

    add_debug_syslog(suite);

    set_setup(suite, log_init_globals);

    return suite;
}
static void create()
{
	test::create("objectd");
#ifdef __HAVE_OBJECTD__
	add_test("testObjectd");
#endif /* __HAVE_OBJECTD__ */
}
Beispiel #17
0
void process_test_file(char *file_name, test_t **test_list, index_t *test_length, parsed_options_t *input_options){
  buffer_from_file_t *file_content = read_file(file_name);
  *test_length = file_content->line_count;
  *test_list = (test_t *)malloc(sizeof(test_t)*file_content->line_count);
  int idx=0;
  size_t start = 0;
  const size_t max_length = 1024;
  char test_buffer[max_length];
  test_t *local_tests = (test_t *)*test_list;

  for(idx = 0; idx < file_content->line_count; idx++){
    do{
      extract_line(&start, test_buffer, max_length, file_content->buffer, file_content->size);
      if(start == file_content->size && test_buffer[0] == '\0'){
        goto free_test_buffers;
      }
    }while(test_buffer[0] == '\0');

    string_lower_case(test_buffer, max_length);
    add_test(&(local_tests[idx]), test_buffer, input_options);
  }
free_test_buffers:
  *test_length = idx;
  free(file_content->buffer);
  free(file_content);
}
TestSuite *breadcrumb_tests() {
    TestSuite *suite = create_test_suite();
    add_test(suite, can_destroy_empty_breadcrumb);
    add_test(suite, last_name_pushed_is_current);
    add_test(suite, can_push_more_than_one_item);
    add_test(suite, popping_item_takes_us_back_to_the_previous_item);
    add_test(suite, empty_breadcrumb_has_null_as_current);
    add_test(suite, popping_last_name_leaves_breadcrumb_empty);
    add_test(suite, empty_breadcrumb_does_not_trigger_walker);
    add_test(suite, single_item_breadcrumb_does_calls_walker_only_once);
    add_test(suite, double_item_breadcrumb_does_calls_walker_only_once);
    return suite;
}
Beispiel #19
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 #20
0
static Suite *
memdb_suite(void)
{
	Suite *s = suite_create ("memdb");

	add_test(s, test_dirtest1, "dirtest1");

	add_test(s, test_filetest1, "filetest1");
 
	add_test(s, test_indextest1, "indextest1");
 
	add_test(s, test_loaddb1, "loaddb1");
 
	add_test(s, test_loaddb2, "loaddb2");
 
	return s;
}
Beispiel #21
0
TestSuite *ubf_fupdate_tests(void)
{
    TestSuite *suite = create_test_suite();

    add_test(suite, test_fupdate);

    return suite;
}
Beispiel #22
0
/*
 * repeating add_tests many times
 * may show a problem in timing
 */
static test_return_t many_adds(memcached_st *memc)
{
  for (size_t x= 0; x < TEST_COUNTER; x++)
  {
    add_test(memc);
  }
  return 0;
}
Beispiel #23
0
TestSuite *ubf_mkfldhdr_tests(void)
{
    TestSuite *suite = create_test_suite();

    add_test(suite, test_mkfldhdr);

    return suite;
}
Beispiel #24
0
void Explanation_Based_Chunker::attach_relational_test(test pRelational_test, condition* pCond, WME_Field pField)
{
    dprint(DT_CONSTRAINTS, "Attaching transitive constraint %t %g to field %d of %l.\n", pRelational_test, pRelational_test, static_cast<int64_t>(pField), pCond);
    if (pField == VALUE_ELEMENT)
    {
        add_test(thisAgent, &(pCond->data.tests.value_test), pRelational_test, true);
    } else if (pField == ATTR_ELEMENT)
    {
        add_test(thisAgent, &(pCond->data.tests.attr_test), pRelational_test, true);
    } else
    {
        add_test(thisAgent, &(pCond->data.tests.id_test), pRelational_test, true);
    }
    #ifdef EBC_DETAILED_STATISTICS
        thisAgent->explanationMemory->increment_stat_constraints_attached();
    #endif
}
static int ufs_test_debugfs_init(void)
{
	struct dentry *utils_root, *tests_root;
	int ret = 0;

	utils_root = test_iosched_get_debugfs_utils_root();
	tests_root = test_iosched_get_debugfs_tests_root();

	utd->test_list = kmalloc(sizeof(struct dentry *) * NUM_TESTS,
			GFP_KERNEL);
	if (!utd->test_list) {
		pr_err("%s: failed to allocate tests dentrys", __func__);
		return -ENODEV;
	}

	if (!utils_root || !tests_root) {
		pr_err("%s: Failed to create debugfs root.", __func__);
		ret = -EINVAL;
		goto exit_err;
	}

	utd->random_test_seed_dentry = debugfs_create_u32("random_test_seed",
			S_IRUGO | S_IWUGO, utils_root, &utd->random_test_seed);

	if (!utd->random_test_seed_dentry) {
		pr_err("%s: Could not create debugfs random_test_seed.",
				__func__);
		ret = -ENOMEM;
		goto exit_err;
	}

	ret = add_test(utd, write_read_test, WRITE_READ_TEST);
	if (ret)
		goto exit_err;
	ret = add_test(utd, long_sequential_read, LONG_SEQUENTIAL_READ);
	if (ret)
		goto exit_err;
	ret = add_test(utd, long_sequential_write, LONG_SEQUENTIAL_WRITE);
	if (ret)
		goto exit_err;
	ret = add_test(utd, long_sequential_mixed, LONG_SEQUENTIAL_MIXED);
	if (ret)
		goto exit_err;
	add_test(utd, multi_query, MULTI_QUERY);
	if (ret)
		goto exit_err;
	add_test(utd, parallel_read_and_write, PARALLEL_READ_AND_WRITE);
	if (ret)
		goto exit_err;
	add_test(utd, lun_depth, LUN_DEPTH);
	if (ret)
		goto exit_err;

	goto exit;

exit_err:
	ufs_test_debugfs_cleanup();
exit:
	return ret;
}
Beispiel #26
0
/* TEST session key correctness by pushing and pulling secrets */
struct torture_suite *torture_rpc_lsa_secrets(TALLOC_CTX *mem_ctx)
{
	struct torture_suite *suite = torture_suite_create(mem_ctx, "lsa.secrets");
	int keyexchange, ntlm2, lm_key;

	for (keyexchange = 0; keyexchange < ARRAY_SIZE(bool_vals); keyexchange++) {
		for (ntlm2 = 0; ntlm2 < ARRAY_SIZE(bool_vals); ntlm2++) {
			for (lm_key = 0; lm_key < ARRAY_SIZE(bool_vals); lm_key++) {
				add_test(suite, DCERPC_PUSH_BIGENDIAN, bool_vals[keyexchange], bool_vals[ntlm2], 
					 bool_vals[lm_key]);
				add_test(suite, DCERPC_SEAL, bool_vals[keyexchange], bool_vals[ntlm2], bool_vals[lm_key]);
				add_test(suite, 0, bool_vals[keyexchange], bool_vals[ntlm2], bool_vals[lm_key]);
			}
		}
	}

	return suite;
}
Beispiel #27
0
/**
 * Unit test suite
 * @return
 */
TestSuite *atmi_basic_srvtests(void)
{
    TestSuite *suite = create_test_suite();

    add_test(suite, test_server_basic);


    return suite;
}
Beispiel #28
0
int test_main(int argc, char ** argv) 
{
	CHECK_WITH_CLEAN(add_test());
	CHECK_WITH_CLEAN(fail_add_test());
//	CHECK_WITH_CLEAN(nonreadlocated_add_test());
// TODO implement follow test 
	CHECK_WITH_CLEAN(stock_reply_test());
	return 0;
}
Beispiel #29
0
int main(void) {
	reduce_test();
	printf("Reduce passed\n");
	add_test();
	printf("Add passed\n");
	multiply_test();
	printf("Multiply passed\n");
	printf("\n");
	return 0;
}
Beispiel #30
0
static int address_mapping_test_init(void)
{
	START_TESTS("Address Mapping test");

	INIT_CALL_END(init(), add_test(), end(), "add function");
	INIT_CALL_END(init(), daniel_test(), end(), "Daniel's xlat tests");
	INIT_CALL_END(init(), anderson_test(), end(), "Tore's xlat tests");
	INIT_CALL_END(init(), remove_test(), end(), "remove function");

	END_TESTS;
}