ICU-6211 Check in some of my test tools. Tools may need to be refined to work normally.

X-SVN-Rev: 23598
This commit is contained in:
George Rhoten 2008-03-15 01:02:11 +00:00
parent 692287bab4
commit 7b7dba6b53
6 changed files with 205 additions and 0 deletions

View File

@ -0,0 +1,70 @@
#*****************************************************************************
#
# Copyright (C) 2006-2008, International Business Machines
# Corporation and others. All Rights Reserved.
#
#*****************************************************************************
#
# FILE NAME : Makefile
#
# Date Name Description
# 03/02/2006 grhoten Creation.
#*****************************************************************************
## List of phony targets
.PHONY : all all-local install install-local clean clean-local \
distclean distclean-local install-library install-headers dist \
dist-local check check-local
## Clear suffix list
.SUFFIXES :
## List of standard targets
all: all-local
install: install-local
clean: clean-local
distclean : distclean-local
dist: dist-local
check: all check-local
ALL_TARGETS = displayLocaleConv testTimezone
#ICU_BASE = /home/build/Build_ICU_HP11iACC
#ICU_BASE = /home/build/Build_ICU_Solaris9CC
ICU_BASE = /home/build/Build_ICU_LinuxRHEL4.2
#ICU_BASE = /home/build/Build_ICU_MacOSX
#ICU_BASE = /home/build/Build_ICU_AIX5.2VA6
all-local: $(ALL_TARGETS)
displayLocaleConv: displayLocaleConv.c
#aCC +DD64 -I$(ICU_BASE)/icu/source/common/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
#CC -xtarget=ultra -xarch=v9 -I$(ICU_BASE)/icu/source/common/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
gcc -I $(ICU_BASE)/icu/source/common/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
#gcc -I $(ICU_BASE)/icu/source/common/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
#xlc -q64 -I $(ICU_BASE)/icu/source/common/ -L$(ICU_BASE)/icu/source/lib/ -licuuc35 -licudata35 -o $@ $<
testTimezone: testTimezone.c
#aCC +DD64 -I$(ICU_BASE)/icu/source/common/ -I$(ICU_BASE)/icu/source/i18n/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
#CC -xtarget=ultra -xarch=v9 -I$(ICU_BASE)/icu/source/common/ -I$(ICU_BASE)/icu/source/i18n/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
gcc -I $(ICU_BASE)/icu/source/common/ -I$(ICU_BASE)/icu/source/i18n/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
#gcc -I $(ICU_BASE)/icu/source/common/ -I$(ICU_BASE)/icu/source/i18n/ -L$(ICU_BASE)/icu/source/lib/ -licuuc -licudata -o $@ $<
#xlc -q64 -I $(ICU_BASE)/icu/source/common/ -I$(ICU_BASE)/icu/source/i18n/ -L$(ICU_BASE)/icu/source/lib/ -licuuc35 -licudata35 -o $@ $<
install-local: install-headers install-library
install-library: all-local
install-headers:
dist-local:
clean-local:
# test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
rm $(OBJECTS) $(ALL_TARGETS) $(SO_VERSION_DATA)
distclean-local: clean-local
check-local:

View File

@ -0,0 +1,35 @@
/*
******************************************************************************
*
* Copyright (C) 2006-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* FILE NAME : testTimezone.c
*
* Date Name Description
* 03/02/2006 grhoten Creation.
******************************************************************************
*/
#include "unicode/putil.h"
#include "unicode/ucnv.h"
#include "unicode/uloc.h"
#include "unicode/ures.h"
#include <stdio.h>
#include <string.h>
int main(int argc, const char* const argv[]) {
UErrorCode status = U_ZERO_ERROR;
ures_close(ures_open(NULL, NULL, &status));
if (status != U_ZERO_ERROR) {
printf("uloc_getDefault = %s\n", uloc_getDefault());
printf("Locale available in ICU = %s\n", status == U_ZERO_ERROR ? "TRUE" : "FALSE");
}
if (strcmp(ucnv_getDefaultName(), "US-ASCII") == 0) {
printf("uprv_getDefaultCodepage = %s\n", uprv_getDefaultCodepage());
printf("ucnv_getDefaultName = %s\n", ucnv_getDefaultName());
}
return 0;
}

