Beispiel #1
0
int main( 	int argc,
			char** argv)
{
	// Initialise the C-library random mechanism by seeding it with the current time
	// See http://www.cplusplus.com/reference/clibrary/cstdlib/srand/
	std::srand( std::time( NULL));

	// For more info on exception handling: http://www.cplusplus.com/doc/tutorial/exceptions/
	// and http://www.parashift.com/c++-faq/exceptions.html
	try
	{
		GameContext game1("1");
		boost::thread table1([&game1] {game1.play();});

		GameContext game2("2");
		boost::thread table2([&game2] {game2.play();});

		GameContext game3("3");
		boost::thread table3([&game3] {game3.play();});


		table1.join();
		table2.join();
		table3.join();
	}
	catch (std::exception& e)
	{
		std::cout << "Exception caught: " << e.what() << std::endl;
	}
	catch (...)
	{
		std::cout << "Unknown exception caught: " << std::endl;
	}
	return 0;
}
Beispiel #2
0
static void test_emptytable(skiatest::Reporter* reporter) {
    SkAutoTUnref<SkDataTable> table0(SkDataTable::NewEmpty());
    SkAutoTUnref<SkDataTable> table1(SkDataTable::NewCopyArrays(NULL, NULL, 0));
    SkAutoTUnref<SkDataTable> table2(SkDataTable::NewCopyArray(NULL, 0, 0));
    SkAutoTUnref<SkDataTable> table3(SkDataTable::NewArrayProc(NULL, 0, 0,
                                                               NULL, NULL));

    test_datatable_is_empty(reporter, table0);
    test_datatable_is_empty(reporter, table1);
    test_datatable_is_empty(reporter, table2);
    test_datatable_is_empty(reporter, table3);

    test_is_equal(reporter, table0, table1);
    test_is_equal(reporter, table0, table2);
    test_is_equal(reporter, table0, table3);
}