@@ -1492,15 +1492,31 @@ static int test_single_encodes(void) {
14921492}
14931493
14941494
1495+ static int check_full_territory_name (const char * expectedName , const char * gotName , int expectedCode , int gotCode ) {
1496+ int nrTests = 0 ;
1497+ ++ nrTests ;
1498+ if (strcmp (expectedName , gotName )) {
1499+ found_error ();
1500+ printf ("*** ERROR *** getFullTerritoryName error, expected name '%s', but got '%s'\n" , expectedName , gotName );
1501+ }
1502+ ++ nrTests ;
1503+ if (expectedCode != gotCode ) {
1504+ found_error ();
1505+ printf ("*** ERROR *** getFullTerritoryName error, expected return code %d, but got %d\n" , expectedCode , gotCode );
1506+ }
1507+ return nrTests ;
1508+ }
1509+
1510+
14951511int territory_full_name_tests (void ) {
14961512 int nrTests = 0 ;
14971513 enum Territory territory ;
14981514 int minNames ;
14991515 int nrNames = 0 ;
15001516 int maxLength = 0 ;
1517+ char territoryName [2048 ];
15011518 for (territory = _TERRITORY_MIN + 1 ; territory < _TERRITORY_MAX ; ++ territory ) {
15021519 int alternative = 0 ;
1503- char territoryName [2048 ];
15041520 nrTests ++ ;
15051521 for (alternative = 0 ;; alternative ++ ) {
15061522 int len ;
@@ -1524,7 +1540,7 @@ int territory_full_name_tests(void) {
15241540 for (alternative = 0 ;; alternative ++ ) {
15251541 int len ;
15261542 ++ nrNames ;
1527- if (!getFullTerritoryNameLocal (territoryName , territory , alternative , _ALPHABET_MIN )) {
1543+ if (!getFullTerritoryNameLocal (territoryName , territory , alternative )) {
15281544 break ;
15291545 }
15301546 len = (int ) strlen (territoryName );
@@ -1551,6 +1567,10 @@ int territory_full_name_tests(void) {
15511567 found_error ();
15521568 printf ("*** ERROR *** Didn't find enough territory names, found %d, expected >= %d\n" , nrNames , minNames );
15531569 }
1570+
1571+ ++ nrTests ;
1572+ check_full_territory_name ("Nederland" , territoryName , getFullTerritoryNameLocal (territoryName , TERRITORY_NLD , 0 ), 0 );
1573+ // TODO Add many more tests here.
15541574 return nrTests ;
15551575}
15561576
0 commit comments