Ejemplo n.º 1
0
static int childprocess_unittest(void)
{
    x11display_t      x11disp   = x11display_FREE ;
    x11screen_t       x11screen = x11screen_FREE ;
    resourceusage_t   usage     = resourceusage_FREE ;

    // prepare
    TEST(0 == init_x11display(&x11disp, ":0")) ;
    x11screen = defaultscreen_x11display(&x11disp) ;

    if (test_iterator(&x11screen))      goto ONERR;
    if (test_initfree(&x11screen))      goto ONERR;
    if (test_setvideomode(&x11screen))  goto ONERR; // has memory leak

    TEST(0 == init_resourceusage(&usage)) ;

    if (test_iterator(&x11screen))      goto ONERR;
    if (test_initfree(&x11screen))      goto ONERR;

    TEST(0 == same_resourceusage(&usage)) ;
    TEST(0 == free_resourceusage(&usage)) ;

    // unprepare
    TEST(0 == free_x11display(&x11disp)) ;

    return 0 ;
ONERR:
    (void) free_resourceusage(&usage) ;
    (void) free_x11display(&x11disp) ;
    return EINVAL ;
}
Ejemplo n.º 2
0
int main()
{
    //test_hashmap();
    test_iterator();
    //test_thread();
    return 0;
}
Ejemplo n.º 3
0
int main()
{
    //test_vector();
    //test_list();
    test_iterator();
    return 0;
}
Ejemplo n.º 4
0
int TestMain() {
    if( MinThread<1 ) {
        REPORT("number of threads must be positive\n");
        exit(1);
    }
    for( int p=MinThread; p<=MaxThread; ++p ) {
       tbb::task_scheduler_init init(p);
       test_wait_count();
       test_run();
       test_iterator();
       test_parallel(p);
   }
   return Harness::Done;
}
Ejemplo n.º 5
0
int main(){
	MyAllocator allocator;
	allocator.constructor(1000);
	SplayTree<int,int> lol;
	lol.constructor(&allocator);
	srand(time(NULL));
	int n=10000000;
	int k=n;
	while(k--){
		lol.insert(k);
	}
	
	int i=0;
	SplayTreeIterator<int,int> iterator(&lol);
	while(iterator.hasNext()){
		SplayNode<int,int>*node=iterator.next();
		int v=node->getKey();
		i++;
	}

	lol.freeze();

	assert(i==n);
	assert(n==lol.size());
	SplayTreeIterator<int,int> iterator2(&lol);
	i=0;
	while(iterator2.hasNext()){
		SplayNode<int,int>*node=iterator2.next();
		int v=node->getKey();
		i++;
	}
	assert(i==n);
	assert(n==lol.size());

	test_remove();
	test_iterator();
	return 0;
}
Ejemplo n.º 6
0
void
TestStr_Run_IMP(TestString *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 139);
    test_new(runner);
    test_Cat(runner);
    test_Clone(runner);
    test_Code_Point_At_and_From(runner);
    test_Contains_and_Find(runner);
    test_SubString(runner);
    test_Trim(runner);
    test_To_F64(runner);
    test_To_I64(runner);
    test_To_String(runner);
    test_To_Utf8(runner);
    test_To_ByteBuf(runner);
    test_Length(runner);
    test_Compare_To(runner);
    test_Starts_Ends_With(runner);
    test_Get_Ptr8(runner);
    test_iterator(runner);
    test_iterator_whitespace(runner);
    test_iterator_substring(runner);
}
Ejemplo n.º 7
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;
}