Emmanuel BENOîT
bf6bea5a79
* The quantities of resources extracted from mines will now be updated as soon as they have a reason to. This includes planet assignment, abandonment, ownership changes, and updates to mining priorities. * The mining update will now remove the current resource income from the providers, and only then re-compute all extracted quantities. This is more logical and corresponds to the way the other game updates work. * Fixed bug in extraction computation where the size of the planet's happy population was used instead of the happy/total ratio when adjusting the mining production for riots. * The following SQL scripts must be re-executed to upgrade a database: -> 040-functions/040-empire.sql -> 040-functions/145-resource-providers.sql -> 040-functions/147-empire-mining.sql -> 050-updates/120-planet-mining.sql
37 lines
No EOL
1.5 KiB
PL/PgSQL
37 lines
No EOL
1.5 KiB
PL/PgSQL
/*
|
|
* Test the emp.mset_update_set() function
|
|
*/
|
|
BEGIN;
|
|
CREATE TEMPORARY TABLE mset_update(
|
|
empire_id INT ,
|
|
resource_name TEXT ,
|
|
empmset_weight INT
|
|
) ON COMMIT DROP;
|
|
INSERT INTO mset_update VALUES ( 1 , 'a' , 0 ) , ( 1 , 'b' , 0 );
|
|
|
|
/***** TESTS BEGIN HERE *****/
|
|
SELECT plan( 7 );
|
|
|
|
SELECT diag_test_name( 'emp.mset_update_set( ) - Valid update' );
|
|
SELECT ok( emp.mset_update_set( 'a' , 1 ) );
|
|
SELECT diag_test_name( 'emp.mset_update_set( ) - Valid update results (1/2)' );
|
|
SELECT is( empmset_weight , 1 ) FROM mset_update WHERE resource_name = 'a';
|
|
SELECT diag_test_name( 'emp.mset_update_set( ) - Valid update results (2/2)' );
|
|
SELECT is( empmset_weight , 0 ) FROM mset_update WHERE resource_name = 'b';
|
|
DELETE FROM mset_update;
|
|
|
|
INSERT INTO mset_update VALUES ( 1 , 'a' , 0 ) , ( 1 , 'b' , 0 );
|
|
SELECT diag_test_name( 'emp.mset_update_set( ) - Update on unknown resource' );
|
|
SELECT ok( NOT emp.mset_update_set( 'c' , 1 ) );
|
|
SELECT diag_test_name( 'emp.mset_update_set( ) - Unknown resource update results (1/2)' );
|
|
SELECT is( empmset_weight , 0 ) FROM mset_update WHERE resource_name = 'a';
|
|
SELECT diag_test_name( 'emp.mset_update_set( ) - Unknown resource update results (2/2)' );
|
|
SELECT is( empmset_weight , 0 ) FROM mset_update WHERE resource_name = 'b';
|
|
DELETE FROM mset_update;
|
|
|
|
INSERT INTO mset_update VALUES ( 1 , 'a' , 0 ) , ( 1 , 'b' , 0 );
|
|
SELECT diag_test_name( 'emp.mset_update_set( ) - Update with invalid weight' );
|
|
SELECT ok( emp.mset_update_set( 'a' , -1 ) );
|
|
|
|
SELECT * FROM finish( );
|
|
ROLLBACK; |