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/045-empire-research/040-resprio-update-set.sql
Emmanuel BENOîT c9d8a077bd Moved empire research SQL to separate file
* Empire research & technology SQL code was getting dense, so it was
moved to a separate file.
2012-03-01 11:50:40 +01:00

37 lines
No EOL
1.1 KiB
PL/PgSQL

/*
* Unit tests for emp.resprio_update_set( )
*/
BEGIN;
/* Create a fake temporary table and insert some values */
CREATE TEMPORARY TABLE rprio_update(
_empire_id INT ,
_technology_name_id INT ,
_emptech_id TEXT ,
_emptech_priority INT
) ON COMMIT DROP;
INSERT INTO rprio_update
VALUES ( 1 , 1 , 'test' , 2 );
-- ***** TESTS BEGIN HERE *****
SELECT plan( 4 );
SELECT diag_test_name( 'emp.resprio_update_set() - Using a bad identifier - Return value' );
SELECT ok( NOT emp.resprio_update_set( 'bad identifier' , 3 ) );
SELECT diag_test_name( 'emp.resprio_update_set() - Using a bad identifier - Table contents' );
SELECT set_eq( $$
SELECT * FROM rprio_update
$$ , $$ VALUES(
1 , 1 , 'test' , 2
) $$ );
SELECT diag_test_name( 'emp.resprio_update_set() - Using a valid identifier - Return value' );
SELECT ok( emp.resprio_update_set( 'test' , 3 ) );
SELECT diag_test_name( 'emp.resprio_update_set() - Using a bad identifier - Table contents' );
SELECT set_eq( $$
SELECT * FROM rprio_update
$$ , $$ VALUES(
1 , 1 , 'test' , 3
) $$ );
SELECT * FROM finish( );
ROLLBACK;