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/025-resources/060-ordered-resources-view.sql
Emmanuel BENOîT 597429fadf In-game resources views
* Added session records to carry resource information over to the
clients

* Added SQL support code for the various views

* Added interface and implementation of the resource information access
component

* Hooked resources information queries into both the empire and planet
management component

* Added resources display to planet and overview pages
2012-02-04 10:43:12 +01:00

57 lines
No EOL
1.5 KiB
PL/PgSQL

/*
* Tests for defs.ordered_resources_view
*/
BEGIN;
/*
* We need:
* - one resource without category with weight 1,
* - one resource with category 1 and weight 2,
* - one resource with weight 4 and no category,
* - two resourcew with weights 3 and 7 and category 2.
*/
\i utils/strings.sql
SELECT _create_test_strings( 5 , 'resource' );
SELECT _create_test_strings( 5 , 'resDesc' );
SELECT _create_test_strings( 2 , 'resCat' );
INSERT INTO defs.resources(
resource_name_id , resource_description_id ,
resource_category_id , resource_weight
) VALUES (
_get_string( 'resource1' ) , _get_string( 'resDesc1' ) ,
NULL , 1
) , (
_get_string( 'resource2' ) , _get_string( 'resDesc2' ) ,
_get_string( 'resCat1' ) , 2
) , (
_get_string( 'resource3' ) , _get_string( 'resDesc3' ) ,
NULL , 4
) , (
_get_string( 'resource4' ) , _get_string( 'resDesc4' ) ,
_get_string( 'resCat2' ) , 3
) , (
_get_string( 'resource5' ) , _get_string( 'resDesc5' ) ,
_get_string( 'resCat2' ) , 7
);
SELECT plan( 1 );
SELECT diag_test_name( 'defs.ordered_resources_view - Resources are in the correct order' );
SELECT set_eq(
$$ SELECT resource_name_id , resource_ordering
FROM defs.ordered_resources_view $$ ,
$$ VALUES (
_get_string( 'resource1' ) , 1
) , (
_get_string( 'resource2' ) , 2
) , (
_get_string( 'resource3' ) , 3
) , (
_get_string( 'resource4' ) , 4
) , (
_get_string( 'resource5' ) , 5
) $$
);
SELECT * FROM finish( );
ROLLBACK;