This repository has been archived on 2025-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
lwb6/legacyworlds-server-data/db-structure/tests/admin/040-functions/200-bugs/005-dump-emp-resources-view.sql
Emmanuel BENOîT 3637b6e1d1 Mining settings in XML dumps
* Empire mining settings have been included in the empire's resource
information records

* Planet-specific mining settings have been included in the resource
provider information records
2012-01-19 10:28:12 +01:00

56 lines
No EOL
1.7 KiB
PL/PgSQL

/*
* Tests for bugs.dump_emp_resources_view
*/
BEGIN;
/*
* We need a basic resource type, a natural resource type, an empire and
* the associated resources and mining settings records.
*/
\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_natural_resources( 1 , 'natRes' );
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
) , (
_get_emp_name( 'empire1' ) , _get_string( 'natRes1' ) , 3 , 4
);
INSERT INTO emp.mining_settings (
empire_id , resource_name_id , empmset_weight
) VALUES (
_get_emp_name( 'empire1' ) , _get_string( 'natRes1' ) , 0
);
/***** TESTS BEGIN HERE *****/
SELECT plan( 2 );
SELECT diag_test_name( 'bugs.dump_emp_resources_view - Basic resources' );
SELECT set_eq( $$
SELECT empire_id , resource_name , empres_possessed , empres_owed
FROM bugs.dump_emp_resources_view
WHERE mining_priority IS NULL
$$ , $$ VALUES (
_get_emp_name( 'empire1' ) , 'resource1' , 1 , 2
) $$ );
SELECT diag_test_name( 'bugs.dump_emp_resources_view - Natural resources' );
SELECT set_eq( $$
SELECT empire_id , resource_name , empres_possessed , empres_owed ,
mining_priority
FROM bugs.dump_emp_resources_view
WHERE mining_priority IS NOT NULL
$$ , $$ VALUES (
_get_emp_name( 'empire1' ) , 'natRes1' , 3 , 4 , 0
) $$ );
SELECT * FROM finish( );
ROLLBACK;