ICU-1892 Use "cintltst -v /tsutil/cloctst/TestLocaleStructure" instead

X-SVN-Rev: 8590
This commit is contained in:
George Rhoten 2002-05-10 17:03:21 +00:00
parent b013de1679
commit 462d6a4061
3 changed files with 0 additions and 281 deletions

View File

@ -1,145 +0,0 @@
//**********************************************************************
//* Copyright (C) 2000, International Business Machines Corporation
//* and others. All Rights Reserved.
//**********************************************************************
// lcid.cpp - Test for establishing conformance of data in resource bundles to
// lcid <-> POSIX mapping
// Created by: Vladimir Weinstein
// Date: 08/09/2000
#include <stdio.h>
#include <stdlib.h>
#include "unicode/utypes.h"
#include "locmap.h"
#include "cstring.h"
#include "unicode/resbund.h"
static void
testLCID(const char *localeName);
static void
testLCID(const char *localeName,
const UnicodeString &posixName,
uint32_t *errors,
uint32_t *warnings)
{
UErrorCode status = U_ZERO_ERROR;
uint32_t lcid;
uint32_t expectedLCID;
char lcidStringC[1024];
char cLocaleName[256] = {'\0'};
u_UCharsToChars(posixName.getBuffer(),cLocaleName,posixName.length());
ResourceBundle posixLocale((char *)0, Locale(cLocaleName), status);
if(status != U_ZERO_ERROR) {
if(U_SUCCESS(status)) {
printf("ERROR: Locale %-5s not installed, and it should be!\n", localeName);
} else {
printf("%%%%%%% Unexpected error %d %%%%%%%", u_errorName(status));
}
(*errors)++;
return;
}
UnicodeString lcidString(posixLocale.getStringEx("LocaleID", status));
if (U_FAILURE(status)) {
printf("ERROR: %s does not have a LocaleID (%s)\n", localeName, u_errorName(status));
(*errors)++;
return;
}
lcidString.extract(0, lcidString.length(), lcidStringC, "");
lcidStringC[lcidString.length()] = '\0';
expectedLCID = uprv_strtoul(lcidStringC, NULL, 16);
lcid = T_convertToLCID(localeName, &status);
if (U_FAILURE(status)) {
if (expectedLCID == 0) {
printf("INFO: %-5s does not have any LCID mapping\n", localeName);
}
else {
printf("ERROR: %-5s does not have an LCID mapping to 0x%.4X\n", localeName, expectedLCID);
(*errors)++;
}
return;
}
status = U_ZERO_ERROR;
uprv_strcpy(lcidStringC, T_convertToPosix(expectedLCID, &status));
if (U_FAILURE(status)) {
printf("ERROR: %.4x does not have a POSIX mapping due to %s\n", expectedLCID, u_errorName(status));
(*errors)++;
}
if(lcid != expectedLCID) {
printf("ERROR: %-5s wrongfully has 0x%.4x instead of 0x%.4x for LCID\n", localeName, expectedLCID, lcid);
(*errors)++;
}
if(strcmp(localeName, lcidStringC) != 0) {
char langName[1024];
char langLCID[1024];
uloc_getLanguage(localeName, langName, sizeof(langName), &status);
uloc_getLanguage(lcidStringC, langLCID, sizeof(langLCID), &status);
if (expectedLCID == lcid && strcmp(langName, langLCID) == 0) {
printf("WARNING: %-5s resolves to %s (0x%.4x)\n", localeName, lcidStringC, lcid);
(*warnings)++;
}
else if (expectedLCID == lcid) {
printf("ERROR: %-5s has 0x%.4x and the number resolves wrongfully to %s\n", localeName, expectedLCID, lcidStringC);
(*errors)++;
}
else {
printf("ERROR: %-5s has 0x%.4x and the number resolves wrongfully to %s. It should be 0x%x.\n", localeName, expectedLCID, lcidStringC, lcid);
(*errors)++;
}
} else {
//printf("0x%x is from %s and it resolves correctly to %s(0x%x)\n", expectedLCID, localeName, lcidStringC, lcid);
//printf("%s: %x->%x\n", localeName, expectedLCID, lcid);
}
}
int main() {
UErrorCode status = U_ZERO_ERROR;
ResourceBundle index((char *)0, Locale("index"), status);
uint32_t errors = 0;
uint32_t warnings = 0;
if(U_SUCCESS(status)) {
ResourceBundle installedLocales = index.get("InstalledLocales", status);
if(U_SUCCESS(status)) {
installedLocales.resetIterator();
while(installedLocales.hasNext()) {
char localeName[1024];
UnicodeString posixName = installedLocales.getNextString(status);
posixName.extract(0, posixName.length(), localeName, "");
localeName[posixName.length()] = '\0';
testLCID(localeName, posixName, &errors, &warnings);
}
}
else {
puts("Error getting the InstalledLocales\n");
errors++;
}
}
else {
puts("Error getting the index\n");
errors++;
}
if(errors > 0) {
printf("There were %d error(s)\n", errors);
} else {
printf("There were no errors\n");
}
if(warnings > 0) {
printf("There were %d warning(s)\n", warnings);
}
// char temp;
// scanf("%c", &temp);
return 0;
}

View File

@ -1,107 +0,0 @@
# Microsoft Developer Studio Project File - Name="lcid" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=lcid - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "lcid.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "lcid.mak" CFG="lcid - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "lcid - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "lcid - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "lcid - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../../common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 icuuc.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../lib" /libpath:"../../common/Release"
!ELSEIF "$(CFG)" == "lcid - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 icuucd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../lib" /libpath:"../../common/debug"
# SUBTRACT LINK32 /incremental:no
!ENDIF
# Begin Target
# Name "lcid - Win32 Release"
# Name "lcid - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\lcid.cpp
# End Source File
# Begin Source File
SOURCE=..\..\common\locmap.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "lcid"=".\lcid.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################