Exemplo n.º 1
0
int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_heap");

	test_heap();

	DONE(NULL);
}
Exemplo n.º 2
0
int main(void)
{
	test_heap();
	test_huffman();
	test_bitfile();

/* These are manual tests: */
/* 	test_huffman2(); */
/* 	test_bitfile2(); */
/* 	test_bitfile3(); */
	test_bitfile4();
	printf("Tests passed.\n");
	return 0;
}
Exemplo n.º 3
0
int main()
{
  dcTest_initPlatform();

  printf("Allocating ...\n");
  printf("... W^X memory: ");
  test_wx();
  printf("... heap memory: ");
  test_heap();
  printf("... stack memory: ");
  test_stack();

  dcTest_deInitPlatform();

  return 0;
}
Exemplo n.º 4
0
int main()
{
    auto empty = std::vector<int> {};
    auto singleton = std::vector<int> { 1 };
    auto doubleton = std::vector<int> { 1, 2 };
    auto random = std::vector<int> { 5, 1, 3, 4, 8, 7, 2, 9, 0, 6 };
    auto sorted = std::vector<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    auto reversed = std::vector<int> { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
    auto nearly_sorted = std::vector<int> { 0, 1, 3, 2, 4, 5, 7, 6, 8, 9 };
    auto few_unique = std::vector<int> { 0, 1, 2, 0, 1, 2, 0, 1, 2, 0 };

    auto inputs = std::vector<std::vector<int>> { empty, singleton, doubleton, random, sorted, reversed, nearly_sorted, few_unique };


    clock_t t;

    t = clock();
    test_selection(begin(inputs), end(inputs));
    t = clock() - t;
    double time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds
    printf("selection_sort took %f seconds to execute \n\n", time_taken);

    t = clock();
    test_insertion(begin(inputs), end(inputs));
    t = clock() - t;
     time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds
    printf("insertion_sort took %f seconds to execute \n\n", time_taken);

    t = clock();
    test_quick(begin(inputs), end(inputs));
    t = clock() - t;
     time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds
    printf("quick_sort took %f seconds to execute \n\n", time_taken);

    t = clock();
    test_merge(begin(inputs), end(inputs));
    t = clock() - t;
     time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds
    printf("merge_sort took %f seconds to execute \n\n", time_taken);

    t = clock();
    test_heap(begin(inputs), end(inputs));
    t = clock() - t;
    time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds
    printf("heap_sort took %f seconds to execute \n\n", time_taken);
}
Exemplo n.º 5
0
int main()
{
  dcTest_initPlatform();

  signal(SIGSEGV, segv_handler);

  printf("Allocating ...\n");
  printf("... W^X memory: ");
  test_wx();
  printf("... heap memory: ");
  test_heap();
  printf("... stack memory: ");
  test_stack();

  dcTest_deInitPlatform();

  return 0;
}
Exemplo n.º 6
0
int main()
#endif
{
	do
	{
		int y, x;

		for(y = 0; y < 16; ++y){
			printf("{");
			for(x = 0; x < 16; ++x){
				printf("%d, ", (2 * ( y / 8 ) + ( x / 8 )));
			}
			printf("}\n");
		}


		/* Print copyright information */
		printf("Doubango Project\nCopyright (C) 2009 Mamadou Diop \n\n");

#if RUN_TEST_LISTS || RUN_TEST_ALL
		/* linked lists */
		test_basic_list();
		printf("\n\n");
		test_complex_list();
		printf("\n\n");
		test_filtered_list();
		printf("\n\n");
#endif

#if RUN_TEST_HEAP || RUN_TEST_ALL
		/* heap */
		test_heap();
		printf("\n\n");
#endif

#if RUN_TEST_STRINGS || RUN_TEST_ALL
		/* strings */
		test_strings();
		printf("\n\n");
#endif

#if RUN_TEST_URL || RUN_TEST_ALL
		/* url */
		test_url();
		printf("\n\n");
#endif

#if RUN_TEST_THREADS || RUN_TEST_ALL
		/* threads */
		test_threads();
		printf("\n\n");
#endif

#if RUN_TEST_MUTEX || RUN_TEST_ALL
		/* mutex */
		test_mutex();
		printf("\n\n");
#endif

#if RUN_TEST_CONDWAIT || RUN_TEST_ALL
		/* condwait */
		test_condwait();
		printf("\n\n");
#endif

#if RUN_TEST_SEMAPHORE || RUN_TEST_ALL
		/* semaphore */
		test_semaphore();
		printf("\n\n");
#endif

#if RUN_TEST_SAFEOBJECT || RUN_TEST_ALL
	/* safe object */
		//test_safeobject();
		printf("\n\n");
#endif

#if RUN_TEST_OBJECT || RUN_TEST_ALL
	/* object */
		//test_object();
		printf("\n\n");
#endif

#if RUN_TEST_PARAMS || RUN_TEST_ALL
		/* parameters */
		test_params();
		printf("\n\n");
#endif

#if RUN_TEST_OPTIONS || RUN_TEST_ALL
		/* options */
		test_options();
		printf("\n\n");
#endif

#if RUN_TEST_TIMER || RUN_TEST_ALL
		/* timer */
		test_timer();
		printf("\n\n");
#endif
		
#if RUN_TEST_RUNNABLE || RUN_TEST_ALL
		/* test runnable. */
		test_runnable();
		printf("\n\n");
#endif


#if RUN_TEST_BUFFER || RUN_TEST_ALL
		/* test buffer */
		test_buffer();
#endif


#if RUN_TEST_MD5 || RUN_TEST_ALL
		/* test md5 and hmac_md5 */
		test_md5();
		test_hmac_md5();
#endif

#if RUN_TEST_SHA1 || RUN_TEST_ALL
		/* test sha1 and hmac_sha-1 */
		test_sha1();
		test_hmac_sha1();
#endif

#if RUN_TEST_BASE64 || RUN_TEST_ALL
		/* test base64 encoding/decoding */
		test_base64();
#endif

#if RUN_TEST_UUID || RUN_TEST_ALL
		/* test fake UUID (version5) */
		test_uuid();
#endif

#if RUN_TEST_FSM || RUN_TEST_ALL
		/* test FSM */
		test_fsm();
#endif

	}
	while(LOOP);

	getchar();

	return 0;
}
Exemplo n.º 7
0
int main(void)
{
   srand(time(NULL));
   test_heap();
}
Exemplo n.º 8
0
int main(int argc, char **argv)
{
  for (size_t i = 0; i < 128; i++) {
    test_class(PN_OBJECT, i);
    test_class(PN_VOID, i);
    test_class(&noop_class, i);
  }

  for (size_t i = 0; i < 128; i++) {
    test_new(i, PN_OBJECT);
    test_new(i, &noop_class);
  }

  test_finalize();
  test_free();
  test_hashcode();
  test_compare();

  for (int i = 0; i < 1024; i++) {
    test_refcounting(i);
  }

  for (size_t i = 0; i < 4; i++) {
    test_list(i);
  }

  for (size_t i = 0; i < 4; i++) {
    test_list_refcount(i);
  }

  test_list_index();

  test_map();
  test_map_links();

  test_hash();

  test_string(NULL);
  test_string("");
  test_string("this is a test");
  test_string("012345678910111213151617181920212223242526272829303132333435363"
              "738394041424344454647484950515253545556575859606162636465666768");
  test_string("this has an embedded \000 in it");
  test_stringn("this has an embedded \000 in it", 28);

  test_string_format();
  test_string_addf();

  test_build_list();
  test_build_map();
  test_build_map_odd();

  for (int i = 0; i < 64; i++)
  {
    test_map_iteration(i);
  }

  test_list_inspect();
  test_map_inspect();
  test_list_compare();
  test_iterator();
  for (int seed = 0; seed < 64; seed++) {
    for (int size = 1; size <= 64; size++) {
      test_heap(seed, size);
    }
  }

  return 0;
}
Exemplo n.º 9
0
int main()
{
	test_copy();
	test_heap();
    return 0;
}