View File

@ -0,0 +1,12 @@
#
# Copyright (C) 2006-2008, International Business Machines
# Corporation and others. All Rights Reserved.
#
These tests allow you to see how timezones, locales, charsets and other similar stuff are mapped from the OS values to ICU specific values.
Some tweaking may be required to get these tools to work.
If the charset maps to US-ASCII, it may be an indication that the alias or mapping table do not exist in ICU.
If the locale doesn't exist, the test will state that the locale is not available.
If the timezone doesn't match, it will be listed as a difference.

View File

@ -0,0 +1,8 @@
#!/bin/sh
#*****************************************************************************
#
# Copyright (C) 2006-2008, International Business Machines
# Corporation and others. All Rights Reserved.
#
#*****************************************************************************
for loc in `locale -a`; do echo ; echo LC_ALL=$loc ; LC_ALL=$loc ./displayLocaleConv ; done

View File

@ -0,0 +1,35 @@
/*
******************************************************************************
*
* Copyright (C) 2006-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* FILE NAME : testTimezone.c
*
* Date Name Description
* 03/02/2006 grhoten/mow Creation.
******************************************************************************
*/
#include "unicode/putil.h"
#include "unicode/udat.h"
#include <stdio.h>
#include <string.h>
#include <time.h>
int main(int argc, const char* const argv[]) {
UErrorCode status = U_ZERO_ERROR;
char sysTimeStr[256];
struct tm summerTimeTM;
struct tm winterTimeTM;
memset(sysTimeStr, 0, sizeof(sysTimeStr));
memset(&summerTimeTM, 0, sizeof(summerTimeTM));
memset(&winterTimeTM, 0, sizeof(winterTimeTM));
strptime("2006-06-01 12:00", "%Y-%m-%d %H:%M", &summerTimeTM);
strftime(sysTimeStr, sizeof(sysTimeStr)-1, "%Y-%m-%d %H:%M", &summerTimeTM);
puts(sysTimeStr);
}

View File

@ -0,0 +1,45 @@
#!/bin/sh
#*****************************************************************************
#
# Copyright (C) 2006-2008, International Business Machines
# Corporation and others. All Rights Reserved.
#
#*****************************************************************************
timezones=`locate zoneinfo | fgrep -v evolution-data-server`
for tzone in $timezones
do
if [ -f $tzone ]; then
tzname=${tzone#/usr/share/zoneinfo/}
ICUTime=`LD_LIBRARY_PATH=../dev-icu/icu/source/lib/ TZ=$tzname ./checkTimezone`
systemHour=`TZ=$tzname date +%I`
# OS X does not allow %-I so this ugly mess needs to occur
if [ "${systemHour:0:1}" == "0" ]; then
systemHour=${systemHour:1:1}
fi
systemTimeShort=`TZ=$tzname date +%b\ %d,\ %Y`
systemTimeShort="${systemTimeShort} ${systemHour}"
systemTimeAMPM=`TZ=$tzname date +%p`
index1=`expr "$systemTimeShort" : '.*'`
index2=`expr "$ICUTime" : '.*'`-2
ICUTimeShort=${ICUTime:0:${index1}}
ICUAMPM=${ICUTime:${index2}:2}
systemTime=`TZ=$tzname date +%b\ %d,\ %Y\ %r`
if [ "$systemTimeShort" == "$ICUTimeShort" ] && [ "$systemTimeAMPM" == "$ICUAMPM" ]; then
if [ "$opt1" != "-bad" ]; then
echo TZ=$tzname
echo System: $systemTime
echo ICU: $ICUTime
fi
else
if [ "$opt1" == "-all" ]; then
echo --TZ=$tzname
echo --System: $systemTime
echo --ICU: $ICUTime
else
echo TZ=$tzname
echo System: $systemTime
echo ICU: $ICUTime
fi
fi
fi
done