Database definition & tests organisation
* The main loader script has been updated to generate the list of files it needs to load automatically. As a consequence, files that contained manually-maintained lists of scripts have been removed, and definition directories have been renamed accordingly. * PostgreSQL extension loading and configuration has been moved to a separate script to be loaded automatically in the main transaction. * Data and function definition scripts that had the -data or -functions suffix have been renamed (the suffix is unnecessary). * Unit tests have been reorganised to follow the definition's structure. * Documentation has been improved
This commit is contained in:
parent
b054a379a9
commit
e50775ec76
112 changed files with 78 additions and 144 deletions
legacyworlds-server-data/db-structure/tests/admin/040-functions/053-generator-basics
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Test the verse.list_random_planets_in() function
|
||||
*/
|
||||
BEGIN;
|
||||
|
||||
/* We need two systems with one planet each. Systems will be located at
|
||||
* (0,0) and (1,1).
|
||||
*/
|
||||
\i utils/strings.sql
|
||||
\i utils/accounts.sql
|
||||
\i utils/naming.sql
|
||||
\i utils/universe.sql
|
||||
SELECT _create_raw_planets( 10 , 'test' );
|
||||
|
||||
/***** TESTS BEGIN HERE *****/
|
||||
SELECT plan( 5 );
|
||||
|
||||
SELECT diag_test_name( 'verse.list_random_planets_in() - Empty set if count = 0' );
|
||||
SELECT is_empty( $$
|
||||
SELECT * FROM verse.list_random_planets_in( ROW( 0 , 0 , 1 , 1 ) , 0 )
|
||||
$$ );
|
||||
|
||||
SELECT diag_test_name( 'verse.list_random_planets_in() - Empty set if outside of existing universe' );
|
||||
SELECT is_empty( $$
|
||||
SELECT * FROM verse.list_random_planets_in( ROW( 2 , 2 , 3 , 3 ) , 2 )
|
||||
$$ );
|
||||
|
||||
SELECT diag_test_name( 'verse.list_random_planets_in() - Requested count > actual count' );
|
||||
SELECT is( COUNT(*) , 5::BIGINT )
|
||||
FROM verse.list_random_planets_in( ROW( 1 , 1 , 2 , 2 ) , 7 );
|
||||
|
||||
SELECT diag_test_name( 'verse.list_random_planets_in() - Requested count = actual count' );
|
||||
SELECT is( COUNT(*) , 5::BIGINT )
|
||||
FROM verse.list_random_planets_in( ROW( 1 , 1 , 2 , 2 ) , 5 );
|
||||
|
||||
SELECT diag_test_name( 'verse.list_random_planets_in() - Requested count < actual count' );
|
||||
SELECT is( COUNT(*) , 4::BIGINT )
|
||||
FROM verse.list_random_planets_in( ROW( 1 , 1 , 2 , 2 ) , 4 );
|
||||
|
||||
SELECT * FROM finish( );
|
||||
ROLLBACK;
|
Reference in a new issue