/*
 * Tests for bugs.dump_emp_resources_view
 */
BEGIN;
	/*
	 * We need a resource type, an empire and the associated resource record.
	 */
	\i utils/strings.sql
	\i utils/resources.sql
	\i utils/accounts.sql
	\i utils/naming.sql
	\i utils/universe.sql
	SELECT _create_resources( 1 , 'resource' );
	SELECT _create_emp_names( 1 , 'empire' );
	INSERT INTO emp.empires( name_id , cash )
		VALUES ( _get_emp_name( 'empire1' ) , 0 );
	INSERT INTO emp.resources(
			empire_id , resource_name_id , empres_possessed , empres_owed
		) VALUES (
			_get_emp_name( 'empire1' ) , _get_string( 'resource1' ) , 1 , 2
		);


	/***** TESTS BEGIN HERE *****/
	SELECT plan( 1 );

	SELECT diag_test_name( 'bugs.dump_emp_resources_view - Contents' );
	SELECT set_eq( $$
		SELECT empire_id , resource_name , empres_possessed , empres_owed
			FROM bugs.dump_emp_resources_view
	$$ , $$ VALUES (
		_get_emp_name( 'empire1' ) , 'resource1' , 1 , 2
	) $$ );

	SELECT * FROM finish( );
ROLLBACK;