int main()
{
    test_iter();
    test_iter_comp();

    return test_result();
}
Example #2
0
int main()
{
    int exit_status = EXIT_FAILURE;
    YAAF_Init(NULL);


    if (test_put_remove() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_put_remove() failed\n");
        goto exit;
    }

    if (test_put_remove_put_remove() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_put_remove_put_remove() failed\n");
        goto exit;
    }

    if (test_get() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_get() failed\n");
        goto exit;
    }

    if (test_iter() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_get() failed\n");
        goto exit;
    }

    exit_status = YAAF_SUCCESS;
exit:
    YAAF_Shutdown();
    return exit_status;
}
Example #3
0
void
test_iter(unsigned N)
{
    std::unique_ptr<int[]> a{new int[N]};
    std::iota(a.get(), a.get()+N, 0);
    std::shuffle(a.get(), a.get()+N, gen);
    test_iter(Iter(a.get()), Sent(a.get()+N));
}
Example #4
0
static void check_icu_iter4(void)
{
    UErrorCode status = U_ZERO_ERROR;
    struct icu_chain *chain = 0;
    xmlNode *xml_node;

    const char *xml_str = "<icu locale=\"en\">"
        "<transform rule=\"[:Control:] Any-Remove\"/>"
        "<tokenize rule=\"l\"/>"
        "<tokenize rule=\"w\"/>"
        "<transform rule=\"[[:WhiteSpace:][:Punctuation:]] Remove\"/>"
        "<display/>"
        "<casemap rule=\"l\"/>"
        "<join rule=\"\"/>"
        "</icu>";

    xmlDoc *doc = xmlParseMemory(xml_str, strlen(xml_str));
    YAZ_CHECK(doc);
    if (!doc)
        return;
    xml_node = xmlDocGetRootElement(doc);
    YAZ_CHECK(xml_node);
    if (!xml_node)
        return ;

    chain = icu_chain_xml_config(xml_node, 1, &status);

    xmlFreeDoc(doc);
    YAZ_CHECK(chain);
    if (!chain)
        return;

    YAZ_CHECK(test_iter(chain, "Adobe Acrobat Reader, 1991-1999.",
                        "[adobeacrobatreader19911999]"));

    YAZ_CHECK(test_iter(chain, "Νόταρης, Γιάννης Σωτ",
                        "[νόταρηςγιάννηςσωτ]"));

    // check_iter_threads(chain);

    icu_chain_destroy(chain);
}
Example #5
0
static void *iter_thread(void *p)
{
    struct icu_chain *chain = (struct icu_chain *) p;
    int i;

    for (i = 0; i < 1000; i++)
    {
        YAZ_CHECK(test_iter(chain, "Adobe Acrobat Reader, 1991-1999.",
                            "[adobe][acrobat][reader][1991][][1999][]"));
    }
    return 0;
}
Example #6
0
static void check_icu_iter3(void)
{
    UErrorCode status = U_ZERO_ERROR;
    struct icu_chain *chain = 0;
    xmlNode *xml_node;

    const char *xml_str =
        "<icu_chain id=\"sort\" locale=\"el\">\n"
        "<transform rule=\"[:Control:] Any-Remove\"/>\n"
        "<transform rule=\"[[:Control:][:WhiteSpace:][:Punctuation:]] Remove\"/>\n"
        "<transform rule=\"NFD; [:Nonspacing Mark:] Remove; NFC\"/>\n"
        "<casemap rule=\"l\"/>\n"
        "<display/>\n"
        "</icu_chain>\n";

    xmlDoc *doc = xmlParseMemory(xml_str, strlen(xml_str));
    YAZ_CHECK(doc);
    if (!doc)
        return;
    xml_node = xmlDocGetRootElement(doc);
    YAZ_CHECK(xml_node);
    if (!xml_node)
        return ;

    chain = icu_chain_xml_config(xml_node, 1, &status);

    xmlFreeDoc(doc);
    YAZ_CHECK(chain);
    if (!chain)
        return;

    YAZ_CHECK(test_iter(chain, "Adobe Acrobat Reader, 1991-1999.",
                        "[adobeacrobatreader19911999]"));

    YAZ_CHECK(test_iter(chain, "Νόταρης, Γιάννης Σωτ",
                        "[νοταρηςγιαννηςσωτ]"));

    icu_chain_destroy(chain);
}
Example #7
0
int main()
{
	cout << "KEY META TESTS" << endl;
	cout << "===============" << endl << endl;

	test_basic();
	test_iter();
	test_copy();
	test_string();
	test_copyAll();

	cout << endl;
	cout << "testcpp_meta RESULTS: " << nbTest << " test(s) done. " << nbError << " error(s)." << endl;
	return nbError;
}
/**
 * Signature of the 'main' function for a (single-peer) testcase that
 * is run using 'GNUNET_TESTING_peer_run'.
 *
 * @param cls closure
 * @param cfg configuration of the peer that was started
 * @param peer identity of the peer that was created
 */
