void
init( so_5::environment_t & env )
{
	reg_coop( env );

	env.stop();
}
// The SObjectizer Environment initialization.
void init( so_5::environment_t & env )
{
	// Creating and registering a cooperation.
	env.register_agent_as_coop( "coop", env.make_agent< a_hello_t >() );

	// Stopping SObjectizer.
	env.stop();
}
		virtual void
		on_deregistered(
			so_5::environment_t & env,
			const std::string & coop_name,
			const so_5::coop_dereg_reason_t &) override
		{
			{
				std::lock_guard< std::mutex > lock{ m_lock };

				m_names.erase( coop_name );
			}

			if( "a_0_0" == coop_name )
				env.stop();
		}
void
init( so_5::environment_t & env )
{
	reg_coop( "test_coop_1", env );
	reg_coop( "test_coop_2", env );
	reg_coop( "test_coop_3", env );
	reg_coop( "test_coop_4", env );
	reg_coop( "test_coop_5", env );
	reg_coop( "test_coop_6", env );

	std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );

	env.deregister_coop( "test_coop_1", so_5::dereg_reason::normal );

	env.deregister_coop( "test_coop_6", so_5::dereg_reason::normal );

	env.deregister_coop( "test_coop_3", so_5::dereg_reason::normal );

	std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );

	env.stop();
}
void
init( so_5::environment_t & env )
{
	const std::string coop_name( "main_coop" );

	env.register_agent_as_coop( coop_name, new test_agent_t( env ) );

	bool exception_thrown = false;
	try
	{
		// Create a duplicate.
		env.register_agent_as_coop( coop_name, new test_agent_t( env ) );
	}
	catch( const so_5::exception_t & )
	{
		exception_thrown = true;
	}

	if( !exception_thrown )
		throw std::runtime_error( "duplicating coop should not be registered" );

	env.stop();
}
void
init( so_5::environment_t & env )
{
	CHECK_LAYER( env, 1 )
	CHECK_LAYER( env, 2 )
	CHECK_LAYER( env, 3 )
	CHECK_LAYER( env, 4 )
	CHECK_LAYER( env, 5 )
	CHECK_LAYER( env, 6 )
	CHECK_LAYER( env, 7 )
	CHECK_LAYER( env, 8 )
	CHECK_LAYER( env, 9 )
	CHECK_LAYER( env, 10 )
	CHECK_LAYER( env, 11 )
	CHECK_LAYER( env, 12 )
	CHECK_LAYER( env, 13 )
	CHECK_LAYER( env, 14 )
	CHECK_LAYER( env, 15 )
	CHECK_LAYER( env, 16 )
	CHECK_LAYER( env, 17 )
	CHECK_LAYER( env, 18 )
	CHECK_LAYER( env, 19 )
	CHECK_LAYER( env, 20 )
	CHECK_LAYER( env, 21 )
	CHECK_LAYER( env, 22 )
	CHECK_LAYER( env, 23 )
	CHECK_LAYER( env, 24 )
	CHECK_LAYER( env, 25 )
	CHECK_LAYER( env, 26 )
	CHECK_LAYER( env, 27 )
	CHECK_LAYER( env, 28 )
	CHECK_LAYER( env, 29 )
	CHECK_LAYER( env, 30 )
	CHECK_LAYER( env, 31 )
	CHECK_LAYER( env, 32 )
	CHECK_LAYER( env, 33 )
	CHECK_LAYER( env, 34 )
	CHECK_LAYER( env, 35 )
	CHECK_LAYER( env, 36 )
	CHECK_LAYER( env, 37 )
	CHECK_LAYER( env, 38 )
	CHECK_LAYER( env, 39 )
	CHECK_LAYER( env, 40 )
	CHECK_LAYER( env, 41 )
	CHECK_LAYER( env, 42 )
	CHECK_LAYER( env, 43 )
	CHECK_LAYER( env, 44 )
	CHECK_LAYER( env, 45 )
	CHECK_LAYER( env, 46 )
	CHECK_LAYER( env, 47 )
	CHECK_LAYER( env, 48 )
	CHECK_LAYER( env, 49 )
	CHECK_LAYER( env, 50 )
	CHECK_LAYER( env, 51 )
	CHECK_LAYER( env, 52 )
	CHECK_LAYER( env, 53 )
	CHECK_LAYER( env, 54 )
	CHECK_LAYER( env, 55 )
	CHECK_LAYER( env, 56 )
	CHECK_LAYER( env, 57 )
	CHECK_LAYER( env, 58 )
	CHECK_LAYER( env, 59 )
	CHECK_LAYER( env, 60 )
	CHECK_LAYER( env, 61 )
	CHECK_LAYER( env, 62 )
	CHECK_LAYER( env, 63 )

	CHECK_LAYER_EXISTS( env, 1 );
	CHECK_LAYER_EXISTS( env, 2 );
	CHECK_LAYER_EXISTS( env, 3 );
	CHECK_LAYER_EXISTS( env, 4 );
	CHECK_LAYER_EXISTS( env, 5 );
	CHECK_LAYER_EXISTS( env, 6 );
	CHECK_LAYER_EXISTS( env, 7 );
	CHECK_LAYER_EXISTS( env, 8 );
	CHECK_LAYER_EXISTS( env, 9 );
	CHECK_LAYER_EXISTS( env, 10 );
	CHECK_LAYER_EXISTS( env, 11 );
	CHECK_LAYER_EXISTS( env, 12 );
	CHECK_LAYER_EXISTS( env, 13 );
	CHECK_LAYER_EXISTS( env, 14 );
	CHECK_LAYER_EXISTS( env, 15 );
	CHECK_LAYER_EXISTS( env, 16 );
	CHECK_LAYER_EXISTS( env, 17 );
	CHECK_LAYER_EXISTS( env, 18 );
	CHECK_LAYER_EXISTS( env, 19 );
	CHECK_LAYER_EXISTS( env, 20 );
	CHECK_LAYER_EXISTS( env, 21 );
	CHECK_LAYER_EXISTS( env, 22 );
	CHECK_LAYER_EXISTS( env, 23 );
	CHECK_LAYER_EXISTS( env, 24 );
	CHECK_LAYER_EXISTS( env, 25 );
	CHECK_LAYER_EXISTS( env, 26 );
	CHECK_LAYER_EXISTS( env, 27 );
	CHECK_LAYER_EXISTS( env, 28 );
	CHECK_LAYER_EXISTS( env, 29 );
	CHECK_LAYER_EXISTS( env, 30 );
	CHECK_LAYER_EXISTS( env, 31 );
	CHECK_LAYER_EXISTS( env, 32 );
	CHECK_LAYER_EXISTS( env, 33 );
	CHECK_LAYER_EXISTS( env, 34 );
	CHECK_LAYER_EXISTS( env, 35 );
	CHECK_LAYER_EXISTS( env, 36 );
	CHECK_LAYER_EXISTS( env, 37 );
	CHECK_LAYER_EXISTS( env, 38 );
	CHECK_LAYER_EXISTS( env, 39 );
	CHECK_LAYER_EXISTS( env, 40 );
	CHECK_LAYER_EXISTS( env, 41 );
	CHECK_LAYER_EXISTS( env, 42 );
	CHECK_LAYER_EXISTS( env, 43 );
	CHECK_LAYER_EXISTS( env, 44 );
	CHECK_LAYER_EXISTS( env, 45 );
	CHECK_LAYER_EXISTS( env, 46 );
	CHECK_LAYER_EXISTS( env, 47 );
	CHECK_LAYER_EXISTS( env, 48 );
	CHECK_LAYER_EXISTS( env, 49 );
	CHECK_LAYER_EXISTS( env, 50 );
	CHECK_LAYER_EXISTS( env, 51 );
	CHECK_LAYER_EXISTS( env, 52 );
	CHECK_LAYER_EXISTS( env, 53 );
	CHECK_LAYER_EXISTS( env, 54 );
	CHECK_LAYER_EXISTS( env, 55 );
	CHECK_LAYER_EXISTS( env, 56 );
	CHECK_LAYER_EXISTS( env, 57 );
	CHECK_LAYER_EXISTS( env, 58 );
	CHECK_LAYER_EXISTS( env, 59 );
	CHECK_LAYER_EXISTS( env, 60 );
	CHECK_LAYER_EXISTS( env, 61 );
	CHECK_LAYER_EXISTS( env, 62 );
	CHECK_LAYER_EXISTS( env, 63 );

	env.stop();
}