ICU-541 test synchronization between LCIDs and posix locale names - Win32 only
X-SVN-Rev: 2170
This commit is contained in:
parent
718c069cc4
commit
18d1052fd6
70
icu4c/source/test/lcid/lcid.cpp
Normal file
70
icu4c/source/test/lcid/lcid.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
//**********************************************************************
|
||||
//* 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 "unicode/utypes.h"
|
||||
#include "locmap.h"
|
||||
#include "cstring.h"
|
||||
#include "unicode/resbund.h"
|
||||
|
||||
int main() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
ResourceBundle index((char *)0, Locale("index"), status);
|
||||
uint32_t errors = 0;
|
||||
|
||||
if(U_SUCCESS(status)) {
|
||||
ResourceBundle installedLocales = index.get("InstalledLocales", status);
|
||||
if(U_SUCCESS(status)) {
|
||||
installedLocales.resetIterator();
|
||||
while(installedLocales.hasNext()) {
|
||||
char localeName[1024];
|
||||
uint32_t lcid;
|
||||
UnicodeString posixName = installedLocales.getNextString(status);
|
||||
posixName.extract(0, posixName.length(), localeName, "");
|
||||
localeName[posixName.length()] = '\0';
|
||||
ResourceBundle posixLocale((char *)0, Locale(posixName), status);
|
||||
if(status == U_ZERO_ERROR) {
|
||||
UnicodeString lcidString = posixLocale.getStringEx("LocaleID", status);
|
||||
char lcidStringC[1024];
|
||||
lcidString.extract(0, lcidString.length(), lcidStringC, "");
|
||||
lcidStringC[lcidString.length()] = '\0';
|
||||
uint32_t expectedLCID = uprv_strtoul(lcidStringC, NULL, 16);
|
||||
lcid = IGlobalLocales::convertToLCID(localeName);
|
||||
uprv_strcpy(lcidStringC, IGlobalLocales::convertToPosix(expectedLCID));
|
||||
if(strcmp(localeName, lcidStringC) == 0) {
|
||||
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);
|
||||
} else {
|
||||
printf("ERROR: 0x%x is from %s and it resolves wrongfully to %s, it shoud have (0x%x)\n", expectedLCID, localeName, lcidStringC, lcid);
|
||||
//printf("Name mismatch: %s vs. %s: %x->%x\n", localeName, lcidStringC, expectedLCID, lcid);
|
||||
errors++;
|
||||
}
|
||||
if(lcid != expectedLCID) {
|
||||
printf("ERROR: Locale %s wrongfully has 0x%x instead of 0x%x for LCID\n", localeName, expectedLCID, lcid);
|
||||
//printf("LCID mismatch: %s: %x->%x\n", localeName, expectedLCID, lcid);
|
||||
errors++;
|
||||
}
|
||||
} else if(U_SUCCESS(status)) {
|
||||
printf("ERROR: Locale %s not installed, and it should be!\n", localeName);
|
||||
errors++;
|
||||
} else {
|
||||
printf("%%%%%%% Unexpected error %d %%%%%%%", status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errors > 0) {
|
||||
printf("There were %d error(s)\n", errors);
|
||||
} else {
|
||||
printf("There were no errors\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
106
icu4c/source/test/lcid/lcid.dsp
Normal file
106
icu4c/source/test/lcid/lcid.dsp
Normal file
@ -0,0 +1,106 @@
|
||||
# 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 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 /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 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
|
||||
|
||||
!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 icuuc.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../lib/debug" /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.cpp
|
||||
# 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
|
29
icu4c/source/test/lcid/lcid.dsw
Normal file
29
icu4c/source/test/lcid/lcid.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user