Пример #1
0
bool test_all()
{
	printf("Test Stack: %s\n",  test_stack()?"PASS":"******");
	printf("Test Queue: %s\n",  test_queue()?"PASS":"******");
	printf("Test List:  %s\n",  test_list()?"PASS":"******");
	printf("Test MinHeap: %s\n",test_minheap()?"PASS":"******");
	printf("Test MaxHeap: %s\n",test_maxheap()?"PASS":"******");
	printf("Test RedBlack: %s\n", /*test_redblack()*/false?"PASS":"******");
	printf("Test BST: %s\n", test_bst()?"PASS":"******");
	printf("Test HashTable: %s\n",test_hashtable()?"PASS":"******");
	printf("Test Tuple: %s\n",test_tuple()?"PASS":"******");
	if(DEBUG)functional_tests();
	return 1;
}
Пример #2
0
void main()
{
	pybind::initialize( false, false, true );

	bool gc_exist;
	PyObject * gc = pybind::module_import( "gc", gc_exist );

	pybind::call_method( gc, "disable", "()" );

	PyObject * module = pybind::module_init( "Test" );

	pybind::set_currentmodule( module );

	Helper * helper = new Helper;

	pybind::class_<Bar>( "Bar" )
		.def( "foo", &Bar::foo )
		.def( "min", &Bar::min )
		.def_property( "data", &Bar::getData, &Bar::setData )
		.def_proxy_static( "helper_for_script_function", helper, &Helper::helper_for_script_function )
		;

	pybind::class_<Vec2>( "Vec2" )
		.def_constructor( pybind::init<float, float>() )
		.def_member( "x", &Vec2::x )
		.def_member( "y", &Vec2::y )
		;

	Bar * b = new Bar;

	PyObject * py_b = pybind::ptr( b );

	PyObject * g = nullptr;

	bool exist;
	PyObject * m = pybind::module_import( "Test1", exist );

	test_function_decl();
	
	for( uint32_t i = 0; i != 100000; ++i )
	{
		test_dict( i );
		test_list( i );
		test_tuple( i );
		test_function( m, i );
	}

	printf( "done" );
}
Пример #3
0
int main()
{
    test_tuple();
    test_sized_cstring();
    return 0;
}