static void
run (void *cls,
     const struct GNUNET_CONFIGURATION_Handle *cfg,
     struct GNUNET_TESTING_Peer *peer)
{
  config = cfg;
  GNUNET_TESTING_peer_get_identity (peer, &local_id);
  if (0) test_iter ();

  set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_INTERSECTION);
  set2 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_INTERSECTION);
  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &app_id);

  /* test the real set reconciliation */
  init_set1 ();
}
Example #9
0
int main()
{
	Test* test =new Test();
	test_creating_empty_list(test);
	test_creating_full_list(test);
	test_front(test);
	test_push_front(test);
	test_push_back(test);
	test_pop_front(test);
	test_pop_back(test);
	test_iter(test);
	test_reverse(test);
	test_swap(test);
	test_input(test);	
	test_cp(test);
	test_const_iter(test);
}
Example #10
0
int 
main (int argc, char** argv)
{
	int number_failed = 0;

	gtk_init (&argc, &argv);
	gdaui_init ();
	cnc = ui_tests_common_open_connection ();

	if (!test_iter (cnc))
		number_failed++;
	
	if (number_failed == 0)
                g_print ("Ok.\n");
        else
                g_print ("%d failed\n", number_failed);
        return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
/**
 * Signature of the 'main' function for a (single-peer) testcase that
 * is run using 'GNUNET_TESTING_peer_run'.
 *
 * @param cls closure
 * @param cfg configuration of the peer that was started
 * @param peer identity of the peer that was created
 */
static void
run (void *cls,
     const struct GNUNET_CONFIGURATION_Handle *cfg,
     struct GNUNET_TESTING_Peer *peer)
{
  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
                                &timeout_fail,
                                NULL);

  config = cfg;
  GNUNET_TESTING_peer_get_identity (peer,
                                    &local_id);

  test_iter ();

  set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
  set2 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &app_id);

  /* test the real set reconciliation */
  init_set1 ();
}
Example #12
0
int main(int argc, char ** argv) {
	FILE *tmp = tmpfile();
	assert(tmp != NULL);

	init_mtbl(dup(fileno(tmp)));

	struct mtbl_reader_options *reader_options = mtbl_reader_options_init();
	assert(reader_options != NULL);

	struct mtbl_reader *reader = mtbl_reader_init_fd(dup(fileno(tmp)), reader_options);
	assert(reader != NULL);

	const struct mtbl_source *source = mtbl_reader_source(reader);
	assert(source != NULL);

	struct mtbl_iter *iter = mtbl_source_iter(source);
	assert(iter != NULL);

	test_iter(iter);
	fprintf(stderr, NAME ": PASS: iter run successful\n");

	mtbl_iter_destroy(&iter);

	struct mtbl_merger_options *merger_options = mtbl_merger_options_init();
	assert(merger_options != NULL);

	mtbl_merger_options_set_merge_func(merger_options, my_merge_func, NULL);

	struct mtbl_merger *merger = mtbl_merger_init(merger_options);
	assert(merger != NULL);

	mtbl_merger_add_source(merger, source);

	const struct mtbl_source *merger_source = mtbl_merger_source(merger);
	assert(merger_source != NULL);

	struct mtbl_iter *merger_iter = mtbl_source_iter(merger_source);
	assert(merger_iter != NULL);

	test_iter(merger_iter);
	fprintf(stderr, NAME ": PASS: merger run 1 successful\n");

	mtbl_iter_destroy(&merger_iter);
	
	FILE *tmp2 = tmpfile();
	assert(tmp != NULL);

	init_mtbl(dup(fileno(tmp2)));

	struct mtbl_reader *reader2 = mtbl_reader_init_fd(dup(fileno(tmp2)), reader_options);
	assert(reader2 != NULL);

	mtbl_merger_add_source(merger, mtbl_reader_source(reader2));

	merger_iter = mtbl_source_iter(merger_source);
	assert(merger_iter != NULL);

	test_iter(merger_iter);
	fprintf(stderr, NAME ": PASS: merger run 2 successful\n");

	mtbl_iter_destroy(&merger_iter);

	mtbl_merger_destroy(&merger);
	mtbl_merger_options_destroy(&merger_options);
	mtbl_reader_destroy(&reader);
	mtbl_reader_destroy(&reader2);
	mtbl_reader_options_destroy(&reader_options);

	fclose(tmp);
	fclose(tmp2);
}