[sword-cvs] icu-sword/source/test/intltest astrotst.cpp,NONE,1.1 astrotst.h,NONE,1.1 calcasts.cpp,NONE,1.1 calcasts.h,NONE,1.1 convtest.cpp,NONE,1.1 convtest.h,NONE,1.1 v32test.cpp,NONE,1.1 v32test.h,NONE,1.1 Makefile.in,1.4,1.5 apicoll.cpp,1.3,1.4 callimts.cpp,1.3,1.4 calregts.cpp,1.3,1.4 caltest.cpp,1.3,1.4 caltest.h,1.3,1.4 caltztst.cpp,1.3,1.4 caltztst.h,1.3,1.4 canittst.cpp,1.1,1.2 canittst.h,1.1,1.2 citrtest.cpp,1.4,1.5 cntabcol.cpp,1.3,1.4 cpdtrtst.cpp,1.4,1.5 cpdtrtst.h,1.3,1.4 datamap.cpp,1.1,1.2 datamap.h,1.1,1.2 dcfmapts.cpp,1.3,1.4 dtfmapts.cpp,1.3,1.4 dtfmrgts.h,1.3,1.4 dtfmtrtts.cpp,1.3,1.4 dtfmtrtts.h,1.3,1.4 dtfmttst.cpp,1.3,1.4 dtfmttst.h,1.3,1.4 encoll.cpp,1.3,1.4 g7coll.cpp,1.3,1.4 g7coll.h,1.3,1.4 icusvtst.cpp,1.1,1.2 icusvtst.h,1.1,1.2 idnaref.cpp,1.1,1.2 incaltst.cpp,1.1,1.2 incaltst.h,1.1,1.2 intltest.cpp,1.5,1.6 intltest.dsp,1.4,1.5 intltest.h,1.3,1.4 intltest.vcproj,1.1,1.2 itercoll.cpp,1.4,1.5 itformat.cpp,1.4,1.5 itmajor.cpp,1.3,1.4 itrbnf.cpp,1.5,1.6 itrbnfrt.cpp,1.3,1.4 ittrans.cpp,1.4,1.5 itutil.cpp,1.3,1.4 loctest.cpp,1.4,1.5 loctest.h,1.3,1.4 miscdtfm.cpp,1.5,1.6 msfmrgts.cpp,1.3,1.4 nmfmapts.cpp,1.3,1.4 nmfmtrt.cpp,1.4,1.5 nmfmtrt.h,1.3,1.4 nptrans.cpp,1.1,1.2 nptrans.h,1.1,1.2 numfmtst.cpp,1.5,1.6 numfmtst.h,1.4,1.5 numrgts.cpp,1.3,1.4 numrgts.h,1.3,1.4 pptest.cpp,1.3,1.4 punyref.h,1.1,1.2 rbbiapts.cpp,1.3,1.4 rbbiapts.h,1.3,1.4 rbbitst.cpp,1.4,1.5 rbbitst.h,1.3,1.4 regextst.cpp,1.1,1.2 regextst.h,1.1,1.2 restest.cpp,1.4,1.5 restest.h,1.3,1.4 restsnew.cpp,1.4,1.5 restsnew.h,1.3,1.4 sdtfmtts.cpp,1.3,1.4 sfwdchit.cpp,1.3,1.4 sfwdchit.h,1.3,1.4 srchtest.cpp,1.4,1.5 strcase.cpp,1.1,1.2 strtest.cpp,1.3,1.4 strtest.h,1.3,1.4 svccoll.cpp,1.1,1.2 tchcfmt.cpp,1.3,1.4 testdata.cpp,1.1,1.2 testidn.cpp,1.1,1.2 testidna.cpp,1.1,1.2 testidna.h,1.1,1.2 tfsmalls.cpp,1.3,1.4 thcoll.cpp,1.3,1.4 thcoll.h,1.3,1.4 tmsgfmt.cpp,1.3,1.4 transapi.cpp,1.4,1.5 transapi.h,1.3,1.4 transrt.cpp,1.4,1.5 transtst.cpp,1.5,1.6 transtst.h,1.5,1.6 tscoll.cpp,1.4,1.5 tscoll.h,1.3,1.4 tsdate.cpp,1.4,1.5 tsdate.h,1.3,1.4

sword@www.crosswire.org sword@www.crosswire.org
Tue, 6 Apr 2004 03:11:37 -0700


Update of /cvs/core/icu-sword/source/test/intltest
In directory www:/tmp/cvs-serv8911/source/test/intltest

Modified Files:
	Makefile.in apicoll.cpp callimts.cpp calregts.cpp caltest.cpp 
	caltest.h caltztst.cpp caltztst.h canittst.cpp canittst.h 
	citrtest.cpp cntabcol.cpp cpdtrtst.cpp cpdtrtst.h datamap.cpp 
	datamap.h dcfmapts.cpp dtfmapts.cpp dtfmrgts.h dtfmtrtts.cpp 
	dtfmtrtts.h dtfmttst.cpp dtfmttst.h encoll.cpp g7coll.cpp 
	g7coll.h icusvtst.cpp icusvtst.h idnaref.cpp incaltst.cpp 
	incaltst.h intltest.cpp intltest.dsp intltest.h 
	intltest.vcproj itercoll.cpp itformat.cpp itmajor.cpp 
	itrbnf.cpp itrbnfrt.cpp ittrans.cpp itutil.cpp loctest.cpp 
	loctest.h miscdtfm.cpp msfmrgts.cpp nmfmapts.cpp nmfmtrt.cpp 
	nmfmtrt.h nptrans.cpp nptrans.h numfmtst.cpp numfmtst.h 
	numrgts.cpp numrgts.h pptest.cpp punyref.h rbbiapts.cpp 
	rbbiapts.h rbbitst.cpp rbbitst.h regextst.cpp regextst.h 
	restest.cpp restest.h restsnew.cpp restsnew.h sdtfmtts.cpp 
	sfwdchit.cpp sfwdchit.h srchtest.cpp strcase.cpp strtest.cpp 
	strtest.h svccoll.cpp tchcfmt.cpp testdata.cpp testidn.cpp 
	testidna.cpp testidna.h tfsmalls.cpp thcoll.cpp thcoll.h 
	tmsgfmt.cpp transapi.cpp transapi.h transrt.cpp transtst.cpp 
	transtst.h tscoll.cpp tscoll.h tsdate.cpp tsdate.h 
	tsdtfmsy.cpp tsmthred.cpp tsnmfmt.cpp tsnmfmt.h tzbdtest.cpp 
	tzregts.cpp tztest.cpp tztest.h ucaconf.cpp ucaconf.h 
	ufltlgts.cpp uobjtest.cpp uobjtest.h usettest.cpp usettest.h 
	ustrtest.cpp ustrtest.h 
Added Files:
	astrotst.cpp astrotst.h calcasts.cpp calcasts.h convtest.cpp 
	convtest.h v32test.cpp v32test.h 
Removed Files:
	tsmutex.cpp tsmutex.h 
Log Message:
ICU 2.8 sync

--- NEW FILE: astrotst.cpp ---
/********************************************************************
 * COPYRIGHT: 
 * Copyright (c) 1996-2003, International Business Machines Corporation and
 * others. All Rights Reserved.
 ********************************************************************/

/* Test CalendarAstronomer for C++ */

#include "unicode/utypes.h"
#include "string.h"
#include "unicode/locid.h"

#if !UCONFIG_NO_FORMATTING

#include "astro.h"
#include "astrotst.h"
#include "gregoimp.h" // for Math
#include "unicode/simpletz.h"


static const double DAY_MS = 24.*60.*60.*1000.;

#define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break

AstroTest::AstroTest(): astro(NULL), gc(NULL) {
}

void AstroTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
    if (exec) logln("TestSuite AstroTest");
    switch (index) {
      // CASE(0,FooTest);
      CASE(0,TestSolarLongitude);
      CASE(1,TestLunarPosition);
      CASE(2,TestCoordinates);
      CASE(3,TestCoverage);
      CASE(4,TestSunriseTimes);
      CASE(5,TestBasics);
    default: name = ""; break;
    }
}

#undef CASE

#define ASSERT_OK(x)   if(U_FAILURE(x)) { errln("%s:%d: %s\n", __FILE__, __LINE__, u_errorName(x)); return; }


void AstroTest::initAstro(UErrorCode &status) {
  if(U_FAILURE(status)) return;

  if((astro != NULL) || (gc != NULL)) {
    errln("Err: initAstro() called twice!");
    closeAstro(status);
    if(U_SUCCESS(status)) {
      status = U_INTERNAL_PROGRAM_ERROR;
    }
  }

  if(U_FAILURE(status)) return;

  astro = new CalendarAstronomer();
  gc = Calendar::createInstance(TimeZone::getGMT()->clone(), status);
}

void AstroTest::closeAstro(UErrorCode &/*status*/) {
  if(astro != NULL) {
    delete astro;
    astro = NULL;
  }
  if(gc != NULL) {
    delete gc;
    gc = NULL;
  }
}

void AstroTest::TestSolarLongitude(void) {
  UErrorCode status = U_ZERO_ERROR;
  initAstro(status);
  ASSERT_OK(status);

  struct {
    int32_t d[5]; double f ;
  } tests[] = {
    { { 1980, 7, 27, 0, 00 },  124.114347 },
    { { 1988, 7, 27, 00, 00 },  124.187732 }
  };
  
  logln("");
  for (uint32_t i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
    gc->clear();
    gc->set(tests[i].d[0], tests[i].d[1]-1, tests[i].d[2], tests[i].d[3], tests[i].d[4]);
    
    astro->setDate(gc->getTime(status));
    
    double longitude = astro->getSunLongitude();
    //longitude = 0;
    CalendarAstronomer::Equatorial result;
    astro->getSunPosition(result);
    logln((UnicodeString)"Sun position is " + result.toString() + (UnicodeString)";  " /* + result.toHmsString()*/ + " Sun longitude is " + longitude );
  }
  closeAstro(status);
  ASSERT_OK(status);
}



void AstroTest::TestLunarPosition(void) {
  UErrorCode status = U_ZERO_ERROR;
  initAstro(status);
  ASSERT_OK(status);

  static const double tests[][7] = {
    { 1979, 2, 26, 16, 00,  0, 0 }
  };
  logln("");
  
  for (int32_t i = 0; i < (int32_t)(sizeof(tests)/sizeof(tests[0])); i++) {
    gc->clear();
    gc->set((int32_t)tests[i][0], (int32_t)tests[i][1]-1, (int32_t)tests[i][2], (int32_t)tests[i][3], (int32_t)tests[i][4]);
    astro->setDate(gc->getTime(status));
    
    const CalendarAstronomer::Equatorial& result = astro->getMoonPosition();
    logln((UnicodeString)"Moon position is " + result.toString() + (UnicodeString)";  " /* + result->toHmsString()*/);
  }
  
  closeAstro(status);
  ASSERT_OK(status);
}



void AstroTest::TestCoordinates(void) {
  UErrorCode status = U_ZERO_ERROR;
  initAstro(status);
  ASSERT_OK(status);
    
  CalendarAstronomer::Equatorial result;
  astro->eclipticToEquatorial(result, 139.686111 * CalendarAstronomer::PI / 180.0, 4.875278* CalendarAstronomer::PI / 180.0);
  logln((UnicodeString)"result is " + result.toString() + (UnicodeString)";  " /* + result.toHmsString()*/ );
  closeAstro(status);
  ASSERT_OK(status);
}



void AstroTest::TestCoverage(void) {
  UErrorCode status = U_ZERO_ERROR;
  initAstro(status);
  ASSERT_OK(status);
  GregorianCalendar *cal = new GregorianCalendar(1958, UCAL_AUGUST, 15,status);
  UDate then = cal->getTime(status);
  CalendarAstronomer *myastro = new CalendarAstronomer(then);
  ASSERT_OK(status);

  //Latitude:  34 degrees 05' North  
  //Longitude:  118 degrees 22' West  
  double laLat = 34 + 5./60, laLong = 360 - (118 + 22./60);
  CalendarAstronomer *myastro2 = new CalendarAstronomer(laLong, laLat);

  double eclLat = laLat * CalendarAstronomer::PI / 360;
  double eclLong = laLong * CalendarAstronomer::PI / 360;

  CalendarAstronomer::Ecliptic ecl(eclLat, eclLong);
  CalendarAstronomer::Equatorial eq;
  CalendarAstronomer::Horizon hor;

  logln("ecliptic: " + ecl.toString());
  CalendarAstronomer *myastro3 = new CalendarAstronomer();
  myastro3->setJulianDay((4713 + 2000) * 365.25);

  CalendarAstronomer *astronomers[] = {
    myastro, myastro2, myastro3, myastro2 // check cache
  };
  
  for (uint32_t i = 0; i < sizeof(astronomers)/sizeof(astronomers[0]); ++i) {
    CalendarAstronomer *anAstro = astronomers[i];

    //logln("astro: " + astro);
    logln((UnicodeString)"   date: " + anAstro->getTime());
    logln((UnicodeString)"   cent: " + anAstro->getJulianCentury());
    logln((UnicodeString)"   gw sidereal: " + anAstro->getGreenwichSidereal());
    logln((UnicodeString)"   loc sidereal: " + anAstro->getLocalSidereal());
    logln((UnicodeString)"   equ ecl: " + (anAstro->eclipticToEquatorial(eq,ecl)).toString());
    logln((UnicodeString)"   equ long: " + (anAstro->eclipticToEquatorial(eq, eclLong)).toString());
    logln((UnicodeString)"   horiz: " + (anAstro->eclipticToHorizon(hor, eclLong)).toString());
    logln((UnicodeString)"   sunrise: " + (anAstro->getSunRiseSet(TRUE)));
    logln((UnicodeString)"   sunset: " + (anAstro->getSunRiseSet(FALSE)));
    logln((UnicodeString)"   moon phase: " + anAstro->getMoonPhase());
    logln((UnicodeString)"   moonrise: " + (anAstro->getMoonRiseSet(TRUE)));
    logln((UnicodeString)"   moonset: " + (anAstro->getMoonRiseSet(FALSE)));
    logln((UnicodeString)"   prev summer solstice: " + (anAstro->getSunTime(CalendarAstronomer::SUMMER_SOLSTICE(), FALSE)));
    logln((UnicodeString)"   next summer solstice: " + (anAstro->getSunTime(CalendarAstronomer::SUMMER_SOLSTICE(), TRUE)));
    logln((UnicodeString)"   prev full moon: " + (anAstro->getMoonTime(CalendarAstronomer::FULL_MOON(), FALSE)));
    logln((UnicodeString)"   next full moon: " + (anAstro->getMoonTime(CalendarAstronomer::FULL_MOON(), TRUE)));
  }

  delete myastro2;
  delete myastro3;
  delete myastro;
  delete cal;

  closeAstro(status);
  ASSERT_OK(status);
}



void AstroTest::TestSunriseTimes(void) {
  UErrorCode status = U_ZERO_ERROR;
  initAstro(status);
  ASSERT_OK(status);

  //  logln("Sunrise/Sunset times for San Jose, California, USA");
  //  CalendarAstronomer *astro2 = new CalendarAstronomer(-121.55, 37.20);
  //  TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles");
  
  // We'll use a table generated by the UNSO website as our reference
  // From: http://aa.usno.navy.mil/
  //-Location: W079 25, N43 40
  //-Rise and Set for the Sun for 2001
  //-Zone:  4h West of Greenwich
  int32_t USNO[] = {
    6,59, 19,45,
    6,57, 19,46,
    6,56, 19,47,
    6,54, 19,48,
    6,52, 19,49,
    6,50, 19,51,
    6,48, 19,52,
    6,47, 19,53,
    6,45, 19,54,
    6,43, 19,55,
    6,42, 19,57,
    6,40, 19,58,
    6,38, 19,59,
    6,36, 20, 0,
    6,35, 20, 1,
    6,33, 20, 3,
    6,31, 20, 4,
    6,30, 20, 5,
    6,28, 20, 6,
    6,27, 20, 7,
    6,25, 20, 8,
    6,23, 20,10,
    6,22, 20,11,
    6,20, 20,12,
    6,19, 20,13,
    6,17, 20,14,
    6,16, 20,16,
    6,14, 20,17,
    6,13, 20,18,
    6,11, 20,19,
  };
  
  logln("Sunrise/Sunset times for Toronto, Canada");
  // long = 79 25", lat = 43 40"
  CalendarAstronomer *astro3 = new CalendarAstronomer(-(79+25/60), 43+40/60);
  
  // As of ICU4J 2.8 the ICU4J time zones implement pass-through
  // to the underlying JDK.  Because of variation in the
  // underlying JDKs, we have to use a fixed-offset
  // SimpleTimeZone to get consistent behavior between JDKs.
  // The offset we want is [-18000000, 3600000] (raw, dst).
  // [aliu 10/15/03]
  
  // TimeZone tz = TimeZone.getTimeZone("America/Montreal");
  TimeZone *tz = new SimpleTimeZone(-18000000 + 3600000, "Montreal(FIXED)");
  
  GregorianCalendar *cal = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
  GregorianCalendar *cal2 = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
  cal->clear();
  cal->set(UCAL_YEAR, 2001);
  cal->set(UCAL_MONTH, UCAL_APRIL);
  cal->set(UCAL_DAY_OF_MONTH, 1);
  cal->set(UCAL_HOUR_OF_DAY, 12); // must be near local noon for getSunRiseSet to work
  
  DateFormat *df_t  = DateFormat::createTimeInstance(DateFormat::MEDIUM,Locale::getUS());
  DateFormat *df_d  = DateFormat::createDateInstance(DateFormat::MEDIUM,Locale::getUS());
  DateFormat *df_dt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS());
  df_t->adoptTimeZone(tz->clone());
  df_d->adoptTimeZone(tz->clone());
  df_dt->adoptTimeZone(tz->clone());
  
  for (int32_t i=0; i < 30; i++) {
    logln("setDate\n");
    astro3->setDate(cal->getTime(status));
    logln("getRiseSet(TRUE)\n");
    UDate sunrise = astro3->getSunRiseSet(TRUE);
    logln("getRiseSet(FALSE)\n");
    UDate sunset  = astro3->getSunRiseSet(FALSE);
    logln("end of getRiseSet\n");

    cal2->setTime(cal->getTime(status), status);
    cal2->set(UCAL_SECOND,      0);
    cal2->set(UCAL_MILLISECOND, 0);
    
    cal2->set(UCAL_HOUR_OF_DAY, USNO[4*i+0]);
    cal2->set(UCAL_MINUTE,      USNO[4*i+1]);
    UDate exprise = cal2->getTime(status);
    cal2->set(UCAL_HOUR_OF_DAY, USNO[4*i+2]);
    cal2->set(UCAL_MINUTE,      USNO[4*i+3]);
    UDate expset = cal2->getTime(status);
    // Compute delta of what we got to the USNO data, in seconds
    int32_t deltarise = (int32_t)uprv_fabs((sunrise - exprise) / 1000);
    int32_t deltaset = (int32_t)uprv_fabs((sunset - expset) / 1000);
    
    // Allow a deviation of 0..MAX_DEV seconds
    // It would be nice to get down to 60 seconds, but at this
    // point that appears to be impossible without a redo of the
    // algorithm using something more advanced than Duffett-Smith.
    int32_t MAX_DEV = 180;
    UnicodeString s1, s2, s3, s4, s5;
    if (deltarise > MAX_DEV || deltaset > MAX_DEV) {
      if (deltarise > MAX_DEV) {
        errln("FAIL: (rise) " + df_d->format(cal->getTime(status),s1) +
              ", Sunrise: " + df_dt->format(sunrise, s2) +
              " (USNO " + df_t->format(exprise,s3) +
              " d=" + deltarise + "s)");
      } else {
        logln(df_d->format(cal->getTime(status),s1) +
              ", Sunrise: " + df_dt->format(sunrise,s2) +
              " (USNO " + df_t->format(exprise,s3) + ")");
      }
      s1.remove(); s2.remove(); s3.remove(); s4.remove(); s5.remove();
      if (deltaset > MAX_DEV) {
        errln("FAIL: (set)  " + df_d->format(cal->getTime(status),s1) +
              ", Sunset:  " + df_dt->format(sunset,s2) +
              " (USNO " + df_t->format(expset,s3) +
              " d=" + deltaset + "s)");
      } else {
        logln(df_d->format(cal->getTime(status),s1) +
              ", Sunset: " + df_dt->format(sunset,s2) +
              " (USNO " + df_t->format(expset,s3) + ")");
      }
    } else {
      logln(df_d->format(cal->getTime(status),s1) +
            ", Sunrise: " + df_dt->format(sunrise,s2) +
            " (USNO " + df_t->format(exprise,s3) + ")" +
            ", Sunset: " + df_dt->format(sunset,s4) +
            " (USNO " + df_t->format(expset,s5) + ")");
    }
    cal->add(UCAL_DATE, 1, status);
  }		
  
  //		CalendarAstronomer a = new CalendarAstronomer(-(71+5/60), 42+37/60);
  //		cal.clear();
  //		cal.set(cal.YEAR, 1986);
  //		cal.set(cal.MONTH, cal.MARCH);
  //		cal.set(cal.DATE, 10);		
  //		cal.set(cal.YEAR, 1988);
  //		cal.set(cal.MONTH, cal.JULY);
  //		cal.set(cal.DATE, 27);		
  //		a.setDate(cal.getTime());
  //		long r = a.getSunRiseSet2(true);	
  delete astro3;
  delete tz;
  delete cal;
  delete cal2;
  delete df_t;
  delete df_d;
  delete df_dt;
  closeAstro(status);
  ASSERT_OK(status);
}



void AstroTest::TestBasics(void) {
  UErrorCode status = U_ZERO_ERROR;
  initAstro(status);
  ASSERT_OK(status);

  // Check that our JD computation is the same as the book's (p. 88)
  GregorianCalendar *cal3 = new GregorianCalendar(TimeZone::getGMT()->clone(), Locale::getUS(), status);
  DateFormat *d3 = DateFormat::createDateTimeInstance(DateFormat::MEDIUM,DateFormat::MEDIUM,Locale::getUS());
  d3->setTimeZone(*TimeZone::getGMT());
  cal3->clear();
  cal3->set(UCAL_YEAR, 1980);
  cal3->set(UCAL_MONTH, UCAL_JULY);
  cal3->set(UCAL_DATE, 2);
  logln("cal3[a]=%.1lf, d=%d\n", cal3->getTime(status), cal3->get(UCAL_JULIAN_DAY,status));
  {
    UnicodeString s;
    logln(UnicodeString("cal3[a] = ") + d3->format(cal3->getTime(status),s));
  }
  cal3->clear();
  cal3->set(UCAL_YEAR, 1980);
  cal3->set(UCAL_MONTH, UCAL_JULY);
  cal3->set(UCAL_DATE, 27);
  logln("cal3=%.1lf, d=%d\n", cal3->getTime(status), cal3->get(UCAL_JULIAN_DAY,status));

  ASSERT_OK(status);
  {
    UnicodeString s;
    logln(UnicodeString("cal3 = ") + d3->format(cal3->getTime(status),s));
  }
  astro->setTime(cal3->getTime(status));
  double jd = astro->getJulianDay() - 2447891.5;
  double exp = -3444.;
  if (jd == exp) {
    UnicodeString s;
    logln(d3->format(cal3->getTime(status),s) + " => " + jd);
  } else {
    UnicodeString s;
    errln("FAIL: " + d3->format(cal3->getTime(status), s) + " => " + jd +
          ", expected " + exp);
  }

  //        cal3.clear();
  //        cal3.set(cal3.YEAR, 1990);
  //        cal3.set(cal3.MONTH, Calendar.JANUARY);
  //        cal3.set(cal3.DATE, 1);
  //        cal3.add(cal3.DATE, -1);
  //        astro.setDate(cal3.getTime());
  //        astro.foo();
  
  delete cal3;
  delete d3;
  ASSERT_OK(status);
  closeAstro(status);
  ASSERT_OK(status);

}


// TODO: try finding next new moon after  07/28/1984 16:00 GMT
   

#endif




--- NEW FILE: astrotst.h ---
/********************************************************************
 * COPYRIGHT: 
 * Copyright (c) 1997-2003, International Business Machines Corporation and
 * others. All Rights Reserved.
 ********************************************************************/

#ifndef __AstroTest__
#define __AstroTest__
 
#include "unicode/utypes.h"

#if !UCONFIG_NO_FORMATTING

#include "unicode/calendar.h"
#include "unicode/gregocal.h"
#include "unicode/smpdtfmt.h"
#include "astro.h"
#include "caltztst.h"

class AstroTest: public CalendarTimeZoneTest {
public:
    // IntlTest override
    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
public:
    AstroTest();

    void TestSolarLongitude(void);

    void TestLunarPosition(void);

    void TestCoordinates(void);

    void TestCoverage(void);

    void TestSunriseTimes(void);

    void TestBasics(void);
 private:
    void initAstro(UErrorCode&);
    void closeAstro(UErrorCode&);
    
    CalendarAstronomer *astro;
    Calendar *gc;
    
};

#endif /* #if !UCONFIG_NO_FORMATTING */
 
#endif // __AstroTest__

--- NEW FILE: calcasts.cpp ---
/********************************************************************
 * COPYRIGHT: 
 * Copyright (c) 2003, International Business Machines Corporation 
 * and others. All Rights Reserved.
 ********************************************************************
 * Calendar Case Test is a type of CalendarTest which compares the 
 * behavior of a calendar to a certain set of 'test cases', involving
 * conversion between julian-day to fields and vice versa.
 ********************************************************************/

#include "calcasts.h"

#if !UCONFIG_NO_FORMATTING
// ======= 'Main' ===========================

#include "hebrwcal.h" // for Eras

#define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break


void CalendarCaseTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
    if (exec) logln("TestSuite CalendarCaseTest");
    switch (index) {
    CASE(0,IslamicCivil);
    CASE(1,Hebrew);
    default: name = ""; break;
    }
}

#undef CASE

// ======= Utility functions =================

void CalendarCaseTest::doTestCases(const TestCase *cases, Calendar *cal) {
  static const int32_t  ONE_SECOND = 1000;
  static const int32_t  ONE_MINUTE = 60*ONE_SECOND;
  static const int32_t  ONE_HOUR   = 60*ONE_MINUTE;
  static const double ONE_DAY    = 24*ONE_HOUR;
  static const double JULIAN_EPOCH = -210866760000000.;   // 1/1/4713 BC 12:00
  int32_t i;
  UErrorCode status = U_ZERO_ERROR;
  cal->adoptTimeZone(TimeZone::getGMT()->clone());
  for(i=0;cases[i].era>=0;i++) {
    UDate t = (JULIAN_EPOCH+(ONE_DAY*cases[i].julian));

    logln("Test case %d:  julianday%f -> date %f\n", i, cases[i].julian, t);

    // Millis -> fields
    cal->setTime(t, status);

    logln(calToStr(*cal));

    checkField(cal, UCAL_ERA, cases[i].era, status);
    checkField(cal, UCAL_YEAR, cases[i].year,status);
    checkField(cal, UCAL_MONTH, cases[i].month - 1,status);
    checkField(cal, UCAL_DATE, cases[i].day,status);
    checkField(cal, UCAL_DAY_OF_WEEK, cases[i].dayOfWeek,status);
    checkField(cal, UCAL_HOUR, cases[i].hour,status);
    checkField(cal, UCAL_MINUTE, cases[i].min,status);
    checkField(cal, UCAL_SECOND, cases[i].sec,status);
    
    // Fields -> millis
    cal->clear();
    
    cal->set(UCAL_ERA, cases[i].era);
    cal->set(UCAL_YEAR, cases[i].year);
    cal->set(UCAL_MONTH, cases[i].month - 1);
    cal->set(UCAL_DATE, cases[i].day);
    cal->set(UCAL_DAY_OF_WEEK, cases[i].dayOfWeek);
    cal->set(UCAL_HOUR, cases[i].hour);
    cal->set(UCAL_MINUTE, cases[i].min);
    cal->set(UCAL_SECOND, cases[i].sec);

    UDate t2 = cal->getTime(status);
    
    if(t != t2) {
      errln("Field->millis: Expected %.0f but got %.0f\n", t, t2);
      logln(calToStr(*cal));
    }
  }
}

UBool CalendarCaseTest::checkField(Calendar *cal, UCalendarDateFields field, int32_t value, UErrorCode &status)
{
  if(U_FAILURE(status)) return FALSE;
  int32_t res = cal->get(field, status);
  if(U_FAILURE(status)) {
    errln((UnicodeString)"Checking field " + fieldName(field) + " and got " + u_errorName(status));
    return FALSE;
  }
  if(res != value) {
    errln((UnicodeString)"FAIL: Checking field " + fieldName(field) + " expected " + value + " and got " + res + UnicodeString("\n"));
    return FALSE;
  } else {
    logln((UnicodeString)"Checking field " + fieldName(field) + " == " + value + UnicodeString("\n"));
  }
  return TRUE;
}

// =========== Test Cases =====================
enum { SUN=UCAL_SUNDAY,
       MON=UCAL_MONDAY,
       TUE=UCAL_TUESDAY,
       WED=UCAL_WEDNESDAY, 
       THU=UCAL_THURSDAY,
       FRI=UCAL_FRIDAY,
       SAT=UCAL_SATURDAY};

void CalendarCaseTest::IslamicCivil()
{
  static const TestCase tests[] = {
    //
    // Most of these test cases were taken from the back of
    // "Calendrical Calculations", with some extras added to help
    // debug a few of the problems that cropped up in development.
    //
    // The months in this table are 1-based rather than 0-based,
    // because it's easier to edit that way.
    //                       Islamic
    //          Julian Day  Era  Year  Month Day  WkDay Hour Min Sec
    {1507231.5,  0, -1245,   12,   9,  SUN,   0,  0,  0},
    { 1660037.5,  0,  -813,    2,  23,  WED,   0,  0,  0},
    { 1746893.5,  0,  -568,    4,   1,  WED,   0,  0,  0},
    { 1770641.5,  0,  -501,    4,   6,  SUN,   0,  0,  0},
    { 1892731.5,  0,  -157,   10,  17,  WED,   0,  0,  0},
    { 1931579.5,  0,   -47,    6,   3,  MON,   0,  0,  0},
    { 1974851.5,  0,    75,    7,  13,  SAT,   0,  0,  0},
    { 2091164.5,  0,   403,   10,   5,  SUN,   0,  0,  0},
    { 2121509.5,  0,   489,    5,  22,  SUN,   0,  0,  0},
    { 2155779.5,  0,   586,    2,   7,  FRI,   0,  0,  0},
    { 2174029.5,  0,   637,    8,   7,  SAT,   0,  0,  0},
    { 2191584.5,  0,   687,    2,  20,  FRI,   0,  0,  0},
    { 2195261.5,  0,   697,    7,   7,  SUN,   0,  0,  0},
    { 2229274.5,  0,   793,    7,   1,  SUN,   0,  0,  0},
    { 2245580.5,  0,   839,    7,   6,  WED,   0,  0,  0},
    { 2266100.5,  0,   897,    6,   1,  SAT,   0,  0,  0},
    { 2288542.5,  0,   960,    9,  30,  SAT,   0,  0,  0},
    { 2290901.5,  0,   967,    5,  27,  SAT,   0,  0,  0},
    { 2323140.5,  0,  1058,    5,  18,  WED,   0,  0,  0},
    { 2334848.5,  0,  1091,    6,   2,  SUN,   0,  0,  0},
    { 2348020.5,  0,  1128,    8,   4,  FRI,   0,  0,  0},
    { 2366978.5,  0,  1182,    2,   3,  SUN,   0,  0,  0},
    { 2385648.5,  0,  1234,   10,  10,  MON,   0,  0,  0},
    { 2392825.5,  0,  1255,    1,  11,  WED,   0,  0,  0},
    { 2416223.5,  0,  1321,    1,  21,  SUN,   0,  0,  0},
    { 2425848.5,  0,  1348,    3,  19,  SUN,   0,  0,  0},
    { 2430266.5,  0,  1360,    9,   8,  MON,   0,  0,  0},
    { 2430833.5,  0,  1362,    4,  13,  MON,   0,  0,  0},
    { 2431004.5,  0,  1362,   10,   7,  THU,   0,  0,  0},
    { 2448698.5,  0,  1412,    9,  13,  TUE,   0,  0,  0},
    { 2450138.5,  0,  1416,   10,   5,  SUN,   0,  0,  0},
    { 2465737.5,  0,  1460,   10,  12,  WED,   0,  0,  0},
    { 2486076.5,  0,  1518,    3,   5,  SUN,   0,  0,  0},
    { -1,-1,-1,-1,-1,-1,-1,-1,-1 }
  };
  
  UErrorCode status = U_ZERO_ERROR;
  Calendar *c = Calendar::createInstance("ar@calendar=islamic-civil", status);
  c->setLenient(TRUE);
  doTestCases(tests, c);
  delete c;
}

void CalendarCaseTest::Hebrew() {
  static const int32_t TISHRI  = HebrewCalendar::TISHRI;
//     static const int32_t HESHVAN = HebrewCalendar::HESHVAN;
//     static const int32_t KISLEV  = HebrewCalendar::KISLEV;
//     static const int32_t TEVET   = HebrewCalendar::TEVET;
//     static const int32_t SHEVAT  = HebrewCalendar::SHEVAT;
//     static const int32_t ADAR_1  = HebrewCalendar::ADAR_1;
//     static const int32_t ADAR    = HebrewCalendar::ADAR;
//     static const int32_t NISAN   = HebrewCalendar::NISAN;
//     static const int32_t IYAR    = HebrewCalendar::IYAR;
//     static const int32_t SIVAN   = HebrewCalendar::SIVAN;
//     static const int32_t TAMUZ   = HebrewCalendar::TAMUZ;
    static const int32_t AV      = HebrewCalendar::AV;
    static const int32_t ELUL    = HebrewCalendar::ELUL;

  static const TestCase tests[] = {
    //
    // Most of these test cases were taken from the back of
    // "Calendrical Calculations", with some extras added to help
    // debug a few of the problems that cropped up in development.
    //
    // The months in this table are 1-based rather than 0-based,
    // because it's easier to edit that way.
    //
    //         Julian Day  Era  Year  Month Day  WkDay Hour Min Sec
    {1507231.5,  0,  3174,   12,  10,  SUN,   0,  0,  0},
     {1660037.5,  0,  3593,    3,  25,  WED,   0,  0,  0},
     {1746893.5,  0,  3831,    1,   3,  WED,   0,  0,  0},
     {1770641.5,  0,  3896,    1,   9,  SUN,   0,  0,  0},
     {1892731.5,  0,  4230,    4,  18,  WED,   0,  0,  0},
     {1931579.5,  0,  4336,   10,   4,  MON,   0,  0,  0},
     {1974851.5,  0,  4455,    2,  13,  SAT,   0,  0,  0},
     {2091164.5,  0,  4773,    9,   6,  SUN,   0,  0,  0},
     {2121509.5,  0,  4856,    9,  23,  SUN,   0,  0,  0},
     {2155779.5,  0,  4950,    8,   7,  FRI,   0,  0,  0},
     {2174029.5,  0,  5000,    7,   8,  SAT,   0,  0,  0},
     {2191584.5,  0,  5048,    8,  21,  FRI,   0,  0,  0},
     {2195261.5,  0,  5058,    9,   7,  SUN,   0,  0,  0},
     {2229274.5,  0,  5151,   11,   1,  SUN,   0,  0,  0},
     {2245580.5,  0,  5196,    5,   7,  WED,   0,  0,  0},
     {2266100.5,  0,  5252,    8,   3,  SAT,   0,  0,  0},
     {2288542.5,  0,  5314,    1,   1,  SAT,   0,  0,  0},
     {2290901.5,  0,  5320,    6,  27,  SAT,   0,  0,  0},
     {2323140.5,  0,  5408,   10,  20,  WED,   0,  0,  0},
     {2334551.5,  0,  5440,    1,   1,  THU,   0,  0,  0},
     {2334581.5,  0,  5440,    2,   1,  SAT,   0,  0,  0},
     {2334610.5,  0,  5440,    3,   1,  SUN,   0,  0,  0},
     {2334639.5,  0,  5440,    4,   1,  MON,   0,  0,  0},
     {2334668.5,  0,  5440,    5,   1,  TUE,   0,  0,  0},
     {2334698.5,  0,  5440,    6,   1,  THU,   0,  0,  0},
     {2334728.5,  0,  5440,    7,   1,  SAT,   0,  0,  0},
     {2334757.5,  0,  5440,    8,   1,  SUN,   0,  0,  0},
     {2334787.5,  0,  5440,    9,   1,  TUE,   0,  0,  0},
     {2334816.5,  0,  5440,   10,   1,  WED,   0,  0,  0},
     {2334846.5,  0,  5440,   11,   1,  FRI,   0,  0,  0},
     {2334848.5,  0,  5440,   11,   3,  SUN,   0,  0,  0},
     {2334934.5,  0,  5441,    1,   1,  TUE,   0,  0,  0},
     {2348020.5,  0,  5476,   12,   5,  FRI,   0,  0,  0},
     {2366978.5,  0,  5528,   11,   4,  SUN,   0,  0,  0},
     {2385648.5,  0,  5579,   12,  11,  MON,   0,  0,  0},
     {2392825.5,  0,  5599,    8,  12,  WED,   0,  0,  0},
     {2416223.5,  0,  5663,    8,  22,  SUN,   0,  0,  0},
     {2425848.5,  0,  5689,   12,  19,  SUN,   0,  0,  0},
     {2430266.5,  0,  5702,    1,   8,  MON,   0,  0,  0},
     {2430833.5,  0,  5703,    8,  14,  MON,   0,  0,  0},
     {2431004.5,  0,  5704,    1,   8,  THU,   0,  0,  0},
     {2448698.5,  0,  5752,    7,  12,  TUE,   0,  0,  0},
     {2450138.5,  0,  5756,    7,   5,  SUN,   0,  0,  0},
     {2465737.5,  0,  5799,    2,  12,  WED,   0,  0,  0},
    {2486076.5,  0,  5854,   12,   5,  SUN,   0,  0,  0},

    // Test cases taken from a table of 14 "year types" in the Help file
    // of the application "Hebrew Calendar"
    {2456187.5,  0,  5773,    1,   1,  MON,   0,  0,  0},
     {2459111.5,  0,  5781,    1,   1,  SAT,   0,  0,  0},
     {2453647.5,  0,  5766,    1,   1,  TUE,   0,  0,  0},
     {2462035.5,  0,  5789,    1,   1,  THU,   0,  0,  0},
     {2458756.5,  0,  5780,    1,   1,  MON,   0,  0,  0},
     {2460586.5,  0,  5785,    1,   1,  THU,   0,  0,  0},
     {2463864.5,  0,  5794,    1,   1,  SAT,   0,  0,  0},
     {2463481.5,  0,  5793,    1,   1,  MON,   0,  0,  0},
     {2470421.5,  0,  5812,    1,   1,  THU,   0,  0,  0},
     {2460203.5,  0,  5784,    1,   1,  SAT,   0,  0,  0},
     {2459464.5,  0,  5782,    1,   1,  TUE,   0,  0,  0},
     {2467142.5,  0,  5803,    1,   1,  MON,   0,  0,  0},
    {2455448.5,  0,  5771,    1,   1,  THU,   0,  0,  0},
    // Test cases for JB#2327        
    // http://www.fourmilab.com/documents/calendar/
    // http://www.calendarhome.com/converter/
    //      2452465.5, 2002, JULY, 10, 5762, AV, 1,
    //      2452494.5, 2002, AUGUST, 8, 5762, AV, 30,
    //      2452495.5, 2002, AUGUST, 9, 5762, ELUL, 1,
    //      2452523.5, 2002, SEPTEMBER, 6, 5762, ELUL, 29,
    //      2452524.5, 2002, SEPTEMBER, 7, 5763, TISHRI, 1,
    //         Julian Day  Era  Year  Month Day  WkDay Hour Min Sec
    {2452465.5,  0,  5762,    AV+1,  1,  WED,   0,  0,  0},
    {2452494.5,  0,  5762,    AV+1, 30,  THU,   0,  0,  0},
    {2452495.5,  0,  5762,  ELUL+1,  1,  FRI,   0,  0,  0},
    {2452523.5,  0,  5762,  ELUL+1, 29,  FRI,   0,  0,  0},
    {2452524.5,  0,  5763, TISHRI+1,  1,  SAT,   0,  0,  0},
    { -1,-1,-1,-1,-1,-1,-1,-1,-1 }
  };
  
  UErrorCode status = U_ZERO_ERROR;
  Calendar *c = Calendar::createInstance("he_HE@calendar=hebrew", status);
  c->setLenient(TRUE);
  doTestCases(tests, c);


    // Additional test cases for bugs found during development
    //           G.YY/MM/DD  Era  Year  Month Day  WkDay Hour Min Sec
  //{1013, 9, 8, 0,  4774,    1,   1,  TUE,   0,  0,  0},
  //{1239, 9, 1, 0,  5000,    1,   1,  THU,   0,  0,  0},
  //{1240, 9,18, 0,  5001,    1,   1,  TUE,   0,  0,  0},


  delete c;
}


#endif

--- NEW FILE: calcasts.h ---
/********************************************************************
 * COPYRIGHT: 
 * Copyright (c) 2003, International Business Machines Corporation 
 * and others. All Rights Reserved.
 ********************************************************************
 * Calendar Case Test is a type of CalendarTest which compares the 
 * behavior of a calendar to a certain set of 'test cases', involving
 * conversion between julian-day to fields and vice versa.
 ********************************************************************/

#ifndef __CalendarCaseTest__
#define __CalendarCaseTest__
 
#include "unicode/utypes.h"

#if !UCONFIG_NO_FORMATTING

#include "unicode/calendar.h"
#include "unicode/smpdtfmt.h"
#include "caltest.h"

class CalendarCaseTest: public CalendarTest {
 public:
  virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );

  /* Test case struct */
  struct TestCase {
    double julian; // Julian Date
    int32_t era;
    int32_t year;
    int32_t month;
    int32_t day;
    int32_t dayOfWeek;
    int32_t hour;
    int32_t min;
    int32_t sec;
  };
  
  /**
   * @param cases array of items to test.  Terminate with a "-1" for era.
   */
  void doTestCases(const TestCase *cases, Calendar *cal);

 private:
  /**
   * Utility function to test out a specific field
   * @param cal calendar
   * @param field which field
   * @param value expected value
   * @param status err status 
   * @return boolean indicating success (TRUE) or failure (FALSE) of the test.
   */
  UBool checkField(Calendar *cal, UCalendarDateFields field, int32_t value, UErrorCode &status);

 private:
  // test cases
  void IslamicCivil();
  void Hebrew();
};

#endif
#endif

--- NEW FILE: convtest.cpp ---
/*
*******************************************************************************
*
*   Copyright (C) 2003, International Business Machines
*   Corporation and others.  All Rights Reserved.
*
*******************************************************************************
*   file name:  convtest.cpp
*   encoding:   US-ASCII
*   tab size:   8 (not used)
*   indentation:4
*
*   created on: 2003jul15
*   created by: Markus W. Scherer
*
*   Test file for data-driven conversion tests.
*/

#include "unicode/utypes.h"
[...1191 lines suppressed...]
              " expected <%s>[%d]\n"
              "  result  <%s>[%d]\n"
              " offsets         <%s>\n"
              "  result offsets <%s>\n"
              " error code expected %s got %s\n"
              "  invalidChars expected <%s> got <%s>\n",
              cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, name, msg,
              unicodeString, cc.unicodeLength,
              bytesString, cc.bytesLength,
              resultString, resultLength,
              offsetsString,
              resultOffsetsString,
              u_errorName(cc.outErrorCode), u_errorName(resultErrorCode),
              invalidCharsString, resultInvalidUCharsString);

        return FALSE;
    }
}

#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */

--- NEW FILE: convtest.h ---
/*
*******************************************************************************
*
*   Copyright (C) 2003, International Business Machines
*   Corporation and others.  All Rights Reserved.
*
*******************************************************************************
*   file name:  convtest.h
*   encoding:   US-ASCII
*   tab size:   8 (not used)
*   indentation:4
*
*   created on: 2003jul15
*   created by: Markus W. Scherer
*
*   Test file for data-driven conversion tests.
*/

#ifndef __CONVTEST_H__
#define __CONVTEST_H__

#include "unicode/utypes.h"

#if !UCONFIG_NO_LEGACY_CONVERSION

#include "unicode/ucnv.h"
#include "intltest.h"

struct ConversionCase {
    int32_t caseNr;
    const char *charset, *cbopt, *name;
    char subchar[8];

    const uint8_t *bytes;
    int32_t bytesLength;
    const UChar *unicode;
    int32_t unicodeLength;
    const int32_t *offsets;

    UBool finalFlush;
    UBool fallbacks;
    UErrorCode outErrorCode;
    const uint8_t *invalidChars;
    const UChar *invalidUChars;
    int32_t invalidLength;

    uint8_t resultBytes[200];
    UChar resultUnicode[200];
    int32_t resultOffsets[200];
    int32_t resultLength;

    UErrorCode resultErrorCode;
};

class ConversionTest : public IntlTest {
public:
    ConversionTest() {}
    virtual ~ConversionTest();
    
    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0);

    void TestToUnicode();
    void TestFromUnicode();
    void TestGetUnicodeSet();

private:
    UBool
    ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback, const char *option);

    UBool
    FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback callback, const char *option);

    UBool
    checkToUnicode(ConversionCase &cc, UConverter *cnv, const char *name,
                   const UChar *result, int32_t resultLength,
                   const int32_t *resultOffsets,
                   UErrorCode resultErrorCode);

    UBool
    checkFromUnicode(ConversionCase &cc, UConverter *cnv, const char *name,
                     const uint8_t *result, int32_t resultLength,
                     const int32_t *resultOffsets,
                     UErrorCode resultErrorCode);

    UConverter *
    cnv_open(const char *name, UErrorCode &errorCode);
};

#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */

#endif

--- NEW FILE: v32test.cpp ---
/********************************************************************
 * COPYRIGHT:
 * Copyright (c) 2002-2003, International Business Machines Corporation and
 * others. All Rights Reserved.
 ********************************************************************/

//
//   regextst.cpp
//
//      ICU Regular Expressions test, part of intltest.
//

#include "intltest.h"

#include "v32test.h"
#include "uvectr32.h"
#include "uvector.h"
#include "util.h"
#include <stdlib.h>
#include <stdio.h>


//---------------------------------------------------------------------------
//
//  Test class boilerplate
//
//---------------------------------------------------------------------------
UVector32Test::UVector32Test() 
{
};


UVector32Test::~UVector32Test()
{
};



void UVector32Test::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
    if (exec) logln("TestSuite UVector32Test: ");
    switch (index) {

        case 0: name = "UVector32_API";
            if (exec) UVector32_API(); 
            break;
        default: name = ""; 
            break; //needed to end loop
    }
}


//---------------------------------------------------------------------------
//
//   Error Checking / Reporting macros used in all of the tests.
//
//---------------------------------------------------------------------------
#define TEST_CHECK_STATUS(status) \
    if (U_FAILURE(status)) {\
        errln("UVector32Test failure at line %d.  status=%s\n", __LINE__, u_errorName(status));\
        return;\
    }

#define TEST_ASSERT(expr) \
    if ((expr)==FALSE) {\
        errln("RegexTest failure at line %d.\n", __LINE__);\
    }

//---------------------------------------------------------------------------
//
//      UVector32_API      Check for basic functionality of UVector32.
//
//---------------------------------------------------------------------------
void UVector32Test::UVector32_API() {

    UErrorCode  status = U_ZERO_ERROR;
    UVector32     *a;
    UVector32     *b;

    a = new UVector32(status);
    TEST_CHECK_STATUS(status);
    delete a;

    status = U_ZERO_ERROR;
    a = new UVector32(2000, status);
    TEST_CHECK_STATUS(status);
    delete a;

    //
    //  assign()
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    b = new UVector32(status);
    b->assign(*a, status);
    TEST_ASSERT(b->size() == 3);
    TEST_ASSERT(b->elementAti(1) == 20);
    TEST_CHECK_STATUS(status);
    delete a;
    delete b;

    //
    //  operator == and != and equals()
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    b = new UVector32(status);
    TEST_ASSERT(*b != *a);
    TEST_ASSERT(!(*b == *a));
    TEST_ASSERT(!b->equals(*a));
    b->assign(*a, status);
    TEST_ASSERT(*b == *a);
    TEST_ASSERT(!(*b != *a));
    TEST_ASSERT(b->equals(*a));
    b->addElement(666, status);
    TEST_ASSERT(*b != *a);
    TEST_ASSERT(!(*b == *a));
    TEST_ASSERT(!b->equals(*a));
    TEST_CHECK_STATUS(status);
    delete b;
    delete a;

    //
    //  addElement().   Covered by above tests.
    //

    //
    // setElementAt()
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    a->setElementAt(666, 1);
    TEST_ASSERT(a->elementAti(0) == 10);
    TEST_ASSERT(a->elementAti(1) == 666);
    TEST_ASSERT(a->size() == 3);
    TEST_CHECK_STATUS(status);
    delete a;

    //
    // insertElementAt()
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    a->insertElementAt(666, 1, status);
    TEST_ASSERT(a->elementAti(0) == 10);
    TEST_ASSERT(a->elementAti(1) == 666);
    TEST_ASSERT(a->elementAti(2) == 20);
    TEST_ASSERT(a->elementAti(3) == 30);
    TEST_ASSERT(a->size() == 4);
    TEST_CHECK_STATUS(status);
    delete a;

    //
    //  elementAti()    covered by above tests
    //

    //
    //  lastElementi
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    TEST_ASSERT(a->lastElementi() == 30);
    TEST_CHECK_STATUS(status);
    delete a;


    //
    //  indexOf
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    TEST_ASSERT(a->indexOf(30, 0) == 2);
    TEST_ASSERT(a->indexOf(40, 0) == -1);
    TEST_ASSERT(a->indexOf(10, 0) == 0);
    TEST_ASSERT(a->indexOf(10, 1) == -1);
    TEST_CHECK_STATUS(status);
    delete a;

    
    //
    //  contains
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    TEST_ASSERT(a->contains(10) == TRUE);
    TEST_ASSERT(a->contains(11) == FALSE);
    TEST_ASSERT(a->contains(20) == TRUE);
    TEST_ASSERT(a->contains(-10) == FALSE);
    TEST_CHECK_STATUS(status);
    delete a;


    //
    //  containsAll
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    b = new UVector32(status);
    TEST_ASSERT(a->containsAll(*b) == TRUE);
    b->addElement(2, status);
    TEST_ASSERT(a->containsAll(*b) == FALSE);
    b->setElementAt(10, 0);
    TEST_ASSERT(a->containsAll(*b) == TRUE);
    TEST_ASSERT(b->containsAll(*a) == FALSE);
    b->addElement(30, status);
    b->addElement(20, status);
    TEST_ASSERT(a->containsAll(*b) == TRUE);
    TEST_ASSERT(b->containsAll(*a) == TRUE);
    b->addElement(2, status);
    TEST_ASSERT(a->containsAll(*b) == FALSE);
    TEST_ASSERT(b->containsAll(*a) == TRUE);
    TEST_CHECK_STATUS(status);
    delete a;
    delete b;

    //
    //  removeAll
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    b = new UVector32(status);
    a->removeAll(*b);
    TEST_ASSERT(a->size() == 3);
    b->addElement(20, status);
    a->removeAll(*b);
    TEST_ASSERT(a->size() == 2);
    TEST_ASSERT(a->contains(10)==TRUE);
    TEST_ASSERT(a->contains(30)==TRUE);
    b->addElement(10, status);
    a->removeAll(*b);
    TEST_ASSERT(a->size() == 1);
    TEST_ASSERT(a->contains(30) == TRUE);
    TEST_CHECK_STATUS(status);
    delete a;
    delete b;

    //
    // retainAll
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    b = new UVector32(status);
    b->addElement(10, status);
    b->addElement(20, status);
    b->addElement(30, status);
    b->addElement(15, status);
    a->retainAll(*b);
    TEST_ASSERT(a->size() == 3);
    b->removeElementAt(1);
    a->retainAll(*b);
    TEST_ASSERT(a->contains(20) == FALSE);
    TEST_ASSERT(a->size() == 2);
    b->removeAllElements();
    TEST_ASSERT(b->size() == 0);
    a->retainAll(*b);
    TEST_ASSERT(a->size() == 0);
    TEST_CHECK_STATUS(status);
    delete a;
    delete b;

    //
    //  removeElementAt   Tested above.
    //

    //
    //  removeAllElments   Tested above
    //

    //
    //  size()   tested above
    //

    //
    //  isEmpty
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    TEST_ASSERT(a->isEmpty() == TRUE);
    a->addElement(10, status);
    TEST_ASSERT(a->isEmpty() == FALSE);
    a->addElement(20, status);
    a->removeElementAt(0);
    TEST_ASSERT(a->isEmpty() == FALSE);
    a->removeElementAt(0);
    TEST_ASSERT(a->isEmpty() == TRUE);
    TEST_CHECK_STATUS(status);
    delete a;


    //
    // ensureCapacity, expandCapacity
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    TEST_ASSERT(a->isEmpty() == TRUE);
    a->addElement(10, status);
    TEST_ASSERT(a->ensureCapacity(5000, status)== TRUE);
    TEST_ASSERT(a->expandCapacity(20000, status) == TRUE);
    TEST_CHECK_STATUS(status);
    delete a;
    
    //
    // setSize
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    a->setSize(100);
    TEST_ASSERT(a->size() == 100);
    TEST_ASSERT(a->elementAti(0) == 10);
    TEST_ASSERT(a->elementAti(1) == 20);
    TEST_ASSERT(a->elementAti(2) == 30);
    TEST_ASSERT(a->elementAti(3) == 0);
    a->setElementAt(666, 99);
    a->setElementAt(777, 100);
    TEST_ASSERT(a->elementAti(99) == 666);
    TEST_ASSERT(a->elementAti(100) == 0);
    a->setSize(2);
    TEST_ASSERT(a->elementAti(1) == 20);
    TEST_ASSERT(a->elementAti(2) == 0);
    TEST_ASSERT(a->size() == 2);
    a->setSize(0);
    TEST_ASSERT(a->empty() == TRUE);
    TEST_ASSERT(a->size() == 0);

    TEST_CHECK_STATUS(status);
    delete a;

    //
    // containsNone
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    b = new UVector32(status);
    TEST_ASSERT(a->containsNone(*b) == TRUE);
    b->addElement(5, status);
    TEST_ASSERT(a->containsNone(*b) == TRUE);
    b->addElement(30, status);
    TEST_ASSERT(a->containsNone(*b) == FALSE);

    TEST_CHECK_STATUS(status);
    delete a;
    delete b;

    //
    // sortedInsert
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->sortedInsert(30, status);
    a->sortedInsert(20, status);
    a->sortedInsert(10, status);
    TEST_ASSERT(a->elementAti(0) == 10);
    TEST_ASSERT(a->elementAti(1) == 20);
    TEST_ASSERT(a->elementAti(2) == 30);

    TEST_CHECK_STATUS(status);
    delete a;

    //
    // getBuffer
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    int32_t *buf = a->getBuffer();
    TEST_ASSERT(buf[0] == 10);
    TEST_ASSERT(buf[1] == 20);
    a->setSize(20000);
    int32_t *resizedBuf;
    resizedBuf = a->getBuffer();
    TEST_ASSERT(buf != resizedBuf);
    TEST_ASSERT(resizedBuf[0] == 10);
    TEST_ASSERT(resizedBuf[1] == 20);

    TEST_CHECK_STATUS(status);
    delete a;


    //
    //  RTTI
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    TEST_ASSERT(a->getDynamicClassID() == UVector32::getStaticClassID());
    TEST_ASSERT(a->getDynamicClassID() != UVector::getStaticClassID());
    TEST_CHECK_STATUS(status);
    delete a;

    //
    //  empty
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    TEST_ASSERT(a->empty() == TRUE);
    a->addElement(10, status);
    TEST_ASSERT(a->empty() == FALSE);
    a->addElement(20, status);
    a->removeElementAt(0);
    TEST_ASSERT(a->empty() == FALSE);
    a->removeElementAt(0);
    TEST_ASSERT(a->empty() == TRUE);
    TEST_CHECK_STATUS(status);
    delete a;


    //
    //  peeki
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    TEST_ASSERT(a->peeki() == 10);
    a->addElement(20, status);
    TEST_ASSERT(a->peeki() == 20);
    a->addElement(30, status);
    TEST_ASSERT(a->peeki() == 30);
    TEST_CHECK_STATUS(status);
    delete a;


    //
    // popi
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->addElement(10, status);
    a->addElement(20, status);
    a->addElement(30, status);
    TEST_ASSERT(a->popi() == 30);
    TEST_ASSERT(a->popi() == 20);
    TEST_ASSERT(a->popi() == 10);
    TEST_ASSERT(a->popi() == 0);
    TEST_ASSERT(a->isEmpty());
    TEST_CHECK_STATUS(status);
    delete a;

    //
    // push
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    TEST_ASSERT(a->push(10, status) == 10);
    TEST_ASSERT(a->push(20, status) == 20);
    TEST_ASSERT(a->push(30, status) == 30);
    TEST_ASSERT(a->size() == 3);
    TEST_ASSERT(a->popi() == 30);
    TEST_ASSERT(a->popi() == 20);
    TEST_ASSERT(a->popi() == 10);
    TEST_ASSERT(a->isEmpty());
    TEST_CHECK_STATUS(status);
    delete a;


    //
    // reserveBlock
    //
    status = U_ZERO_ERROR;
    a = new UVector32(status);
    a->ensureCapacity(1000, status);

    // TODO:

    TEST_CHECK_STATUS(status);
    delete a;

};



--- NEW FILE: v32test.h ---
/*
******************************************************************************
* Copyright (C) 2003, International Business Machines Corporation and        *
* others. All Rights Reserved.                                               *
******************************************************************************
*/

//  file:  v32test.h


#ifndef V32TEST_H
#define V32TEST_H

#include "unicode/utypes.h"

#include "intltest.h"


class UVector32Test: public IntlTest {
public:
  
    UVector32Test();
    virtual ~UVector32Test();

    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL );

    // The following are test functions that are visible from the intltest test framework.
    virtual void UVector32_API();

};

#endif

Index: Makefile.in
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/Makefile.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.in	10 Sep 2003 02:42:42 -0000	1.4
+++ Makefile.in	6 Apr 2004 10:09:34 -0000	1.5
@@ -26,21 +26,22 @@
 DEFS += -D'U_TOPSRCDIR="$(top_srcdir)/"' -D'U_TOPBUILDDIR="$(BUILDDIR)"'
 LIBS = $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M)
 
-OBJECTS = allcoll.o apicoll.o callimts.o calregts.o caltest.o		\
-caltztst.o canittst.o citrtest.o cntabcol.o cputilst.o currcoll.o dacoll.o	\
+OBJECTS = allcoll.o apicoll.o astrotst.o callimts.o calregts.o caltest.o \
+caltztst.o canittst.o citrtest.o cntabcol.o convtest.o cputilst.o currcoll.o dacoll.o	\
 dadrcoll.o dcfmapts.o decoll.o dtfmapts.o dtfmrgts.o dtfmtrtts.o dtfmttst.o	\
 encoll.o escoll.o ficoll.o frcoll.o g7coll.o intltest.o	\
 itercoll.o itformat.o itmajor.o itutil.o jacoll.o lcukocol.o	\
 loctest.o miscdtfm.o mnkytst.o msfmrgts.o nmfmapts.o nmfmtrt.o		\
 numfmtst.o numrgts.o pptest.o regcoll.o restest.o restsnew.o sdtfmtts.o svccoll.o tchcfmt.o	\
 tfsmalls.o tmsgfmt.o trcoll.o tscoll.o tsdate.o tsdcfmsy.o tsdtfmsy.o	\
-tsmthred.o tsmutex.o tsnmfmt.o tsputil.o tstnrapi.o tstnorm.o tzbdtest.o		\
+tsmthred.o tsnmfmt.o tsputil.o tstnrapi.o tstnorm.o tzbdtest.o		\
 tzregts.o tztest.o ucdtest.o usettest.o ustrtest.o strcase.o transtst.o strtest.o thcoll.o \
 itrbbi.o rbbiapts.o rbbitst.o ittrans.o transapi.o cpdtrtst.o unhxtrts.o hxuntrts.o \
 ufltlgts.o testutil.o transrt.o trnserr.o normconf.o sfwdchit.o \
 jamotest.o srchtest.o reptest.o regextst.o \
 itrbnf.o itrbnfrt.o tstdtmod.o testdata.o datamap.o ucaconf.o icusvtst.o \
-uobjtest.o idnaref.o nptrans.o punyref.o testidn.o testidna.o incaltst.o
+uobjtest.o idnaref.o nptrans.o punyref.o testidn.o testidna.o incaltst.o \
+calcasts.o v32test.o
 
 
 DEPS = $(OBJECTS:.o=.d)
@@ -76,7 +77,7 @@
 -include Makefile.local
 
 check-local: all-local
-	 TZ=PST8PDT $(INVOKE) ./$(TARGET)  $(INTLTEST_OPTS) || true
+	$(INVOKE) ./$(TARGET) $(INTLTEST_OPTS) || true
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
 	cd $(top_builddir) \
@@ -84,9 +85,6 @@
 
 $(TARGET) : $(OBJECTS)
 	$(LINK.cc) $(OUTOPT)$@ $^ $(LIBS)
-
-invoke:
-	ICU_DATA=$${ICU_DATA:-$(top_builddir)/data/} TZ=PST8PDT $(INVOKE) $(INVOCATION)
 
 ifeq (,$(MAKECMDGOALS))
 -include $(DEPS)

Index: apicoll.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/apicoll.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- apicoll.cpp	10 Sep 2003 02:42:42 -0000	1.3
+++ apicoll.cpp	6 Apr 2004 10:09:35 -0000	1.4
@@ -51,6 +51,7 @@
     }
 }
 
+#ifdef U_USE_COLLATION_OBSOLETE_2_6
 /*
  * Test Collator::createInstance(... version...) for some locale. Called by TestProperty().
  */
@@ -80,6 +81,7 @@
         }
     }
 }
+#endif
 
 // Collator Class Properties
 // ctor, dtor, createInstance, compare, getStrength/setStrength
@@ -96,8 +98,9 @@
       ICU 2.1 currVersionArray = {0x19, 0x00, 0x03, 0x03};
       ICU 2.2 currVersionArray = {0x21, 0x40, 0x04, 0x04};
       ICU 2.4 currVersionArray = {0x21, 0x40, 0x04, 0x04};
+      ICU 2.6 currVersionArray = {0x21, 0x40, 0x03, 0x03};
     */
-    UVersionInfo currVersionArray = {0x21, 0x40, 0x03, 0x03};
+    UVersionInfo currVersionArray = {0x29, 0x80, 0x01, 0x04};
     UVersionInfo versionArray;
     int i = 0;
 
@@ -232,6 +235,7 @@
     delete aFrCol;
     delete junk;
 
+#ifdef U_USE_COLLATION_OBSOLETE_2_6
     /* test Collator::createInstance(...version...) */
     TestOpenVersion(*this, "");
     TestOpenVersion(*this, "da");
@@ -248,6 +252,7 @@
         errln("error: ucol_openVersion(bogus version) succeeded");
         delete col;
     }
+#endif
 }
 
 void 
@@ -350,7 +355,7 @@
     }
 
     coll->getRules(UCOL_TAILORING_ONLY, rules);
-    if (rules.length() != 0) {
+    if (rules.length() != 0x0f) {
         errln("English tailored rules failed");
     }
 
@@ -1012,11 +1017,17 @@
     col->setAttribute(UCOL_STRENGTH, UCOL_IDENTICAL, status);
 
     uint8_t key2compat[] = {
+            /* 2.6.1 key */
+        0x26, 0x28, 0x2A, 0x2C, 0x26, 0x01, 
+        0x09, 0x01, 0x09, 0x01, 0x25, 0x01, 
+        0x92, 0x93, 0x94, 0x95, 0x92, 0x00 
+
         /* 2.2 key */
+        /*
         0x1D, 0x1F, 0x21, 0x23, 0x1D, 0x01,
         0x09, 0x01, 0x09, 0x01, 0x1C, 0x01,
         0x92, 0x93, 0x94, 0x95, 0x92, 0x00
-
+        */
         /* 2.0 key */
         /*
         0x19, 0x1B, 0x1D, 0x1F, 0x19,
@@ -1176,7 +1187,7 @@
 {
     UErrorCode          status = U_ZERO_ERROR;
     UChar               ch     = 0;
-    UChar               supplementary[2] = {0xD800, 0xDC00};
+    UChar32             unassigned = 0xEFFFD;
     uint32_t            sorder = 0;
     uint32_t            temporder = 0;
 
@@ -1205,8 +1216,7 @@
         if (order == 0)
             order = iter->previous(status);
 
-        while (U_SUCCESS(status) &&
-            ((uint32_t)iter->previous(status) != UCOL_NULLORDER)) {
+        while (U_SUCCESS(status) && iter->previous(status) != UCOL_NULLORDER) {
             count ++;
         }
 
@@ -1253,7 +1263,7 @@
                 ch, 3);
     }
 
-    str.setTo(supplementary, 2);
+    str.setTo(unassigned);
     iter->setText(str, status);
     sorder = iter->previous(status);
 
@@ -1498,7 +1508,7 @@
 
   /* completely non-existant locale for collator should get a default collator */
   {
-    Collator *defaultColl = Collator::createInstance(NULL, status);
+    Collator *defaultColl = Collator::createInstance((const Locale)NULL, status);
     coll = Collator::createInstance("blahaha", status);
     if(U_FAILURE(status)) {
       log("Failed to open collator with %s\n", u_errorName(status));

Index: callimts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/callimts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- callimts.cpp	10 Sep 2003 02:42:42 -0000	1.3
+++ callimts.cpp	6 Apr 2004 10:09:36 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -9,6 +9,7 @@
 #if !UCONFIG_NO_FORMATTING
 
 #include "callimts.h"
+#include "caltest.h"
 #include "unicode/calendar.h"
 #include "unicode/gregocal.h"
 #include "unicode/datefmt.h"
@@ -40,6 +41,7 @@
 void
 CalendarLimitTest::test(UDate millis, U_NAMESPACE_QUALIFIER Calendar* cal, U_NAMESPACE_QUALIFIER DateFormat* fmt)
 {
+  static const UDate kDrift = 1e-10;
     UErrorCode exception = U_ZERO_ERROR;
     UnicodeString theDate;
     UErrorCode status = U_ZERO_ERROR;
@@ -48,9 +50,11 @@
         fmt->format(millis, theDate);
         UDate dt = fmt->parse(theDate, status);
         // allow a small amount of error (drift)
-        if(! withinErr(dt, millis, 1e-10))
-            errln(UnicodeString("FAIL:round trip for large milli, got: ") + dt + " wanted: " + millis);
-        else {
+        if(! withinErr(dt, millis, kDrift)) {
+          errln("FAIL:round trip for large milli, got: %.1lf wanted: %.1lf. (delta %.2lf greater than %.2lf)",
+                dt, millis, uprv_fabs(millis-dt), uprv_fabs(dt*kDrift));
+          logln(UnicodeString("   ") + theDate + " " + CalendarTest::calToStr(*cal));
+          } else {
             logln(UnicodeString("OK: got ") + dt + ", wanted " + millis);
             logln(UnicodeString("    ") + theDate);
         }
@@ -89,15 +93,18 @@
     fmt->adoptCalendar(cal);
     ((SimpleDateFormat*) fmt)->applyPattern("HH:mm:ss.SSS zzz, EEEE, MMMM d, yyyy G");
 
+
     // This test used to test the algorithmic limits of the dates that
     // GregorianCalendar could handle.  However, the algorithm has
     // been rewritten completely since then and the prior limits no
     // longer apply.  Instead, we now do basic round-trip testing of
     // some extreme (but still manageable) dates.
     UDate m;
-    for ( m = 1e17; m < 1e18; m *= 1.1) {
+    logln("checking 1e16..1e17");
+    for ( m = 1e16; m < 1e17; m *= 1.1) {
         test(m, cal, fmt);
     }
+    logln("checking -1e14..-1e15");
     for ( m = -1e14; m > -1e15; m *= 1.1) {
         test(m, cal, fmt);
     }

Index: calregts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/calregts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- calregts.cpp	10 Sep 2003 02:42:42 -0000	1.3
+++ calregts.cpp	6 Apr 2004 10:09:36 -0000	1.4
@@ -15,6 +15,7 @@
 #include "unicode/smpdtfmt.h"
 #include "unicode/strenum.h"
 #include "cmemory.h"
+#include "caltest.h"
 
 #include <float.h>
 
@@ -212,7 +213,6 @@
     // This bug actually occurs on Windows NT as well, and doesn't
     // require the host zone to be set; it can be set in Java.
     UErrorCode status = U_ZERO_ERROR;
-    int32_t count = 0;
     StringEnumeration* ids = TimeZone::createEnumeration();
     UBool bad = FALSE;
     for (int32_t i=0; i<ids->count(status); ++i) {
@@ -525,7 +525,7 @@
     if (min != UCAL_SUNDAY || max != UCAL_SATURDAY)
         errln("FAIL: Min/max bad");
     if (dow < min || dow > max) 
-        errln(UnicodeString("FAIL: Day of week ") + dow + " out of range");
+        errln("FAIL: Day of week %d out of range [%d,%d]\n", dow, min, max);
     if (dow != UCAL_SUNDAY) 
         errln("FAIL: Day of week should be SUNDAY Got " + dow);
 
@@ -589,6 +589,33 @@
       delete foo1;
       return;
     }
+    logln("foo1@%.0f - %d-%d-%d %d:%d:%d.%ds\n", foo1->getTime(status),
+          foo1->get(UCAL_YEAR, status),
+          foo1->get(UCAL_MONTH, status),
+          foo1->get(UCAL_DATE, status),
+          foo1->get(UCAL_HOUR, status),
+          foo1->get(UCAL_MINUTE, status),
+          foo1->get(UCAL_SECOND, status),
+          foo1->get(UCAL_MILLISECOND,status));
+    foo1->add(UCAL_DATE, + 1, status);
+    logln("foo1@%.0f - %d-%d-%d %d:%d:%d.%ds after +\n", foo1->getTime(status),
+          foo1->get(UCAL_YEAR, status),
+          foo1->get(UCAL_MONTH, status),
+          foo1->get(UCAL_DATE, status),
+          foo1->get(UCAL_HOUR, status),
+          foo1->get(UCAL_MINUTE, status),
+          foo1->get(UCAL_SECOND, status),
+          foo1->get(UCAL_MILLISECOND ,status));
+    foo1->add(UCAL_DATE, - 1, status);
+    logln("foo1@%.0f - %d-%d-%d %d:%d:%d.%ds after -\n", foo1->getTime(status),
+          foo1->get(UCAL_YEAR, status),
+          foo1->get(UCAL_MONTH, status),
+          foo1->get(UCAL_DATE, status),
+          foo1->get(UCAL_HOUR, status),
+          foo1->get(UCAL_MINUTE, status),
+          foo1->get(UCAL_SECOND, status),
+          foo1->get(UCAL_MILLISECOND, status));
+
     foo1->add(UCAL_DATE, + 1, status);
     int32_t testyear = foo1->get(UCAL_YEAR, status);
     int32_t testmonth = foo1->get(UCAL_MONTH, status);
@@ -947,7 +974,6 @@
             testCal->add(UCAL_DATE, 1,status);
         }
     }
-
     // Test field disambiguation with a few special hard-coded cases.
     // This shouldn't fail if the above cases aren't failing.
     int32_t DISAM_int [] = {
@@ -1008,7 +1034,10 @@
                          "-DOW" + dow + " expect:" + sdf.format(exp, str) +
                          " got:" + sdf.format(got, str2));
         if (got != exp) {
-            log("  FAIL");
+            log("  FAIL (%s:%d, i=%d)", __FILE__, __LINE__, i);
+            logln(CalendarTest::calToStr(*testCal));
+            testCal->setTime(exp, status);
+            logln(CalendarTest::calToStr(*testCal) + UnicodeString( " <<< expected "));
             fail = TRUE;
         }
         logln("");
@@ -1029,7 +1058,6 @@
         }
         logln("");
     }
-
     // Now try adding and rolling
     UDate ADDROLL_date [] = {
         makeDate(1998, UCAL_DECEMBER, 25), makeDate(1999, UCAL_JANUARY, 1),
@@ -1068,9 +1096,14 @@
         UDate got = testCal->getTime(status);
         str.remove();
         str2.remove();
-        log((ADDROLL_bool[i/2]? UnicodeString("add(WOY,"):UnicodeString("roll(WOY,")) +
-                         amount + ") " + sdf.format(before, str) + " => " +
-                         sdf.format(got, str2));
+        UnicodeString opTypeStr;
+        if (ADDROLL_bool[i/2]) {
+            opTypeStr = UnicodeString("add(WOY,", "");
+        } else {
+            opTypeStr = UnicodeString("roll(WOY,", "");
+        }
+        log(opTypeStr + amount + ") " + sdf.format(before, str) + " => " +
+                    sdf.format(got, str2));
         if (after != got) {
             str.remove();
             logln(UnicodeString("  exp:") + sdf.format(after, str) + "  FAIL");
@@ -1086,9 +1119,8 @@
         got = testCal->getTime(status);
         str.remove();
         str2.remove();
-        log((ADDROLL_bool[i/2]?UnicodeString("add(WOY,"):UnicodeString("roll(WOY,")) +
-                         (-amount) + ") " + sdf.format(after, str) + " => " +
-                         sdf.format(got, str2));
+        log(opTypeStr + (-amount) + ") " + sdf.format(after, str) + " => " +
+                sdf.format(got, str2));
         if (before != got) {
             str.remove();
             logln(UnicodeString("  exp:") + sdf.format(before, str) + "  FAIL");
@@ -1096,7 +1128,6 @@
         }
         else logln(" ok");
     }
-
     if (fail) 
         errln("Fail: Week of year misbehaving");
 } 
@@ -1279,7 +1310,7 @@
     }
 
     delete cal;
-    cal = Calendar::createInstance(Locale("th_TH_TRADITIONAL"),status);
+    cal = Calendar::createInstance(Locale("th_TH@calendar=buddhist"),status);
     // test deprecated functions
     if (cal->getLeastMaximum(Calendar::HOUR) != 11 ||
         cal->getMaximum(Calendar::HOUR) != 11) {
@@ -1293,7 +1324,7 @@
 
     delete cal;
     // test deprecated functions
-    cal = Calendar::createInstance(Locale("ja_JP_TRADITIONAL"),status);
+    cal = Calendar::createInstance(Locale("ja_JP@calendar=japanese"),status);
     if (cal->getLeastMaximum(Calendar::HOUR) != 11 ||
         cal->getMaximum(Calendar::HOUR) != 11) {
         errln("Fail: Japanese:[deprecated functions] maximum of HOUR field should be 11\n");
@@ -1726,19 +1757,19 @@
     }
     calendar->set(1998, UCAL_MARCH, 1);
     calendar->setMinimalDaysInFirstWeek(1);
-    logln(UnicodeString("Date:  ") + calendar->getTime(status));
-
+    logln(UnicodeString("Date:  ") + calendar->getTime(status)); // 888817448000
+    
     int32_t firstInMonth = calendar->get(UCAL_DATE, status);
     if(U_FAILURE(status))
         errln("get(D_O_M) failed");
 
     for(int32_t firstInWeek = UCAL_SUNDAY; firstInWeek <= UCAL_SATURDAY; firstInWeek++) {
         calendar->setFirstDayOfWeek((UCalendarDaysOfWeek)firstInWeek);
-        int32_t returned = calendar->getActualMaximum(field);
+        int32_t returned = calendar->getActualMaximum(field, status);
         int32_t expected = (31 + ((firstInMonth - firstInWeek + 7)% 7) + 6) / 7;
 
         logln(UnicodeString("First day of week = ") + firstInWeek +
-              "  getActualMaximum(WEEK_OF_MONTH) = " + returned +
+              "  getActualMaximum(WEEK_OF_MONTH, status) = " + returned +
               "  expected = " + expected +
               ((returned == expected) ? "  ok" : "  FAIL"));
 
@@ -1802,7 +1833,7 @@
             if(U_FAILURE(status))
                 errln("getTime() failed");
 
-            int32_t maxYear = calendar->getActualMaximum(field);
+            int32_t maxYear = calendar->getActualMaximum(field, status);
             UnicodeString temp;
             logln(UnicodeString("maxYear: ") + maxYear + " for " + format->format(calendar->getTime(status), temp));
             temp.remove();
@@ -1924,8 +1955,10 @@
     fmt.setCalendar(cal);
     // Get the Gregorian cutover
     UDate cutover = cal.getGregorianChange();
+    UDate days = ONE_DAY;
+    days = cutover/days;
     logln(UnicodeString("Cutover: {") +
-          fmt.format(cutover, temp) + "}(" + cutover/ONE_DAY + ")");
+          fmt.format(cutover, temp) + "}(epoch days-" + (int)days + ", jd" + (2440588 + days) +")");
 
     // Check woy and doy handling.  Reference data:
     /* w40 d274 Mon 1 Oct 1582
@@ -1966,22 +1999,31 @@
         31, 43, 294, UCAL_SUNDAY
     };
     int32_t DOY_DATA_length = (int32_t)(sizeof(DOY_DATA) / sizeof(DOY_DATA[0]));
+
     for (i=0; i<DOY_DATA_length; i+=4) {
         // Test time->fields
         cal.set(1582, UCAL_OCTOBER, DOY_DATA[i]);
         int32_t woy = cal.get(UCAL_WEEK_OF_YEAR, status);
         int32_t doy = cal.get(UCAL_DAY_OF_YEAR, status);
+        int32_t dow = cal.get(UCAL_DAY_OF_WEEK, status);
         if (U_FAILURE(status)) {
             errln("Error: get() failed");
             break;
         }
-        if (woy != DOY_DATA[i+1] || doy != DOY_DATA[i+2]) {
+        if (woy != DOY_DATA[i+1] || doy != DOY_DATA[i+2] || dow != DOY_DATA[i+3]) {
             errln((UnicodeString)"Fail: expect woy=" + DOY_DATA[i+1] +
-                  ", doy=" + DOY_DATA[i+2] + " on " +
-                  fmt.format(cal.getTime(status), temp.remove()));
+                  ", doy=" + DOY_DATA[i+2] + ", dow=" + DOY_DATA[i+3] + " on " +
+                  fmt.format(cal.getTime(status), temp.remove()) +
+                  " set(1582,OCTOBER, " + DOY_DATA[i] + ")");
+            logln(CalendarTest::calToStr(cal));
             status = U_ZERO_ERROR;
+        }  else {
+          logln((UnicodeString)"PASS: expect woy=" + DOY_DATA[i+1] +
+                ", doy=" + DOY_DATA[i+2] + ", dow=" + DOY_DATA[i+3] + " on " +
+                fmt.format(cal.getTime(status), temp.remove()));
+          logln(CalendarTest::calToStr(cal));
+          status = U_ZERO_ERROR;
         }
-
         // Test fields->time for WOY
         cal.clear();
         cal.set(UCAL_YEAR, 1582);
@@ -1997,6 +2039,7 @@
                   " dow=" + DOY_DATA[i+3] + " => " +
                   fmt.format(cal.getTime(status), temp.remove()) +
                   ", expected 1582 Oct " + DOY_DATA[i]);
+            logln(CalendarTest::calToStr(cal));
             status = U_ZERO_ERROR;
         }
 
@@ -2467,7 +2510,7 @@
 void CalendarRegressionTest::TestDeprecates(void)
 {
     UErrorCode status = U_ZERO_ERROR;
-    Calendar *c1 = Calendar::createInstance("ja_JP_TRADITIONAL",status);
+    Calendar *c1 = Calendar::createInstance("ja_JP@calendar=japanese",status);
     Calendar *c2 = Calendar::createInstance("ja_JP_TRADITIONAL",status);
 
     if(!c1 || !c2 || U_FAILURE(status)) {
@@ -2504,7 +2547,7 @@
     status = U_ZERO_ERROR;
 
     c1 = Calendar::createInstance("th_TH_TRADITIONAL",status);
-    c2 = Calendar::createInstance("th_TH_TRADITIONAL",status);
+    c2 = Calendar::createInstance("th_TH@calendar=buddhist",status);
 
     if(!c1 || !c2 || U_FAILURE(status)) {
         errln("Couldn't create calendars for add of HOUR");

Index: caltest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/caltest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- caltest.cpp	10 Sep 2003 02:42:42 -0000	1.3
+++ caltest.cpp	6 Apr 2004 10:09:36 -0000	1.4
@@ -17,17 +17,29 @@
 // class CalendarTest
 // *****************************************************************************
 
-static UnicodeString fieldName(UCalendarDateFields f);
-
-static UnicodeString calToStr(const Calendar & cal)
+UnicodeString CalendarTest::calToStr(const Calendar & cal)
 {
   UnicodeString out;
   UErrorCode status = U_ZERO_ERROR;
   int i;
+  UDate d;
   for(i = 0;i<UCAL_FIELD_COUNT;i++) {
-    out += (UnicodeString("+") + fieldName((UCalendarDateFields)i) + "=" +  cal.get((UCalendarDateFields)i, status) + UnicodeString(", "));
+    out += (UnicodeString("") + fieldName((UCalendarDateFields)i) + "=" +  cal.get((UCalendarDateFields)i, status) + UnicodeString(" "));
   }
-
+  out += "[" + UnicodeString(cal.getType()) + "]";
+  
+  if(cal.inDaylightTime(status)) {
+    out += UnicodeString(" (in DST), zone=");
+  }
+  else {
+    out += UnicodeString(", zone=");
+  }
+  
+  UnicodeString str2;
+  out += cal.getTimeZone().getDisplayName(str2);
+  d = cal.getTime(status);
+  out += UnicodeString(" :","") + d;
+  
   return out;
 }
 
@@ -168,34 +180,53 @@
                 TestRog();
             }
             break;
+        case 19:
+           name = "TestYWOY";
+            if (exec) {
+                logln("TestYWOY---"); logln("");
+                TestYWOY();
+            }
+            break;
+        case 20:
+          name = "TestJD";
+          if(exec) {
+            logln("TestJD---"); logln("");
+            TestJD();
+          }
+          break;
+           
         default: name = ""; break;
     }
 }
 
 // ---------------------------------------------------------------------------------
 
-static UnicodeString fieldName(UCalendarDateFields f) {
+UnicodeString CalendarTest::fieldName(UCalendarDateFields f) {
     switch (f) {
-    case UCAL_ERA:           return "ERA";
-    case UCAL_YEAR:          return "YEAR";
-    case UCAL_MONTH:         return "MONTH";
-    case UCAL_WEEK_OF_YEAR:  return "WEEK_OF_YEAR";
-    case UCAL_WEEK_OF_MONTH: return "WEEK_OF_MONTH";
-    case UCAL_DATE:			 return "DAY_OF_MONTH"; // DATE is synonym for DAY_OF_MONTH
-    case UCAL_DAY_OF_YEAR:   return "DAY_OF_YEAR";
-    case UCAL_DAY_OF_WEEK:   return "DAY_OF_WEEK";
-    case UCAL_DAY_OF_WEEK_IN_MONTH: return "DAY_OF_WEEK_IN_MONTH";
-    case UCAL_AM_PM:         return "AM_PM";
-    case UCAL_HOUR:          return "HOUR";
-    case UCAL_HOUR_OF_DAY:   return "HOUR_OF_DAY";
-    case UCAL_MINUTE:        return "MINUTE";
-    case UCAL_SECOND:        return "SECOND";
-    case UCAL_MILLISECOND:   return "MILLISECOND";
-    case UCAL_ZONE_OFFSET:   return "ZONE_OFFSET";
-    case UCAL_DST_OFFSET:    return "DST_OFFSET";
-    case UCAL_YEAR_WOY:      return "YEAR_WOY";
-    case UCAL_DOW_LOCAL:     return "DOW_LOCAL";
-    case UCAL_FIELD_COUNT:   return "FIELD_COUNT";
+#define FIELD_NAME_STR(x) case x: return (#x+5)
+      FIELD_NAME_STR( UCAL_ERA );
+      FIELD_NAME_STR( UCAL_YEAR );
+      FIELD_NAME_STR( UCAL_MONTH );
+      FIELD_NAME_STR( UCAL_WEEK_OF_YEAR );
+      FIELD_NAME_STR( UCAL_WEEK_OF_MONTH );
+      FIELD_NAME_STR( UCAL_DATE );
+      FIELD_NAME_STR( UCAL_DAY_OF_YEAR );
+      FIELD_NAME_STR( UCAL_DAY_OF_WEEK );
+      FIELD_NAME_STR( UCAL_DAY_OF_WEEK_IN_MONTH );
+      FIELD_NAME_STR( UCAL_AM_PM );
+      FIELD_NAME_STR( UCAL_HOUR );
+      FIELD_NAME_STR( UCAL_HOUR_OF_DAY );
+      FIELD_NAME_STR( UCAL_MINUTE );
+      FIELD_NAME_STR( UCAL_SECOND );
+      FIELD_NAME_STR( UCAL_MILLISECOND );
+      FIELD_NAME_STR( UCAL_ZONE_OFFSET );
+      FIELD_NAME_STR( UCAL_DST_OFFSET );
+      FIELD_NAME_STR( UCAL_YEAR_WOY );
+      FIELD_NAME_STR( UCAL_DOW_LOCAL );
+      FIELD_NAME_STR( UCAL_EXTENDED_YEAR );
+      FIELD_NAME_STR( UCAL_JULIAN_DAY );
+      FIELD_NAME_STR( UCAL_MILLISECONDS_IN_DAY );
+#undef FIELD_NAME_STR
     default:
         return UnicodeString("") + ((int32_t)f);
     }
@@ -210,6 +241,7 @@
     UErrorCode status = U_ZERO_ERROR;
     UDate d;
     UnicodeString str;
+    UBool eq = FALSE,b4 = FALSE,af = FALSE;
 
     UDate when = date(90, UCAL_APRIL, 15);
 
@@ -235,19 +267,34 @@
         cal->after(*cal2, status) ||
         U_FAILURE(status)) errln("FAIL: equals/before/after failed");
 
+    logln(UnicodeString("cal=")  +cal->getTime(status)  + UnicodeString(calToStr(*cal)));
+    logln(UnicodeString("cal2=")  +cal2->getTime(status)  + UnicodeString(calToStr(*cal2)));
+    logln("cal2->setTime(when+1000)");
     cal2->setTime(when + 1000, status);
+    logln(UnicodeString("cal2=")  +cal2->getTime(status)  + UnicodeString(calToStr(*cal2)));
+
     if (failure(status, "Calendar::setTime")) return;
     if (cal->equals(*cal2, status) ||
         cal2->before(*cal, status) ||
         cal->after(*cal2, status) ||
-        U_FAILURE(status)) errln("FAIL: equals/before/after failed");
+        U_FAILURE(status)) errln("FAIL: equals/before/after failed after setTime(+1000)");
 
+    logln("cal1->roll(UCAL_SECOND)");
     cal->roll(UCAL_SECOND, (UBool) TRUE, status);
+    logln(UnicodeString("cal=")  +cal->getTime(status)  + UnicodeString(calToStr(*cal)));
+
     if (failure(status, "Calendar::roll")) return;
-    if (!cal->equals(*cal2, status) ||
-        cal->before(*cal2, status) ||
-        cal->after(*cal2, status) ||
-        U_FAILURE(status)) errln("FAIL: equals/before/after failed");
+    if (!(eq=cal->equals(*cal2, status)) ||
+        (b4=cal->before(*cal2, status)) ||
+        (af=cal->after(*cal2, status)) ||
+        U_FAILURE(status)) {
+      errln("FAIL: equals[%c]/before[%c]/after[%c] failed after roll 1 second [should be T/F/F]",
+            eq?'T':'F',
+            b4?'T':'F',
+            af?'T':'F');
+      logln(UnicodeString("cal=")  +cal->getTime(status)  + UnicodeString(calToStr(*cal)));
+      logln(UnicodeString("cal2=")  +cal2->getTime(status)  + UnicodeString(calToStr(*cal2)));
+    }
 
     // Roll back to January
     cal->roll(UCAL_MONTH, (int32_t)(1 + UCAL_DECEMBER - cal->get(UCAL_MONTH, status)), status);
@@ -255,7 +302,7 @@
     if (cal->equals(*cal2, status) ||
         cal2->before(*cal, status) ||
         cal->after(*cal2, status) ||
-        U_FAILURE(status)) errln("FAIL: equals/before/after failed");
+        U_FAILURE(status)) errln("FAIL: equals/before/after failed after rollback to January");
 
     TimeZone *z = cal->orphanTimeZone();
     if (z->getID(str) != tzid ||
@@ -318,13 +365,14 @@
         switch(i) {
             case UCAL_YEAR: case UCAL_MONTH: case UCAL_DATE:
             case UCAL_HOUR_OF_DAY: case UCAL_MINUTE: case UCAL_SECOND:
-                if (!cal->isSet((UCalendarDateFields)i)) errln("FAIL: Calendar::isSet failed");
+            case UCAL_EXTENDED_YEAR:
+              if (!cal->isSet((UCalendarDateFields)i)) errln("FAIL: Calendar::isSet F, should be T " + fieldName((UCalendarDateFields)i));
                 break;
             default:
-                if (cal->isSet((UCalendarDateFields)i)) errln("FAIL: Calendar::isSet failed");
+              if (cal->isSet((UCalendarDateFields)i)) errln("FAIL: Calendar::isSet = T, should be F  " + fieldName((UCalendarDateFields)i));
         }
         cal->clear((UCalendarDateFields)i);
-        if (cal->isSet((UCalendarDateFields)i)) errln("FAIL: Calendar::clear/isSet failed");
+        if (cal->isSet((UCalendarDateFields)i)) errln("FAIL: Calendar::clear/isSet failed " + fieldName((UCalendarDateFields)i));
     }
 
     delete cal;
@@ -438,18 +486,22 @@
     UErrorCode status = U_ZERO_ERROR;
     GregorianCalendar* cal = new GregorianCalendar(status);
     if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; }
+    logln("cal - Aug 12, 1997\n");
     cal->set(1997, UCAL_AUGUST, 12);
     cal->getTime(status);
     if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; }
+    logln((lenient?UnicodeString("LENIENT0: "):UnicodeString("nonlenient0: ")) + UnicodeString(calToStr(*cal)));
     cal->setLenient(lenient);
+    logln("cal - Dec 1, 1996\n");
     cal->set(1996, UCAL_DECEMBER, 1);
+    logln((lenient?UnicodeString("LENIENT: "):UnicodeString("nonlenient: ")) + UnicodeString(calToStr(*cal)));
     int32_t dow = cal->get(UCAL_DAY_OF_WEEK, status);
-    if (U_FAILURE(status)) { errln("Calendar::get failed"); return; }
+    if (U_FAILURE(status)) { errln("Calendar::get failed [%s]", u_errorName(status)); return; }
     int32_t min = cal->getMinimum(UCAL_DAY_OF_WEEK);
     int32_t max = cal->getMaximum(UCAL_DAY_OF_WEEK);
     if (dow < min ||
         dow > max) errln(UnicodeString("FAIL: Day of week ") + (int32_t)dow + " out of range");
-    if (dow != UCAL_SUNDAY) errln("FAIL: Day of week should be SUNDAY");
+    if (dow != UCAL_SUNDAY) errln("FAIL: Day of week should be SUNDAY[%d] not %d", UCAL_SUNDAY, dow);
     if (min != UCAL_SUNDAY ||
         max != UCAL_SATURDAY) errln("FAIL: Min/max bad");
     delete cal;
@@ -857,12 +909,19 @@
         int32_t limit = maxlimit;
         status = U_ZERO_ERROR;
         for (i = 0; i < limit; i++) {
+            logln(calToStr(*temp) + UnicodeString("  " ) + fieldName(e) + UnicodeString("++") );
             temp->roll(e, 1, status);
-            if (U_FAILURE(status)) { limit = i; status = U_ZERO_ERROR; }
+            if (U_FAILURE(status)) { 
+              logln("caltest.cpp:%d e=%d, i=%d - roll(+) err %s\n",  __LINE__, (int) e, (int) i, u_errorName(status));
+              logln(calToStr(*temp));
+              limit = i; status = U_ZERO_ERROR; 
+            }
         }
         for (i = 0; i < limit; i++) {
+            logln("caltest.cpp:%d e=%d, i=%d\n",  __LINE__, (int) e, (int) i);
+            logln(calToStr(*temp) + UnicodeString("  " ) + fieldName(e) + UnicodeString("--") );
             temp->roll(e, -1, status);
-            if (U_FAILURE(status)) { errln("GregorianCalendar::roll -1 failed"); return; }
+            if (U_FAILURE(status)) { errln(UnicodeString("GregorianCalendar::roll ") + CalendarTest::fieldName(e) + " count=" + UnicodeString('@'+i) + " by -1 failed with " + u_errorName(status) ); return; }
         }
         check520(temp, y, m, d, hr, min, sec, ms, e);
 
@@ -1234,6 +1293,7 @@
     yearAddTest(*cal, status); // aliu
     loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status);
     if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1997"); return; }
+
     cal->clear();
     cal->set(1998, UCAL_DECEMBER, 25);
     doYEAR_WOYLoop(cal, sdf, times, status);
@@ -1241,6 +1301,7 @@
     yearAddTest(*cal, status); // aliu
     loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status);
     if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1998"); return; }
+
     cal->clear();
     cal->set(1582, UCAL_OCTOBER, 1);
     doYEAR_WOYLoop(cal, sdf, times, status);
@@ -1248,7 +1309,6 @@
     yearAddTest(*cal, status); // aliu
     loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status);
     if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1582"); return; }
-
     delete sdf;
     delete cal;
 
@@ -1294,6 +1354,7 @@
         str += (UnicodeString)", expected year " +
             (y+1) + ", month " + (mon+1) + ", day " + day;
         errln((UnicodeString)"FAIL: " + str);
+        logln( UnicodeString(" -> ") + CalendarTest::calToStr(cal) );
     } else {
         logln(str);
     }
@@ -1301,6 +1362,7 @@
     fmt.format(t, str.remove());
     str += ".add(YEAR_WOY, 1)=>";
     cal.setTime(t, status);
+    logln( UnicodeString(" <- ") + CalendarTest::calToStr(cal) );
     cal.add(UCAL_YEAR_WOY, 1, status);
     int32_t ywy2 = cal.get(UCAL_YEAR_WOY, status);
     int32_t woy2 = cal.get(UCAL_WEEK_OF_YEAR, status);
@@ -1310,6 +1372,7 @@
         str += (UnicodeString)", expected yearWOY " +
             (ywy+1) + ", woy " + woy + ", dowLocal " + dow;
         errln((UnicodeString)"FAIL: " + str);
+        logln( UnicodeString(" -> ") + CalendarTest::calToStr(cal) );
     } else {
         logln(str);
     }
@@ -1386,28 +1449,29 @@
         if(original!=tst) {
             us.remove();
             sdf->format(Formattable(original, Formattable::kIsDate), us, errorCode);
-            errln("Parsed time doesn't match with regular");
-            logln("expected "+us);
+            errln("FAIL: Parsed time doesn't match with regular");
+            logln("expected "+us + " " + calToStr(*cal));
             us.remove();
             sdf->format(Formattable(tst, Formattable::kIsDate), us, errorCode);
-            logln("got "+us);
+            logln("got "+us + " " + calToStr(*tstres));
         }
         tstres->clear();
         tstres->set(UCAL_YEAR_WOY, cal->get(UCAL_YEAR_WOY, errorCode));
         tstres->set(UCAL_WEEK_OF_YEAR, cal->get(UCAL_WEEK_OF_YEAR, errorCode));
         tstres->set(UCAL_DOW_LOCAL, cal->get(UCAL_DOW_LOCAL, errorCode));
         if(cal->get(UCAL_YEAR, errorCode) != tstres->get(UCAL_YEAR, errorCode)) {
-            errln("Different Year!");
+            errln("FAIL: Different Year!");
             logln((UnicodeString)"Expected "+cal->get(UCAL_YEAR, errorCode));
             logln((UnicodeString)"Got "+tstres->get(UCAL_YEAR, errorCode));
             return;
         }
         if(cal->get(UCAL_DAY_OF_YEAR, errorCode) != tstres->get(UCAL_DAY_OF_YEAR, errorCode)) {
-            errln("Different Day Of Year!");
+            errln("FAIL: Different Day Of Year!");
             logln((UnicodeString)"Expected "+cal->get(UCAL_DAY_OF_YEAR, errorCode));
             logln((UnicodeString)"Got "+tstres->get(UCAL_DAY_OF_YEAR, errorCode));
             return;
         }
+        //logln(calToStr(*cal));
         cal->add(UCAL_DATE, 1, errorCode);
         if (U_FAILURE(errorCode)) { errln("Add error"); return; }
         us.remove();
@@ -1489,7 +1553,7 @@
          Sun Jan 09 2000, WOY 2
          Mon Jan 10 2000, WOY 3
     */
-
+ 
     UnicodeString str;
     UErrorCode status = U_ZERO_ERROR;
     int32_t i;
@@ -1500,35 +1564,37 @@
 
     UCalendarDaysOfWeek fdw = (UCalendarDaysOfWeek) 0;
 
+    //for (int8_t pass=2; pass<=2; ++pass) {
     for (int8_t pass=1; pass<=2; ++pass) {
         switch (pass) {
         case 1:
             fdw = UCAL_MONDAY;
             cal.setFirstDayOfWeek(fdw);
             cal.setMinimalDaysInFirstWeek(4);
-            fmt.setCalendar(cal);
+            fmt.adoptCalendar(cal.clone());
             break;
         case 2:
             fdw = UCAL_MONDAY;
             cal.setFirstDayOfWeek(fdw);
             cal.setMinimalDaysInFirstWeek(2);
-            fmt.setCalendar(cal);
+            fmt.adoptCalendar(cal.clone());
             break;
         }
 
-    for (i=0; i<16; ++i) {
+        //for (i=2; i<=6; ++i) {
+        for (i=0; i<16; ++i) {
         UDate t, t2;
         int32_t t_y, t_woy, t_dow;
         cal.clear();
         cal.set(1999, UCAL_DECEMBER, 26 + i);
         fmt.format(t = cal.getTime(status), str.remove());
         CHECK(status, "Fail: getTime failed");
-        logln(str);
-
+        logln(UnicodeString("* ") + str);
         int32_t dow = cal.get(UCAL_DAY_OF_WEEK, status);
         int32_t woy = cal.get(UCAL_WEEK_OF_YEAR, status);
         int32_t year = cal.get(UCAL_YEAR, status);
         int32_t mon = cal.get(UCAL_MONTH, status);
+        logln(calToStr(cal));
         CHECK(status, "Fail: get failed");
         int32_t dowLocal = dow - fdw;
         if (dowLocal < 0) dowLocal += 7;
@@ -1555,6 +1621,11 @@
             str = "Fail: y/woy/dow fields->time => ";
             fmt.format(cal.getTime(status), str);
             errln(str);
+            logln(calToStr(cal));
+            logln("[get!=set] Y%d!=%d || woy%d!=%d || dow%d!=%d\n",
+                  t_y, year, t_woy, woy, t_dow, dow);
+        } else {
+          logln("y/woy/dow fields->time OK");
         }
 
         // Basic fields->time check y/woy/dow_local
@@ -1585,6 +1656,10 @@
             str = "Fail: y_woy/woy/dow fields->time => ";
             fmt.format(t2, str);
             errln(str);
+            logln(calToStr(cal));
+            logln("%.f != %.f\n", t, t2);
+        } else {
+          logln("y_woy/woy/dow OK");
         }
 
         // Basic fields->time check y_woy/woy/dow_local
@@ -1600,6 +1675,7 @@
             errln(str);
         }
 
+        logln("Testing DOW_LOCAL.. dow%d\n", dow);
         // Make sure DOW_LOCAL disambiguates over DOW
         int32_t wrongDow = dow - 3;
         if (wrongDow < 1) wrongDow += 7;
@@ -1612,6 +1688,9 @@
             str = "Fail: DOW_LOCAL fields->time => ";
             fmt.format(t2, str);
             errln(str);
+            logln(calToStr(cal));
+            logln("%.f :   DOW%d, DOW_LOCAL%d -> %.f\n",
+                  t, wrongDow, dowLocal, t2);
         }
 
         // Make sure DOW disambiguates over DOW_LOCAL
@@ -1700,7 +1779,151 @@
     }
 }
 
+void CalendarTest::TestYWOY()
+{
+   UnicodeString str;
+   UErrorCode status = U_ZERO_ERROR;
+   
+   GregorianCalendar cal(status);
+   CHECK(status, "Fail: Cannot construct calendar/format");
+
+   cal.setFirstDayOfWeek(UCAL_SUNDAY);
+   cal.setMinimalDaysInFirstWeek(1);
+
+   logln("Setting:  ywoy=2004, woy=1, dow=MONDAY");
+   cal.clear();
+   cal.set(UCAL_YEAR_WOY,2004);
+   cal.set(UCAL_WEEK_OF_YEAR,1);
+   cal.set(UCAL_DAY_OF_WEEK, UCAL_MONDAY);
+   
+   logln(calToStr(cal));
+   if(cal.get(UCAL_YEAR, status) != 2003) {
+     errln("year not 2003");
+   }
+
+   logln("+ setting DOW to THURSDAY");
+   cal.clear();
+   cal.set(UCAL_YEAR_WOY,2004);
+   cal.set(UCAL_WEEK_OF_YEAR,1);
+   cal.set(UCAL_DAY_OF_WEEK, UCAL_THURSDAY);
+   
+   logln(calToStr(cal));
+   if(cal.get(UCAL_YEAR, status) != 2004) {
+     errln("year not 2004");
+   }
+
+   logln("+ setting DOW_LOCAL to 1");
+   cal.clear();
+   cal.set(UCAL_YEAR_WOY,2004);
+   cal.set(UCAL_WEEK_OF_YEAR,1);
+   cal.set(UCAL_DAY_OF_WEEK, UCAL_THURSDAY);
+   cal.set(UCAL_DOW_LOCAL, 1);
+   
+   logln(calToStr(cal));
+   if(cal.get(UCAL_YEAR, status) != 2003) {
+     errln("year not 2003");
+   }
+
+   cal.setFirstDayOfWeek(UCAL_MONDAY);
+   cal.setMinimalDaysInFirstWeek(4);
+   UDate t = 946713600000.;
+   cal.setTime(t, status);
+   cal.set(UCAL_DAY_OF_WEEK, 4);
+   cal.set(UCAL_DOW_LOCAL, 6);
+   if(cal.getTime(status) != t) {
+     logln(calToStr(cal));
+     errln("FAIL:  DOW_LOCAL did not take precedence");
+   }
+
+}
+
+void CalendarTest::TestJD()
+{
+  int32_t jd;
+  static const int32_t kEpochStartAsJulianDay = 2440588;
+  UErrorCode status = U_ZERO_ERROR;
+  GregorianCalendar cal(status);
+  cal.setTimeZone(*TimeZone::getGMT());
+  cal.clear();
+  jd = cal.get(UCAL_JULIAN_DAY, status);
+  if(jd != kEpochStartAsJulianDay) {
+    errln("Wanted JD of %d at time=0, [epoch 1970] but got %d\n", kEpochStartAsJulianDay, jd);
+  } else {
+    logln("Wanted JD of %d at time=0, [epoch 1970], got %d\n", kEpochStartAsJulianDay, jd);
+  }
+  
+  cal.setTime(Calendar::getNow(), status);
+  cal.clear();
+  cal.set(UCAL_JULIAN_DAY, kEpochStartAsJulianDay);
+  UDate epochTime = cal.getTime(status);
+  if(epochTime != 0) {
+    errln("Wanted time of 0 at jd=%d, got %.1lf\n", kEpochStartAsJulianDay, epochTime);
+  } else {
+    logln("Wanted time of 0 at jd=%d, got %.1lf\n", kEpochStartAsJulianDay, epochTime);
+  }
+
+}
+
 #undef CHECK
+
+// List of interesting locales
+const char *CalendarTest::testLocaleID(int32_t i)
+{
+  switch(i) {
+  case 0: return "he_IL@calendar=hebrew";
+  case 1: return "en_US@calendar=hebrew";
+  case 2: return "fr_FR@calendar=hebrew";
+  case 3: return "fi_FI@calendar=hebrew";
+  case 4: return "nl_NL@calendar=hebrew";
+  case 5: return "hu_HU@calendar=hebrew";
+  case 6: return "nl_BE@currency=MTL;calendar=islamic";
+  case 7: return "th_TH_TRADITIONAL@calendar=gregorian";
+  case 8: return "ar_JO@calendar=islamic-civil";
+  case 9: return "fi_FI@calendar=islamic";
+  case 10: return "fr_CH@calendar=islamic-civil";
+  case 11: return "he_IL@calendar=islamic-civil";
+  case 12: return "hu_HU@calendar=buddhist";
+  case 13: return "hu_HU@calendar=islamic";
+  case 14: return "en_US@calendar=japanese";
+  default: return NULL;
+  }
+}
+
+int32_t CalendarTest::testLocaleCount()
+{
+  static int32_t gLocaleCount = -1;
+  if(gLocaleCount < 0) {
+    int32_t i;
+    for(i=0;testLocaleID(i) != NULL;i++) {
+      ;
+    }
+    gLocaleCount = i;
+  }
+  return gLocaleCount;
+}
+
+static UDate doMinDateOfCalendar(Calendar* adopt, UBool &isGregorian, UErrorCode& status) {
+  if(U_FAILURE(status)) return 0.0;
+  
+  adopt->clear();
+  adopt->set(UCAL_EXTENDED_YEAR, adopt->getActualMinimum(UCAL_EXTENDED_YEAR, status));
+  UDate ret = adopt->getTime(status);
+  isGregorian = (adopt->getDynamicClassID() == GregorianCalendar::getStaticClassID());
+  delete adopt;
+  return ret;
+}
+
+UDate CalendarTest::minDateOfCalendar(const Locale& locale, UBool &isGregorian, UErrorCode& status) {
+  if(U_FAILURE(status)) return 0.0;
+  return doMinDateOfCalendar(Calendar::createInstance(locale, status), isGregorian, status);
+}
+
+UDate CalendarTest::minDateOfCalendar(const Calendar& cal, UBool &isGregorian, UErrorCode& status) {
+  if(U_FAILURE(status)) return 0.0;
+  return doMinDateOfCalendar(cal.clone(), isGregorian, status);
+}
+
+
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
 

Index: caltest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/caltest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- caltest.h	10 Sep 2003 02:42:42 -0000	1.3
+++ caltest.h	6 Apr 2004 10:09:36 -0000	1.4
@@ -168,11 +168,54 @@
         int times, UCalendarDateFields field, UCalendarDateFields field2, 
         UErrorCode& errorCode);
 
+    void TestYWOY(void);
+    void TestJD(void);
+
     void yearAddTest(Calendar& cal, UErrorCode& status);
  
 public: // package
     // test subroutine use by TestDOWProgression
     virtual void marchByDelta(Calendar* cal, int32_t delta);
+
+ public:
+    // for other tests' use
+    static UnicodeString fieldName(UCalendarDateFields f);
+    static UnicodeString calToStr(const Calendar & cal);
+    
+    // List of non-installed locales with interesting calendars
+
+    /**
+     * @return the count of 'other' locales to test
+     */
+    static int32_t testLocaleCount();
+
+    /**
+     * @param i index of 'other' locale to return
+     * @return locale ID
+     */
+    static const char* testLocaleID(int32_t i);
+
+    /**
+     * Clone the specified calendar, and determine its earliest supported date
+     * by setting the extended year to the minimum value.
+     * @param cal Calendar (will be cloned)
+     * @param isGregorian output: returns 'TRUE' if the calendar's class is GregorianCalendar
+     * @param status error code 
+     */
+    static UDate minDateOfCalendar(const Calendar& cal, UBool &isGregorian, UErrorCode& status);
+
+    /**
+     * Construct a calendar of the specified locale, and determine its earliest supported date
+     * by setting the extended year to the minimum value.
+     * @param locale locale of calendar to check
+     * @param isGregorian output: returns 'TRUE' if the calendar's class is GregorianCalendar
+     * @param status error code 
+     */
+    static UDate minDateOfCalendar(const Locale& locale, UBool &isGregorian, UErrorCode& status);
+
+  // internal - for other test use
+ public:
+
 };
 
 #endif /* #if !UCONFIG_NO_FORMATTING */

Index: caltztst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/caltztst.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- caltztst.cpp	10 Sep 2003 02:42:42 -0000	1.3
+++ caltztst.cpp	6 Apr 2004 10:09:36 -0000	1.4
@@ -152,6 +152,25 @@
     return str;
 }
 
+UnicodeString&
+CalendarTimeZoneTest::dateToString(UDate d, UnicodeString& str,
+                                   const TimeZone& tz)
+{
+    str.remove();
+    DateFormat* format = getDateFormat();
+    if (format == 0)
+    {
+        str += "DATE_FORMAT_FAILURE";
+        return str;
+    }
+    TimeZone* save = format->getTimeZone().clone();
+    format->setTimeZone(tz);
+    format->format(d, str);
+    format->adoptTimeZone(save);
+    releaseDateFormat(format);
+    return str;
+}
+
 // Utility methods to create a date.  This is useful for converting Java constructs
 // which create a Date object.
 UDate

Index: caltztst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/caltztst.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- caltztst.h	10 Sep 2003 02:42:42 -0000	1.3
+++ caltztst.h	6 Apr 2004 10:09:36 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -33,6 +33,7 @@
     // Tries to mimic the Java Date.toString() format.
     UnicodeString  dateToString(UDate d);
     UnicodeString& dateToString(UDate d, UnicodeString& str);
+    UnicodeString& dateToString(UDate d, UnicodeString& str, const TimeZone& z);
 
     // Utility methods to create a date.  This is useful for converting Java constructs
     // which create a Date object.  Returns a Date in the current local time.

Index: canittst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/canittst.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- canittst.cpp	10 Sep 2003 02:42:42 -0000	1.1
+++ canittst.cpp	6 Apr 2004 10:09:36 -0000	1.2
@@ -16,7 +16,9 @@
 #include "cstring.h"
 #include "canittst.h"
 #include "unicode/caniter.h"
+#include "unicode/normlzr.h"
 #include "unicode/uchar.h"
+#include "hash.h"
 
 #define ARRAY_LENGTH(array) ((int32_t)(sizeof (array) / sizeof (*array)))
 

Index: canittst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/canittst.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- canittst.h	10 Sep 2003 02:42:42 -0000	1.1
+++ canittst.h	6 Apr 2004 10:09:36 -0000	1.2
@@ -26,7 +26,6 @@
 
 U_NAMESPACE_END
 
-#include "unicode/normlzr.h"
 #include "unicode/translit.h"
 #include "intltest.h"
 #include "hash.h"

Index: citrtest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/citrtest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- citrtest.cpp	10 Sep 2003 02:42:42 -0000	1.4
+++ citrtest.cpp	6 Apr 2004 10:09:36 -0000	1.5
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2002, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  * Modification History:
  *

Index: cntabcol.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/cntabcol.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cntabcol.cpp	10 Sep 2003 02:42:47 -0000	1.3
+++ cntabcol.cpp	6 Apr 2004 10:09:36 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved. 
  ********************************************************************/
 
@@ -15,7 +15,7 @@
 ContractionTableTest::ContractionTableTest() {
   status = U_ZERO_ERROR;
   /*testMapping = ucmpe32_open(0, 0, 0, &status);*/
-  testMapping = utrie_open(NULL, NULL, 0, 0, TRUE);
+  testMapping = utrie_open(NULL, NULL, 0, 0, 0, TRUE);
 }
 
 ContractionTableTest::~ContractionTableTest() {

Index: cpdtrtst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/cpdtrtst.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cpdtrtst.cpp	10 Sep 2003 02:42:47 -0000	1.4
+++ cpdtrtst.cpp	6 Apr 2004 10:09:37 -0000	1.5
@@ -12,15 +12,12 @@
 
 #if !UCONFIG_NO_TRANSLITERATION
 
-#include "ittrans.h"
 #include "cpdtrtst.h"
 #include "unicode/utypes.h"
 #include "unicode/translit.h"
+#include "unicode/uniset.h"
 #include "cpdtrans.h"
-#include "intltest.h"
 #include "cmemory.h"
-#include <string.h>
-#include <stdio.h>
 
 //---------------------------------------------
 // runIndexedTest
@@ -209,6 +206,23 @@
         ct5->getCount() == ct2->getCount() || ct5->getCount() == ct3->getCount()  ) {
         errln("Error: getCount() failed");
     }
+
+    /* Quick test getTargetSet(), only test that it doesn't die.  TODO:  a better test. */
+    UnicodeSet ts;
+    UnicodeSet *retUS = NULL;
+    retUS = &ct1->getTargetSet(ts);
+    if (retUS != &ts || ts.size() == 0) {
+        errln("CompoundTransliterator::getTargetSet() failed.\n");
+    }
+
+    /* Quick test getSourceSet(), only test that it doesn't die.  TODO:  a better test. */
+    UnicodeSet ss;
+    retUS = NULL;
+    retUS = &ct1->getSourceSet(ss);
+    if (retUS != &ss || ss.size() == 0) {
+        errln("CompoundTransliterator::getSourceSet() failed.\n");
+    }
+
     delete ct1;
     delete ct2;
     delete ct4;

Index: cpdtrtst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/cpdtrtst.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cpdtrtst.h	10 Sep 2003 02:42:47 -0000	1.3
+++ cpdtrtst.h	6 Apr 2004 10:09:37 -0000	1.4
@@ -18,7 +18,6 @@
 #if !UCONFIG_NO_TRANSLITERATION
 
 #include "unicode/translit.h"
-#include "cpdtrans.h"
 #include "intltest.h"
 
 /**

Index: datamap.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/datamap.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- datamap.cpp	10 Sep 2003 02:42:47 -0000	1.1
+++ datamap.cpp	6 Apr 2004 10:09:37 -0000	1.2
@@ -93,38 +93,96 @@
   ures_close(t);
 }
 
-
-const UnicodeString RBDataMap::getString(const char* key, UErrorCode &status) const
+const ResourceBundle *RBDataMap::getItem(const char* key, UErrorCode &status) const
 {
+  if(U_FAILURE(status)) {
+    return NULL;
+  }
+
   UnicodeString hashKey(key, "");
-  ResourceBundle *r = (ResourceBundle *)fData->get(hashKey);
+  const ResourceBundle *r = (ResourceBundle *)fData->get(hashKey);
   if(r != NULL) {
+    return r;
+  } else {
+    status = U_MISSING_RESOURCE_ERROR;
+    return NULL;
+  }
+}
+
+const UnicodeString RBDataMap::getString(const char* key, UErrorCode &status) const
+{
+  const ResourceBundle *r = getItem(key, status);
+  if(U_SUCCESS(status)) {
     return r->getString(status);
   } else {
     status = U_MISSING_RESOURCE_ERROR;
-    return UnicodeString("", "");
+    return UnicodeString();
   }
 }
 
+int32_t
+RBDataMap::getInt28(const char* key, UErrorCode &status) const
+{
+  const ResourceBundle *r = getItem(key, status);
+  if(U_SUCCESS(status)) {
+    return r->getInt(status);
+  } else {
+    return 0;
+  }
+}
+
+uint32_t
+RBDataMap::getUInt28(const char* key, UErrorCode &status) const
+{
+  const ResourceBundle *r = getItem(key, status);
+  if(U_SUCCESS(status)) {
+    return r->getUInt(status);
+  } else {
+    return 0;
+  }
+}
+
+const int32_t *
+RBDataMap::getIntVector(int32_t &length, const char *key, UErrorCode &status) const {
+  const ResourceBundle *r = getItem(key, status);
+  if(U_SUCCESS(status)) {
+    return r->getIntVector(length, status);
+  } else {
+    return NULL;
+  }
+}
+
+const uint8_t *
+RBDataMap::getBinary(int32_t &length, const char *key, UErrorCode &status) const {
+  const ResourceBundle *r = getItem(key, status);
+  if(U_SUCCESS(status)) {
+    return r->getBinary(length, status);
+  } else {
+    return NULL;
+  }
+}
 
 int32_t RBDataMap::getInt(const char* key, UErrorCode &status) const
 {
-  int32_t result = 0;
   UnicodeString r = this->getString(key, status);
   if(U_SUCCESS(status)) {
-    result = utoi(r);
+    return utoi(r);
+  } else {
+    return 0;
   }
-  return result;
 }
 
 const UnicodeString* RBDataMap::getStringArray(int32_t& count, const char* key, UErrorCode &status) const 
 {
-  UnicodeString hashKey(key, "");
-  ResourceBundle *r = (ResourceBundle *)fData->get(hashKey);
-  if(r != NULL) {
+  const ResourceBundle *r = getItem(key, status);
+  if(U_SUCCESS(status)) {
     int32_t i = 0;
 
     count = r->getSize();
+    if(count <= 0) {
+      return NULL;
+    }
+
     UnicodeString *result = new UnicodeString[count];
     for(i = 0; i<count; i++) {
       result[i] = r->getStringEx(i, status);
@@ -138,12 +196,15 @@
 
 const int32_t* RBDataMap::getIntArray(int32_t& count, const char* key, UErrorCode &status) const
 {
-  UnicodeString hashKey(key, "");
-  ResourceBundle *r = (ResourceBundle *)fData->get(hashKey);
-  if(r != NULL) {
+  const ResourceBundle *r = getItem(key, status);
+  if(U_SUCCESS(status)) {
     int32_t i = 0;
 
     count = r->getSize();
+    if(count <= 0) {
+      return NULL;
+    }
+
     int32_t *result = new int32_t[count];
     UnicodeString stringRes;
     for(i = 0; i<count; i++) {
@@ -156,5 +217,3 @@
     return NULL;
   }
 }
-
-

Index: datamap.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/datamap.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- datamap.h	10 Sep 2003 02:42:47 -0000	1.1
+++ datamap.h	6 Apr 2004 10:09:37 -0000	1.2
@@ -11,6 +11,7 @@
 
 #include "hash.h"
 #include "unicode/ures.h"
+#include "unicode/resbund.h"
 
 /** Holder of test data and settings. Allows addressing of items by name.
  *  For test cases, names are defined in the "Headers" section. For settings
@@ -35,20 +36,55 @@
   virtual const UnicodeString getString(const char* key, UErrorCode &status) const = 0;
 
   /** get the string from the DataMap. Addressed by name
+   *  parses a bundle string into an integer
    *  @param key name of the data field.
    *  @return an integer containing the data
    */
   virtual int32_t getInt(const char* key, UErrorCode &status) const = 0;
-  
+
+  /**
+   * Get a signed integer without runtime parsing.
+   * @param key name of the data field.
+   * @param status UErrorCode in/out parameter
+   * @return the integer
+   */
+  virtual int32_t getInt28(const char* key, UErrorCode &status) const = 0;
+
+  /**
+   * Get an unsigned integer without runtime parsing.
+   * @param key name of the data field.
+   * @param status UErrorCode in/out parameter
+   * @return the integer
+   */
+  virtual uint32_t getUInt28(const char* key, UErrorCode &status) const = 0;
+
+  /**
+   * Get a vector of integers without runtime parsing.
+   * @param length output parameter for the length of the vector
+   * @param key name of the data field.
+   * @param status UErrorCode in/out parameter
+   * @return the integer vector, do not delete
+   */
+  virtual const int32_t *getIntVector(int32_t &length, const char *key, UErrorCode &status) const = 0;
+
+  /**
+   * Get binary data without runtime parsing.
+   * @param length output parameter for the length of the data
+   * @param key name of the data field.
+   * @param status UErrorCode in/out parameter
+   * @return the binary data, do not delete
+   */
+  virtual const uint8_t *getBinary(int32_t &length, const char *key, UErrorCode &status) const = 0;
+
   /** get an array of strings from the DataMap. Addressed by name.
-   *  The user must dispose of it after usage.
+   *  The user must dispose of it after usage, using delete.
    *  @param key name of the data field.
    *  @return a string array containing the data
    */
   virtual const UnicodeString* getStringArray(int32_t& count, const char* key, UErrorCode &status) const = 0;
 
   /** get an array of integers from the DataMap. Addressed by name.
-   *  The user must dispose of it after usage.
+   *  The user must dispose of it after usage, using delete.
    *  @param key name of the data field.
    *  @return an integer array containing the data
    */
@@ -75,8 +111,15 @@
 public:
   void init(UResourceBundle *data, UErrorCode &status);
   void init(UResourceBundle *headers, UResourceBundle *data, UErrorCode &status);
-  
+
+  virtual const ResourceBundle *getItem(const char* key, UErrorCode &status) const;
+
   virtual const UnicodeString getString(const char* key, UErrorCode &status) const;
+  virtual int32_t getInt28(const char* key, UErrorCode &status) const;
+  virtual uint32_t getUInt28(const char* key, UErrorCode &status) const;
+  virtual const int32_t *getIntVector(int32_t &length, const char *key, UErrorCode &status) const;
+  virtual const uint8_t *getBinary(int32_t &length, const char *key, UErrorCode &status) const;
+
   virtual int32_t getInt(const char* key, UErrorCode &status) const;
   
   virtual const UnicodeString* getStringArray(int32_t& count, const char* key, UErrorCode &status) const;

Index: dcfmapts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/dcfmapts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dcfmapts.cpp	10 Sep 2003 02:42:47 -0000	1.3
+++ dcfmapts.cpp	6 Apr 2004 10:09:37 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-1999, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 

Index: dtfmapts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/dtfmapts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dtfmapts.cpp	10 Sep 2003 02:42:47 -0000	1.3
+++ dtfmapts.cpp	6 Apr 2004 10:09:37 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 

Index: dtfmrgts.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/dtfmrgts.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dtfmrgts.h	10 Sep 2003 02:42:48 -0000	1.3
+++ dtfmrgts.h	6 Apr 2004 10:09:37 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 

Index: dtfmtrtts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/dtfmtrtts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dtfmtrtts.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ dtfmtrtts.cpp	6 Apr 2004 10:09:37 -0000	1.4
@@ -12,6 +12,7 @@
 #include "unicode/smpdtfmt.h"
 #include "unicode/gregocal.h"
 #include "dtfmtrtts.h"
+#include "caltest.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -38,13 +39,19 @@
 int32_t DateFormatRoundTripTest::TRIALS = 4;
 int32_t DateFormatRoundTripTest::DEPTH = 5;
 
+DateFormatRoundTripTest::DateFormatRoundTripTest() : dateFormat(0) {
+}
+
+DateFormatRoundTripTest::~DateFormatRoundTripTest() {
+    delete dateFormat;
+}
 
 #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break;
 
 void 
-DateFormatRoundTripTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
+DateFormatRoundTripTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
 {
-    // if (exec) logln((UnicodeString)"TestSuite NumberFormatRegressionTest");
+    optionv = (par && *par=='v');
     switch (index) {
         CASE(0,TestDateFormatRoundTrip)
         default: name = ""; break;
@@ -80,8 +87,6 @@
 void DateFormatRoundTripTest::TestDateFormatRoundTrip() 
 {
     UErrorCode status = U_ZERO_ERROR;
-    dateFormat = new SimpleDateFormat((UnicodeString)"EEE MMM dd HH:mm:ss.SSS zzz yyyy G", status);
-    failure(status, "new SimpleDateFormat");
 
     getFieldCal = Calendar::createInstance(status);
     failure(status, "Calendar::createInstance");
@@ -118,13 +123,24 @@
 # else
     test(Locale::getDefault());
 
+#if 1
+    // installed locales
     for (int i=0; i < locCount; ++i) {
         test(avail[i]);
     }
+#endif
+
+#if 1
+    // special locales
+    int32_t jCount = CalendarTest::testLocaleCount();
+    for (int32_t j=0; j < jCount; ++j) {
+        test(Locale(CalendarTest::testLocaleID(j)));
+    }
+#endif
+
 # endif
 #endif
 
-    delete dateFormat;
     delete getFieldCal;
 }
 
@@ -221,6 +237,15 @@
         errln("DateFormat wasn't a SimpleDateFormat");
         return;
     }
+    
+    UBool isGregorian = FALSE;
+    UErrorCode minStatus = U_ZERO_ERROR;
+    UDate minDate = CalendarTest::minDateOfCalendar(*fmt->getCalendar(), isGregorian, minStatus);
+    if(U_FAILURE(minStatus)) {
+      errln((UnicodeString)"Failure getting min date for " + origLocale.getName());
+      return;
+    } 
+    //logln(UnicodeString("Min date is ") + fullFormat(minDate)  + " for " + origLocale.getName());
 
     pat = ((SimpleDateFormat*)fmt)->toPattern(pat);
 
@@ -246,7 +271,11 @@
             UDate *d                = new UDate    [DEPTH];
             UnicodeString *s    = new UnicodeString[DEPTH];
 
-            d[0] = generateDate();
+            if(isGregorian == TRUE) {
+              d[0] = generateDate();
+            } else {
+              d[0] = generateDate(minDate);
+            }
 
             UErrorCode status = U_ZERO_ERROR;
 
@@ -266,6 +295,9 @@
 
                 s[loop] = fmt->format(d[loop], s[loop]);
                 
+                // For displaying which date is being tested
+                //logln(s[loop] + " = " + fullFormat(d[loop]));
+                
                 if(s[loop].length() == 0) {
                   errln("FAIL: fmt->format gave 0-length string in " + pat + " with number " + d[loop] + " in locale " + origLocale.getName());
                 }
@@ -313,13 +345,18 @@
 
             // String usually matches in 1.  Exceptions are checked for here.
             if(smatch > maxSmatch) { // Don't compute unless necessary
+                UBool in0;
                 // Starts in BC, with no era in pattern
                 if( ! hasEra && getField(d[0], UCAL_ERA) == GregorianCalendar::BC)
                     maxSmatch = 2;
                 // Starts in DST, no year in pattern
-                else if(fmt->getTimeZone().inDaylightTime(d[0], status) && ! failure(status, "gettingDaylightTime") &&
+                else if((in0=fmt->getTimeZone().inDaylightTime(d[0], status)) && ! failure(status, "gettingDaylightTime") &&
                          pat.indexOf(UnicodeString("yyyy")) == -1)
                     maxSmatch = 2;
+                // If we start not in DST, but transition into DST
+                else if (!in0 &&
+                         fmt->getTimeZone().inDaylightTime(d[1], status) && !failure(status, "gettingDaylightTime"))
+                    maxSmatch = 2;
                 // Two digit year with no time zone change,
                 // unless timezone isn't used or we aren't close to the DST changover
                 else if (pat.indexOf(UnicodeString("y")) != -1
@@ -339,23 +376,32 @@
                 }                
             }
 
-            if((dmatch > maxDmatch || smatch > maxSmatch) && // Special case for Japanese (could have large negative years)
-               !strcmp(fmt->getCalendar()->getType(),"japanese")) {
-                    maxSmatch = 4;
-                    maxDmatch = 4;
+            if(dmatch > maxDmatch || smatch > maxSmatch) { // Special case for Japanese and Islamic (could have large negative years)
+              const char *type = fmt->getCalendar()->getType();
+              if(!strcmp(type,"japanese")) {
+                maxSmatch = 4;
+                maxDmatch = 4;
+              }
             }
-            
-            if(dmatch > maxDmatch || smatch > maxSmatch) {
-                errln(UnicodeString("Pattern: ") + pat + UnicodeString(" failed to match in Locale: ")
-                    + origLocale.getName());
-                logln(UnicodeString(" Date ") + dmatch + "  String " + smatch);
 
-                printf("dmatch:%d maxD:%d smatch:%d maxS:%d\n", dmatch,maxDmatch, smatch, maxSmatch);
+            // Use @v to see verbose results on successful cases
+            UBool fail = (dmatch > maxDmatch || smatch > maxSmatch);
+            if (optionv || fail) {
+                if (fail) {
+                    errln(UnicodeString("\nFAIL: Pattern: ") + pat +
+                          " in Locale: " + origLocale.getName());
+                } else {
+                    errln(UnicodeString("\nOk: Pattern: ") + pat +
+                          " in Locale: " + origLocale.getName());
+                }
                 
+                logln("Date iters until match=%d (max allowed=%d), string iters until match=%d (max allowed=%d)",
+                      dmatch,maxDmatch, smatch, maxSmatch);
+
                 for(int j = 0; j <= loop && j < DEPTH; ++j) {
                     UnicodeString temp;
                     FieldPosition pos(FieldPosition::DONT_CARE);
-                    errln((j>0?" P> ":"    ") + dateFormat->format(d[j], temp, pos) + " F> " +
+                    errln((j>0?" P> ":"    ") + fullFormat(d[j]) + " F> " +
                           escape(s[j], temp) + UnicodeString(" d=") + d[j] + 
                           (j > 0 && d[j]/*.getTime()*/==d[j-1]/*.getTime()*/?" d==":"") +
                           (j > 0 && s[j] == s[j-1]?" s==":""));
@@ -371,6 +417,22 @@
     }*/
 }
 
+const UnicodeString& DateFormatRoundTripTest::fullFormat(UDate d) {
+    UErrorCode ec = U_ZERO_ERROR;
+    if (dateFormat == 0) {
+        dateFormat = new SimpleDateFormat((UnicodeString)"EEE MMM dd HH:mm:ss.SSS zzz yyyy G", ec);
+        if (U_FAILURE(ec) || dateFormat == 0) {
+            fgStr = "[FAIL: SimpleDateFormat constructor]";
+            delete dateFormat;
+            dateFormat = 0;
+            return fgStr;
+        }
+    }
+    fgStr.truncate(0);
+    dateFormat->format(d, fgStr);
+    return fgStr;
+}
+
 /**
  * Return a field of the given date
  */
@@ -401,6 +463,33 @@
     }
 
     return dst;
+}
+
+#define U_MILLIS_PER_YEAR (365.25 * 24 * 60 * 60 * 1000)
+
+UDate DateFormatRoundTripTest::generateDate(UDate minDate)
+{
+  // Bring range in conformance to generateDate() below.
+  if(minDate < (U_MILLIS_PER_YEAR * -(4000-1970))) {
+    minDate = (U_MILLIS_PER_YEAR * -(4000-1970));
+  }
+  for(int i=0;i<8;i++) {
+    double a = randFraction();
+    
+    // Range from (min) to  (8000-1970) AD
+    double dateRange = (0.0 - minDate) + (U_MILLIS_PER_YEAR + (8000-1970));
+    
+    a *= dateRange;
+
+    // Now offset from minDate
+    a += minDate;
+   
+    // Last sanity check
+    if(a>=minDate) {
+      return a;
+    }
+  }
+  return minDate;
 }
 
 UDate DateFormatRoundTripTest::generateDate() 

Index: dtfmtrtts.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/dtfmtrtts.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dtfmtrtts.h	10 Sep 2003 02:42:48 -0000	1.3
+++ dtfmtrtts.h	6 Apr 2004 10:09:37 -0000	1.4
@@ -7,8 +7,6 @@
 #ifndef _DATEFORMATROUNDTRIPTEST_
 #define _DATEFORMATROUNDTRIPTEST_
  
-#include <stdlib.h>
-
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_FORMATTING
@@ -28,12 +26,16 @@
     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
 
 public:
+    DateFormatRoundTripTest();
+    virtual ~DateFormatRoundTripTest();
+    
     void TestDateFormatRoundTrip(void);
     void test(const Locale& loc);
     void test(DateFormat *fmt, const Locale &origLocale, UBool timeOnly = FALSE );
     int32_t getField(UDate d, int32_t f);
     UnicodeString& escape(const UnicodeString& src, UnicodeString& dst);
     UDate generateDate(void); 
+    UDate generateDate(UDate minDate); 
 
 
 //============================================================
@@ -43,22 +45,15 @@
 /**
  * Return a random uint32_t
  **/
-static uint32_t randLong()
-{
-    // Assume 8-bit (or larger) rand values.  Also assume
-    // that the system rand() function is very poor, which it always is.
-    uint32_t d;
-    uint32_t i;
-    char* poke = (char*)&d;
-    for (i=0; i < sizeof(uint32_t); ++i)
-    {
-        poke[i] = (char)(rand() & 0xFF);
-    }
-    return d;
+static uint32_t randLong() {
+    // The portable IntlTest::random() function has sufficient
+    // resolution for a 16-bit value, but not for 32 bits.
+    return ((uint32_t) (IntlTest::random() * (1<<16))) |
+          (((uint32_t) (IntlTest::random() * (1<<16))) << 16);
 }
 
 /**
- * Return a random double 0 <= x < 1.0
+ * Return a random double 0 <= x <= 1.0
  **/
 static double randFraction()
 {
@@ -66,7 +61,7 @@
 }
 
 /**
- * Return a random value from -range..+range.
+ * Return a random value from -range..+range (closed).
  **/
 static double randDouble(double range)
 {
@@ -80,13 +75,17 @@
     UBool failure(UErrorCode status, const char* msg);
     UBool failure(UErrorCode status, const char* msg, const UnicodeString& str);
 
+    const UnicodeString& fullFormat(UDate d);
+
 private:
 
     static int32_t SPARSENESS;
     static int32_t TRIALS;
     static int32_t DEPTH;
 
+    UBool optionv; // TRUE if @v option is given on command line
     SimpleDateFormat *dateFormat;
+    UnicodeString fgStr;
     Calendar *getFieldCal;
 };
 

Index: dtfmttst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/dtfmttst.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dtfmttst.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ dtfmttst.cpp	6 Apr 2004 10:09:37 -0000	1.4
@@ -16,7 +16,7 @@
 #include "unicode/simpletz.h"
 #include "unicode/strenum.h"
 #include "cmemory.h"
-
+#include "caltest.h"  // for fieldName
 // *****************************************************************************
 // class DateFormatTest
 // *****************************************************************************
@@ -46,6 +46,7 @@
         TESTCASE(18,TestSpaceParsing);
         TESTCASE(19,TestExactCountFormat);
         TESTCASE(20,TestWhiteSpaceParsing);
+        TESTCASE(21,TestInvalidPattern);
         default: name = ""; break;
     }
 }
@@ -216,13 +217,6 @@
     return (s = buf);
 }
  
-const char* DateFormatTest::fieldNames[] = {
-        "ERA", "YEAR", "MONTH", "WEEK_OF_YEAR", "WEEK_OF_MONTH", "DAY_OF_MONTH", 
-        "DAY_OF_YEAR", "DAY_OF_WEEK", "DAY_OF_WEEK_IN_MONTH", "AM_PM", "HOUR", 
-        "HOUR_OF_DAY", "MINUTE", "SECOND", "MILLISECOND", "ZONE_OFFSET", //"DST_OFFSET", 
-        "YEAR_WOY", "DOW_LOCAL"
-};
- 
 // -------------------------------------
 
 // Map Calendar field number to to DateFormat field number
@@ -246,6 +240,9 @@
     DateFormat::kTimezoneField, 
     DateFormat::kYearWOYField,
     DateFormat::kDOWLocalField,
+    DateFormat::kExtendedYearField,
+    DateFormat::kJulianDayField,
+    DateFormat::kMillisecondsInDayField,
     (DateFormat::EField) -1
 };
 
@@ -269,20 +266,24 @@
     /* field values, in Calendar order */
 
     const char* expected[] = {
+    /* 0: US */
         "", "1997", "August", "", "", "13", "", "Wednesday", "", "PM", "2", "", 
         "34", "12", "", "PDT", "", 
-        /* Following two added by weiv for two new fields */ "", "", 
+        /* Following two added by weiv for two new fields */ "", "", "","","",
+    /* 1: France */
         "", "1997", "#",/* # is a marker for "ao\xfbt" == "aou^t" */  "", "", "13", "", "mercredi", 
         "", "", "", "14", "34", "", "", "GMT-07:00", "", 
-        /* Following two added by weiv for two new fields */ "", "", 
+        /* Following two added by weiv for two new fields */ "", "", "","","",
+    /* 2: (short fields) */
         "AD", "97", "8", "33", "3", "13", "225", "Wed", "2", "PM", "2", 
         "14", "34", "12", "5", "PDT", 
-        /* Following two added by weiv for two new fields */ "97", "4", "",
+        /* Following two added by weiv for two new fields */ "97", "4", "", "","","",
+    /* 3: (long fields) */
         "AD", "1997", "August", "0033", 
         "0003", "0013", "0225", "Wednesday", "0002", "PM", "0002", "0014", 
         "0034", "0012", "513", "Pacific Daylight Time", 
-        /* Following two added by weiv for two new fields */ "1997", "0004",
-        ""
+        /* Following two added by weiv for two new fields */ "1997", "0004", "","","", "",
+        NULL
 
     };
 
@@ -303,6 +304,12 @@
             UnicodeString field;
             getFieldText(df, i, someDate, field);
             UnicodeString expStr;
+
+            if(expected[exp] == NULL) {
+              errln("FAIL: ran out of 'expected' strings (pattern %d, field %d - item %d) .. perhaps number of calendar fields has changed?\n", j, i, exp);
+              return; /* leak? This is a Fatal err */
+            }
+
             if(expected[exp][0]!='#') {
                 expStr=UnicodeString(expected[exp]);
             } else {
@@ -310,8 +317,8 @@
                 expStr.append((UChar)0x61).append((UChar)0x6f).append((UChar32)0xfb).append((UChar)0x74);
             }
             
-            if (!(field == expStr)) errln(UnicodeString("FAIL: field #") + i + " " +
-                fieldNames[i] + " = \"" + escape(field) + "\", expected \"" + escape(expStr) + "\"");
+            if (!(field == expStr)) errln(UnicodeString("FAIL: pattern #") + j + ", field #" + i + " " + 
+                                          CalendarTest::fieldName((UCalendarDateFields)i) + " = \"" + escape(field) + "\", expected \"" + escape(expStr) + "\"");
             ++exp;
         }
     }
@@ -1081,6 +1088,18 @@
     const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
     
     expectParse(DATA, DATA_len, Locale("en"));
+}
+
+
+void DateFormatTest::TestInvalidPattern() {
+    UErrorCode ec = U_ZERO_ERROR;
+    SimpleDateFormat f(UnicodeString("Yesterday"), ec);
+    UnicodeString out;
+    FieldPosition pos;
+    f.format((UDate)0, out, pos);
+    logln(out);
+    // The bug is that the call to format() will crash.  By not
+    // crashing, the test passes.
 }
 
 /**

Index: dtfmttst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/dtfmttst.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dtfmttst.h	10 Sep 2003 02:42:48 -0000	1.3
+++ dtfmttst.h	6 Apr 2004 10:09:37 -0000	1.4
@@ -39,7 +39,6 @@
 public: // package
     // internal utility routine (genrates escape sequences for characters)
     static UnicodeString& escape(UnicodeString& s);
-    static const char* fieldNames[];
  
 public:
     /**
@@ -153,6 +152,8 @@
     void TestExactCountFormat(void);
 
     void TestWhiteSpaceParsing(void);
+
+    void TestInvalidPattern(void);
 
  private:
     void expectParse(const char** data, int32_t data_length,

Index: encoll.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/encoll.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- encoll.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ encoll.cpp	6 Apr 2004 10:09:37 -0000	1.4
@@ -231,9 +231,9 @@
 
 static const UChar testMore[][CollationEnglishTest::MAX_TOKEN_LEN] = {
     {(UChar)0x0061 /* 'a' */, (UChar)0x0065 /* 'e' */, 0},
-    {(UChar)0x0061 /* 'a' */, (UChar)0x0066 /* 'f' */, 0},
     { 0x00E6, 0},
     { 0x00C6, 0},
+    {(UChar)0x0061 /* 'a' */, (UChar)0x0066 /* 'f' */, 0},
     {(UChar)0x006F /* 'o' */, (UChar)0x0065 /* 'e' */, 0},
     { 0x0153, 0},
     { 0x0152, 0},

Index: g7coll.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/g7coll.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- g7coll.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ g7coll.cpp	6 Apr 2004 10:09:37 -0000	1.4
@@ -75,6 +75,7 @@
     { 19, 22, 21, 24, 23, 25, 12, 13, 9, 0, 17, 16, 28, 26, 27, 15, 18, 14, 1, 11, 2, 3, 4, 5, 20, 6, 8, 10, 7, 29 }
 };
 
+G7CollationTest::~G7CollationTest() {}
 
 void G7CollationTest::TestG7Locales(/* char* par */)
 {

Index: g7coll.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/g7coll.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- g7coll.h	10 Sep 2003 02:42:48 -0000	1.3
+++ g7coll.h	6 Apr 2004 10:09:37 -0000	1.4
@@ -49,7 +49,7 @@
     enum ETotal_Test { TOTALTESTSET = 30 };
 
     G7CollationTest() {}
-    virtual ~G7CollationTest() {}
+    virtual ~G7CollationTest();
     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
 
 

Index: icusvtst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/icusvtst.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- icusvtst.cpp	10 Sep 2003 02:42:48 -0000	1.1
+++ icusvtst.cpp	6 Apr 2004 10:09:37 -0000	1.2
@@ -1,6 +1,6 @@
 /**
  *******************************************************************************
- * Copyright (C) 2001-2002, International Business Machines Corporation and    *
+ * Copyright (C) 2001-2003, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  *
@@ -12,8 +12,8 @@
 #if !UCONFIG_NO_SERVICE
 
 #include "icusvtst.h"
-
 #include "iculserv.h"
+#include <stdio.h>
 
 
 class MyListener : public EventListener {
@@ -467,7 +467,7 @@
         return LocaleKey::createWithCanonicalFallback(id, NULL, status); // no fallback locale
     }
 
-    virtual ICUServiceFactory* createSimpleFactory(UObject* obj, const UnicodeString& id, UBool visible, UErrorCode& status) 
+  virtual ICUServiceFactory* createSimpleFactory(UObject* obj, const UnicodeString& id, UBool visible, UErrorCode& /* status */) 
     {
         if (obj && obj->getDynamicClassID() == UnicodeString::getStaticClassID()) {
             return new SimpleFactory((UnicodeString*)obj, id, visible);
@@ -484,7 +484,7 @@
 class AnonymousStringFactory : public ICUServiceFactory
 {
     public:
-    virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const {
+    virtual UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& /* status */) const {
         return new UnicodeString(key.getID());
     }
 
@@ -530,12 +530,19 @@
     ~TestMultipleKeyStringFactory() {
     }
 
-    UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const {
+    UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const {
+        if (U_FAILURE(status)) {
+	    return NULL;
+        }
         UnicodeString temp;
         key.currentID(temp);
-        if (U_SUCCESS(_status) && _ids.contains(&temp)) {
-            return new UnicodeString(_factoryID + temp);
-        }
+        if (U_SUCCESS(_status)) {
+	    if (_ids.contains(&temp)) {
+                return new UnicodeString(_factoryID + temp);
+	    }
+        } else {
+	    status = _status;
+	}
         return NULL;
     }
 
@@ -660,7 +667,7 @@
     // iterate over the display names
     {
         UErrorCode status = U_ZERO_ERROR;
-        UVector names(deleteStringPair, NULL, status);
+        UVector names(userv_deleteStringPair, NULL, status);
         service.getDisplayNames(names, Locale::getGerman(), status);
         for (int i = 0; i < names.size(); ++i) {
             const StringPair* pair = (const StringPair*)names[i];
@@ -700,7 +707,7 @@
     // Rad dude's surfer gal 'replaces' Later's surfer gal
     {
         UErrorCode status = U_ZERO_ERROR;
-        UVector names(deleteStringPair, NULL, status);
+        UVector names(userv_deleteStringPair, NULL, status);
         service.getDisplayNames(names, Locale("es"), status);
         for (int i = 0; i < names.size(); ++i) {
             const StringPair* pair = (const StringPair*)names[i];
@@ -871,7 +878,7 @@
     // this should be fast since the display names were cached.
     {
         UErrorCode status = U_ZERO_ERROR;
-        UVector names(deleteStringPair, NULL, status);
+        UVector names(userv_deleteStringPair, NULL, status);
         service.getDisplayNames(names, Locale::getGermany(), status);
         logln("service display names for de_DE");
         for (int i = 0; i < names.size(); ++i) {
@@ -897,7 +904,7 @@
             logln(UnicodeString("\n  --- ") + idNames[i] + " ---");
             {
                 UErrorCode status = U_ZERO_ERROR;
-                UVector names(deleteStringPair, NULL, status);
+                UVector names(userv_deleteStringPair, NULL, status);
                 service.getDisplayNames(names, idNames[i], status);
                 for (int i = 0; i < names.size(); ++i) {
                     const StringPair* pair = (const StringPair*)names[i];
@@ -1208,7 +1215,7 @@
         }
     }
 
-    UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const {
+    UnicodeString& getDisplayName(const UnicodeString& id, const Locale& /* locale */, UnicodeString& result) const {
         result.append("wrap '");
         result.append(id);
         result.append("'");

Index: icusvtst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/icusvtst.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- icusvtst.h	10 Sep 2003 02:42:48 -0000	1.1
+++ icusvtst.h	6 Apr 2004 10:09:37 -0000	1.2
@@ -1,6 +1,6 @@
 /**
  *******************************************************************************
- * Copyright (C) 2001-2002, International Business Machines Corporation and    *
+ * Copyright (C) 2001-2003, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  *

Index: idnaref.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/idnaref.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- idnaref.cpp	10 Sep 2003 02:42:48 -0000	1.1
+++ idnaref.cpp	6 Apr 2004 10:09:37 -0000	1.2
@@ -18,7 +18,6 @@
 
 #if !UCONFIG_NO_IDNA && !UCONFIG_NO_TRANSLITERATION
 #include "idnaref.h"
-#include "strprep.h"
 #include "punyref.h"
 #include "ustr_imp.h"
 #include "cmemory.h"
@@ -43,21 +42,6 @@
 #define LOWER_CASE_DELTA 0x0020
 #define FULL_STOP        0x002E
 
-
-NamePrepTransform* TestIDNA::prep = NULL;
-
-NamePrepTransform* TestIDNA::getInstance(UErrorCode& status){
-    if(TestIDNA::prep == NULL){
-        UParseError parseError;
-        TestIDNA::prep = NamePrepTransform::createInstance(parseError, status);
-        if(TestIDNA::prep ==NULL){
-           //status = U_MEMORY_ALLOCATION_ERROR;
-           return NULL;
-        }
-    }
-    return TestIDNA::prep;
-
-}
 
 inline static UBool 
 startsWithPrefix(const UChar* src , int32_t srcLength){

Index: incaltst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/incaltst.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- incaltst.cpp	10 Sep 2003 02:42:48 -0000	1.1
+++ incaltst.cpp	6 Apr 2004 10:09:37 -0000	1.2
@@ -13,6 +13,7 @@
 #if !UCONFIG_NO_FORMATTING
 
 #include <stdio.h>
+#include "caltest.h"
 
 #define CHECK(status, msg) \
     if (U_FAILURE(status)) { \
@@ -50,30 +51,14 @@
 // *****************************************************************************
 // class IntlCalendarTest
 // *****************************************************************************
+//--- move to CalendarTest?
+
+static const double JULIAN_EPOCH = -210866760000000.;
 
-static UnicodeString fieldName(UCalendarDateFields f);
 
 // Turn this on to dump the calendar fields 
 #define U_DEBUG_DUMPCALS  
 
-static UnicodeString calToStr(const Calendar & cal)
-{
-
-  UnicodeString out;
-  UErrorCode status = U_ZERO_ERROR;
-  int i;
-  for(i = 0;i<UCAL_FIELD_COUNT;i++) {
-    out += (UnicodeString("+") + fieldName((UCalendarDateFields)i) + "=" +  cal.get((UCalendarDateFields)i, status) + UnicodeString(", "));
-  }
-  out += UnicodeString(cal.getType());
-
-  out += cal.inDaylightTime(status)?UnicodeString("- DAYLIGHT"):UnicodeString("- NORMAL");
-
-  UnicodeString str2;
-  out += cal.getTimeZone().getDisplayName(str2);
-
-  return out;
-}
 
 #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
 
@@ -96,32 +81,6 @@
 
 // ---------------------------------------------------------------------------------
 
-static UnicodeString fieldName(UCalendarDateFields f) {
-    switch (f) {
-    case UCAL_ERA:           return "ERA";
-    case UCAL_YEAR:          return "YEAR";
-    case UCAL_MONTH:         return "MONTH";
-    case UCAL_WEEK_OF_YEAR:  return "WEEK_OF_YEAR";
-    case UCAL_WEEK_OF_MONTH: return "WEEK_OF_MONTH";
-    case UCAL_DATE:			 return "DAY_OF_MONTH"; // DATE is synonym for DAY_OF_MONTH
-    case UCAL_DAY_OF_YEAR:   return "DAY_OF_YEAR";
-    case UCAL_DAY_OF_WEEK:   return "DAY_OF_WEEK";
-    case UCAL_DAY_OF_WEEK_IN_MONTH: return "DAY_OF_WEEK_IN_MONTH";
-    case UCAL_AM_PM:         return "AM_PM";
-    case UCAL_HOUR:          return "HOUR";
-    case UCAL_HOUR_OF_DAY:   return "HOUR_OF_DAY";
-    case UCAL_MINUTE:        return "MINUTE";
-    case UCAL_SECOND:        return "SECOND";
-    case UCAL_MILLISECOND:   return "MILLISECOND";
-    case UCAL_ZONE_OFFSET:   return "ZONE_OFFSET";
-    case UCAL_DST_OFFSET:    return "DST_OFFSET";
-    case UCAL_YEAR_WOY:      return "YEAR_WOY";
-    case UCAL_DOW_LOCAL:     return "DOW_LOCAL";
-    case UCAL_FIELD_COUNT:   return "FIELD_COUNT";
-    default:
-        return UnicodeString("") + ((int32_t)f);
-    }
-}
 
 /**
  * Test various API methods for API completeness.
@@ -133,12 +92,22 @@
   UErrorCode status = U_ZERO_ERROR;
   int j;
   const char *locs [40] = { "en_US_VALLEYGIRL",     
+                            "en_US_VALLEYGIRL@collation=phonebook;calendar=japanese",
+                            "en_US_VALLEYGIRL@collation=phonebook;calendar=gregorian",
+                            "ja_JP@calendar=japanese",   
+                            "th_TH@calendar=buddhist", 
                             "ja_JP_TRADITIONAL",   
                             "th_TH_TRADITIONAL", 
+                            "th_TH_TRADITIONAL@calendar=gregorian", 
                             "en_US", NULL };
   const char *types[40] = { "gregorian", 
                             "japanese",
+                            "gregorian",
+                            "japanese",
+                            "buddhist",           
+                            "japanese",
                             "buddhist",           
+                            "gregorian",
                             "gregorian", NULL };
 
   for(j=0;locs[j];j++) {
@@ -195,8 +164,8 @@
     cal.set(year, month, dayOfMonth);
     UDate d = cal.getTime(status);
 #ifdef U_DEBUG_DUMPCALS
-    logln((UnicodeString)"cal  : " + calToStr(cal));
-    logln((UnicodeString)"grego: " + calToStr(*grego));
+    logln((UnicodeString)"cal  : " + CalendarTest::calToStr(cal));
+    logln((UnicodeString)"grego: " + CalendarTest::calToStr(*grego));
 #endif
     if (d == D) {
       logln(UnicodeString("OK: ") + era + ":" + year + "/" + (month+1) + "/" + dayOfMonth +
@@ -212,8 +181,8 @@
     int e = cal.get(UCAL_ERA, status);
     int y = cal.get(UCAL_YEAR, status);
 #ifdef U_DEBUG_DUMPCALS
-    logln((UnicodeString)"cal  : " + calToStr(cal));
-    logln((UnicodeString)"grego: " + calToStr(*grego));
+    logln((UnicodeString)"cal  : " + CalendarTest::calToStr(cal));
+    logln((UnicodeString)"grego: " + CalendarTest::calToStr(*grego));
 #endif
     if (y == year && e == era) {
       logln((UnicodeString)"OK: " + D + " => " + cal.get(UCAL_ERA, status) + ":" +
@@ -276,20 +245,20 @@
     UDate timeA = Calendar::getNow();
 
     int32_t data[] = {
-        0,           // B. era
+        0,           // B. era   [928479600000]
         2542,        // B. year
         1999,        // G. year
         UCAL_JUNE,   // month
         4,           // day
 
-        0,           // B. era
+        0,           // B. era   [-79204842000000]
         3,           // B. year
         -540,        // G. year
         UCAL_FEBRUARY, // month
         12,          // day
 
         0,           // test month calculation:  4795 BE = 4252 AD is a leap year, but 4795 AD is not.
-        4795,        // BE
+        4795,        // BE [72018057600000]
         4252,        // AD
         UCAL_FEBRUARY,
         29,
@@ -298,8 +267,8 @@
     };
     Calendar *cal;
     UErrorCode status = U_ZERO_ERROR;
-    cal = Calendar::createInstance("th_TH_TRADITIONAL", status);
-    CHECK(status, UnicodeString("Creating th_TH_TRADITIONAL calendar"));
+    cal = Calendar::createInstance("th_TH@calendar=buddhist", status);
+    CHECK(status, UnicodeString("Creating th_TH@calendar=buddhist calendar"));
 
     // Sanity check the calendar 
     UDate timeB = Calendar::getNow();
@@ -350,8 +319,8 @@
     
     Calendar *cal;
     UErrorCode status = U_ZERO_ERROR;
-    cal = Calendar::createInstance("ja_JP_TRADITIONAL", status);
-    CHECK(status, UnicodeString("Creating ja_JP_TRADITIONAL calendar"));
+    cal = Calendar::createInstance("ja_JP@calendar=japanese", status);
+    CHECK(status, UnicodeString("Creating ja_JP@calendar=japanese calendar"));
     // Sanity check the calendar 
     UDate timeB = Calendar::getNow();
     UDate timeCal = cal->getTime(status);
@@ -366,26 +335,23 @@
 }
 
 void IntlCalendarTest::TestBuddhistFormat() {
-    Calendar *cal;
     UErrorCode status = U_ZERO_ERROR;
-    cal = Calendar::createInstance("th_TH_TRADITIONAL", status);
-    CHECK(status, UnicodeString("Creating th_TH_TRADITIONAL calendar"));
     
     // Test simple parse/format with adopt
     
     // First, a contrived english test..
     UDate aDate = 999932400000.0; 
-    SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US"), status);
+    SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US@calendar=buddhist"), status);
     CHECK(status, "creating date format instance");
+    SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US@calendar=gregorian"), status);
+    CHECK(status, "creating gregorian date format instance");
     if(!fmt) { 
         errln("Coudln't create en_US instance");
     } else {
         UnicodeString str;
-        fmt->format(aDate, str);
+        fmt2->format(aDate, str);
         logln(UnicodeString() + "Test Date: " + str);
         str.remove();
-        fmt->adoptCalendar(cal);
-        cal = NULL;
         fmt->format(aDate, str);
         logln(UnicodeString() + "as Buddhist Calendar: " + escape(str));
         UnicodeString expected("September 8, 2544 BE");
@@ -402,7 +368,7 @@
         }
         delete fmt;
     }
-    delete cal;
+    delete fmt2;
     
     CHECK(status, "Error occured testing Buddhist Calendar in English ");
     
@@ -412,7 +378,31 @@
         UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
             " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e1e.\\u0e28. 2544");
         UDate         expectDate = 999932400000.0;
-        Locale        loc("th_TH_TRADITIONAL");
+        Locale        loc("th_TH_TRADITIONAL"); // legacy
+        
+        simpleTest(loc, expect, expectDate, status);
+    }
+    {
+        UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
+            " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e1e.\\u0e28. 2544");
+        UDate         expectDate = 999932400000.0;
+        Locale        loc("th_TH@calendar=buddhist");
+        
+        simpleTest(loc, expect, expectDate, status);
+    }
+    {
+        UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
+            " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e04.\\u0e28. 2001");
+        UDate         expectDate = 999932400000.0;
+        Locale        loc("th_TH@calendar=gregorian");
+        
+        simpleTest(loc, expect, expectDate, status);
+    }
+    {
+        UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
+            " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e04.\\u0e28. 2001");
+        UDate         expectDate = 999932400000.0;
+        Locale        loc("th_TH_TRADITIONAL@calendar=gregorian");
         
         simpleTest(loc, expect, expectDate, status);
     }
@@ -426,21 +416,22 @@
     CHECK(status, UnicodeString("Creating ja_JP_TRADITIONAL calendar"));
     
     Calendar *cal2 = cal->clone();
+    delete cal;
+    cal = NULL;
     
     // Test simple parse/format with adopt
     
     UDate aDate = 999932400000.0; 
-    SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yy G"), Locale("en_US"), status);
+    SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yy G"), Locale("en_US@calendar=japanese"), status);
+    SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("MMMM d, yy G"), Locale("en_US@calendar=gregorian"), status);
     CHECK(status, "creating date format instance");
     if(!fmt) { 
         errln("Coudln't create en_US instance");
     } else {
         UnicodeString str;
-        fmt->format(aDate, str);
+        fmt2->format(aDate, str);
         logln(UnicodeString() + "Test Date: " + str);
         str.remove();
-        fmt->adoptCalendar(cal);
-        cal = NULL;
         fmt->format(aDate, str);
         logln(UnicodeString() + "as Japanese Calendar: " + str);
         UnicodeString expected("September 8, 13 Heisei");
@@ -453,7 +444,7 @@
             ParsePosition pp;
             fmt->parse(expected, *cal2, pp);
             fmt->format(otherDate, str3);
-            errln("Parse incorrect of " + expected + " - wanted " + aDate + " but got " +  " = " +   otherDate + ", " + str3 + " = " + calToStr(*cal2) );
+            errln("Parse incorrect of " + expected + " - wanted " + aDate + " but got " +  " = " +   otherDate + ", " + str3 + " = " + CalendarTest::calToStr(*cal2) );
             
         } else {
             logln("Parsed OK: " + expected);
@@ -462,17 +453,16 @@
     }
 
     // Test parse with incomplete information
-    fmt = new SimpleDateFormat(UnicodeString("G y"), Locale("en_US"), status);
+    fmt = new SimpleDateFormat(UnicodeString("G y"), Locale("en_US@calendar=japanese"), status);
     aDate = -3197120400000.;
     CHECK(status, "creating date format instance");
     if(!fmt) { 
         errln("Coudln't create en_US instance");
     } else {
         UnicodeString str;
-        fmt->format(aDate, str);
+        fmt2->format(aDate, str);
         logln(UnicodeString() + "Test Date: " + str);
         str.remove();
-        fmt->adoptCalendar(cal2->clone());
         fmt->format(aDate, str);
         logln(UnicodeString() + "as Japanese Calendar: " + str);
         UnicodeString expected("Meiji 1");
@@ -486,48 +476,57 @@
             fmt->parse(expected, *cal2, pp);
             fmt->format(otherDate, str3);
             errln("Parse incorrect of " + expected + " - wanted " + aDate + " but got " +  " = " +
-                otherDate + ", " + str3 + " = " + calToStr(*cal2) );
+                otherDate + ", " + str3 + " = " + CalendarTest::calToStr(*cal2) );
         } else {
             logln("Parsed OK: " + expected);
         }
         delete fmt;
     }
 
-    delete cal;
     delete cal2;
+    delete fmt2;
     CHECK(status, "Error occured");
     
     // Now, try in Japanese
     {
-        UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5");
+        UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5\\u571f\\u66dc\\u65e5");
         UDate         expectDate = 999932400000.0; // Testing a recent date
-        Locale        loc("ja_JP_TRADITIONAL");
+        Locale        loc("ja_JP@calendar=japanese");
         
         status = U_ZERO_ERROR;
         simpleTest(loc, expect, expectDate, status);
     }
     {
-        UnicodeString expect = CharsToUnicodeString("\\u5b89\\u6c385\\u5e747\\u67084\\u65e5");
+        UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5\\u571f\\u66dc\\u65e5");
+        UDate         expectDate = 999932400000.0; // Testing a recent date
+        Locale        loc("ja_JP_TRADITIONAL"); // legacy
+        
+        status = U_ZERO_ERROR;
+        simpleTest(loc, expect, expectDate, status);
+    }
+    {
+        UnicodeString expect = CharsToUnicodeString("\\u5b89\\u6c385\\u5e747\\u67084\\u65e5\\u6728\\u66dc\\u65e5");
         UDate         expectDate = -6106035600000.0;
-        Locale        loc("ja_JP_TRADITIONAL");
+        Locale        loc("ja_JP@calendar=japanese");
         
         status = U_ZERO_ERROR;
         simpleTest(loc, expect, expectDate, status);    
         
     }
     {   // Jitterbug 1869 - this is an ambiguous era. (Showa 64 = Jan 6 1989, but Showa could be 2 other eras) )
-        UnicodeString expect = CharsToUnicodeString("\\u662d\\u548c64\\u5e741\\u67086\\u65e5");
+        UnicodeString expect = CharsToUnicodeString("\\u662d\\u548c64\\u5e741\\u67086\\u65e5\\u91d1\\u66dc\\u65e5");
         UDate         expectDate = 600076800000.0;
-        Locale        loc("ja_JP_TRADITIONAL");
+        Locale        loc("ja_JP@calendar=japanese");
         
         status = U_ZERO_ERROR;
         simpleTest(loc, expect, expectDate, status);    
         
     }
     {   // This Feb 29th falls on a leap year by gregorian year, but not by Japanese year.
-        UnicodeString expect = CharsToUnicodeString("\\u5EB7\\u6B632\\u5e742\\u670829\\u65e5");
-        UDate         expectDate =  -16214400000000.0;  // courtesy of date format round trip test
-        Locale        loc("ja_JP_TRADITIONAL");
+        UnicodeString expect = CharsToUnicodeString("\\u5EB7\\u6B632\\u5e742\\u670829\\u65e5\\u65e5\\u66dc\\u65e5");
+        // Add -1:00 to the following for historical TZ - aliu
+        UDate         expectDate =  -16214403600000.0;  // courtesy of date format round trip test
+        Locale        loc("ja_JP@calendar=japanese");
         
         status = U_ZERO_ERROR;
         simpleTest(loc, expect, expectDate, status);    

Index: incaltst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/incaltst.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- incaltst.h	10 Sep 2003 02:42:48 -0000	1.1
+++ incaltst.h	6 Apr 2004 10:09:37 -0000	1.2
@@ -41,6 +41,7 @@
  
 };
 
+
 #endif /* #if !UCONFIG_NO_FORMATTING */
  
 #endif // __IntlCalendarTest__

Index: intltest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/intltest.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- intltest.cpp	10 Sep 2003 02:42:48 -0000	1.5
+++ intltest.cpp	6 Apr 2004 10:09:37 -0000	1.6
@@ -22,13 +22,14 @@
 #include "unicode/smpdtfmt.h"
 #include "unicode/ucnv.h"
 #include "unicode/uclean.h"
+#include "unicode/timezone.h"
 
 #include "intltest.h"
 #include "caltztst.h"
 #include "itmajor.h"
-#include "tsmutex.h"
 
 #include "umutex.h"
+#include "uassert.h"
 
 #ifdef XP_MAC_CONSOLE
 #include <console.h>
@@ -50,16 +51,6 @@
 UCharToUnicodeString(UChar c)
 { return UnicodeString(c); }
 
-// [LIU] Just to get things working
-UnicodeString
-operator+(const UnicodeString& left,
-      const UnicodeString& right)
-{
-    UnicodeString str(left);
-    str += right;
-    return str;
-}
-
 // [rtg] Just to get things working
 UnicodeString
 operator+(const UnicodeString& left,
@@ -87,6 +78,22 @@
     return left + buffer;
 }
 
+UnicodeString
+Int64ToUnicodeString(int64_t num)
+{
+    char buffer[64];    // nos changed from 10 to 64
+    char danger = 'p';  // guard against overrunning the buffer (rtg)
+
+#ifdef WIN32
+    sprintf(buffer, "%I64d", num);
+#else
+    sprintf(buffer, "%lld", num);
+#endif
+    assert(danger == 'p');
+
+    return buffer;
+}
+
 // [LIU] Just to get things working
 UnicodeString
 operator+(const UnicodeString& left,
@@ -130,6 +137,11 @@
     case Formattable::kLong:
         s = UnicodeString("[Long:") + f.getLong() + "]";
         break;
+
+    case Formattable::kInt64:
+        s = UnicodeString("[Int64:") + Int64ToUnicodeString(f.getInt64()) + "]";
+        break;
+
     case Formattable::kString:
         f.getString(s);
         s.insert(0, "[String:");
@@ -381,7 +393,7 @@
     //              may not be the same as the source directory, depending on
     //              the configure options used.  At any rate,
     //              set the data path to the built data from this directory.
-    //              The value is complete with quotes, so it can be used 
+    //              The value is complete with quotes, so it can be used
     //              as-is as a string constant.
 
 #if defined (U_TOPBUILDDIR)
@@ -498,47 +510,6 @@
         IntlTest::gTest->errln( message );
 }
 
-IntlTest& operator<<(IntlTest& test, const UnicodeString&   string)
-{
-/* NULL shouldn't happen */
-//    if (&test == NULL)
-//        return *((IntlTest*) NULL);
-    test.log( string );
-    return test;
-}
-
-IntlTest& operator<<(IntlTest& test, const char*    string)
-{
-/* NULL shouldn't happen */
-//    if (&test == NULL)
-//        return *((IntlTest*) NULL);
-    test.log( string );
-    return test;
-}
-
-IntlTest& operator<<(IntlTest& test, const int32_t num)
-{
-/* NULL shouldn't happen */
-//    if (&test == NULL)
-//        return *((IntlTest*) NULL);
-    char convert[20];
-    sprintf(convert, "%li", (long)num);
-    test.log(convert);
-    return test;
-}
-
-IntlTest& endl( IntlTest& test )
-{
-    test.logln();
-    return test;
-}
-
-IntlTest& operator<<(IntlTest& test,  IntlTest& ( * _f)(IntlTest&))
-{
-    (*_f)(test);
-    return test;
-}
-
 
 IntlTest::IntlTest()
 {
@@ -626,7 +597,7 @@
     }
 
     if (!name || (name[0] == 0) || (strcmp(name, "*") == 0)) {
-        rval = runTestLoop( NULL, NULL );
+        rval = runTestLoop( NULL, par );
 
     }else if (strcmp( name, "LIST" ) == 0) {
         this->usage();
@@ -669,7 +640,7 @@
     IntlTest* saveTest = gTest;
     gTest = this;
     do {
-        this->runIndexedTest( index, FALSE, name );
+        this->runIndexedTest( index, FALSE, name, par );
         if (!name || (name[0] == 0))
             break;
         if (!testname) {
@@ -790,7 +761,7 @@
 /* convenience functions that include sprintf formatting */
 void IntlTest::log(const char *fmt, ...)
 {
-    char buffer[512];
+    char buffer[4000];
     va_list ap;
 
     va_start(ap, fmt);
@@ -804,7 +775,7 @@
 
 void IntlTest::logln(const char *fmt, ...)
 {
-    char buffer[512];
+    char buffer[4000];
     va_list ap;
 
     va_start(ap, fmt);
@@ -819,7 +790,7 @@
 /* convenience functions that include sprintf formatting */
 void IntlTest::info(const char *fmt, ...)
 {
-    char buffer[512];
+    char buffer[4000];
     va_list ap;
 
     va_start(ap, fmt);
@@ -831,7 +802,7 @@
 
 void IntlTest::infoln(const char *fmt, ...)
 {
-    char buffer[512];
+    char buffer[4000];
     va_list ap;
 
     va_start(ap, fmt);
@@ -843,7 +814,7 @@
 
 void IntlTest::err(const char *fmt, ...)
 {
-    char buffer[512];
+    char buffer[4000];
     va_list ap;
 
     va_start(ap, fmt);
@@ -854,7 +825,7 @@
 
 void IntlTest::errln(const char *fmt, ...)
 {
-    char buffer[512];
+    char buffer[4000];
     va_list ap;
 
     va_start(ap, fmt);
@@ -893,7 +864,7 @@
     // stream out the indentation string first if necessary
     length = indent.extract(1, indent.length(), buffer, sizeof(buffer));
     if (length > 0) {
-        fwrite(buffer, sizeof(*buffer), length, testoutfp);
+        fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp);
     }
 
     // replace each LineFeed by the indentation string
@@ -902,17 +873,17 @@
     // stream out the message
     length = message.extract(0, message.length(), buffer, sizeof(buffer));
     if (length > 0) {
-        fwrite(buffer, sizeof(*buffer), length, testoutfp);
+        fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp);
     }
 
     if (newline) {
         char newLine = '\n';
-        fwrite(&newLine, sizeof(newLine), 1, testoutfp);
+        fwrite(&newLine, sizeof(newLine), 1, (FILE *)testoutfp);
     }
 
     // A newline usually flushes the buffer, but
     // flush the message just in case of a core dump.
-    fflush(testoutfp);
+    fflush((FILE *)testoutfp);
 }
 
 /**
@@ -959,7 +930,7 @@
 main(int argc, char* argv[])
 {
     UBool syntax = FALSE;
-    UBool all = TRUE;
+    UBool all = FALSE;
     UBool verbose = FALSE;
     UBool no_err_msg = FALSE;
     UBool quick = TRUE;
@@ -968,74 +939,68 @@
     UBool warnOnMissingData = FALSE;
     UErrorCode errorCode = U_ZERO_ERROR;
     UConverter *cnv = NULL;
-    const char *warnOrErr = "Failure"; 
-
-    /* This must be tested before using anything! */
-    MutexTest::gMutexInitialized = umtx_isInitialized(NULL);
+    const char *warnOrErr = "Failure";
 
 #ifdef XP_MAC_CONSOLE
     argc = ccommand( &argv );
 #endif
 
-    /* try opening the data from dll instead of the dat file */
-    cnv = ucnv_open(TRY_CNV_1, &errorCode);
-    if(cnv != 0) {
-        /* ok */
-        ucnv_close(cnv);
-    } else {
+    /* Initialize ICU */
+	IntlTest::setICU_DATA();   // Must set data directory before u_init() is called.
+    u_init(&errorCode);
+    if (U_FAILURE(errorCode)) {
         fprintf(stderr,
-                "#### WARNING! The converter for " TRY_CNV_1 " cannot be loaded from data dll/so."
-                "Proceeding to load data from dat file.\n");
-        errorCode = U_ZERO_ERROR;
-
+                "#### %s: u_init() failed, error is \"%s\".\n"
+				"#### Most commonly indicates that the ICU data is not accesible.\n"
+                "#### Check setting of ICU_DATA, or check that ICU data library is available\n"
+				"#### ICU_DATA is currently set to \"%s\"\n", argv[0], u_errorName(errorCode), u_getDataDirectory());
+		u_cleanup();
+	    return 1;
     }
-    // If user didn't set ICU_DATA, attempt to generate one.
-    IntlTest::setICU_DATA();
+
 
     for (int i = 1; i < argc; ++i) {
         if (argv[i][0] == '-') {
             const char* str = argv[i] + 1;
-            if (strcmp("verbose", str) == 0)
-                verbose = TRUE;
-            else if (strcmp("v", str) == 0)
+            if (strcmp("verbose", str) == 0 ||
+                strcmp("v", str) == 0)
                 verbose = TRUE;
-            else if (strcmp("noerrormsg", str) == 0)
-                no_err_msg = TRUE;
-            else if (strcmp("n", str) == 0)
+            else if (strcmp("noerrormsg", str) == 0 ||
+                     strcmp("n", str) == 0)
                 no_err_msg = TRUE;
-            else if (strcmp("exhaustive", str) == 0)
-                quick = FALSE;
-            else if (strcmp("e", str) == 0)
+            else if (strcmp("exhaustive", str) == 0 ||
+                     strcmp("e", str) == 0)
                 quick = FALSE;
-            else if (strcmp("all", str) == 0)
-                all = TRUE;
-            else if (strcmp("a", str) == 0)
+            else if (strcmp("all", str) == 0 ||
+                     strcmp("a", str) == 0)
                 all = TRUE;
-            else if (strcmp("leaks", str) == 0)
-                leaks = TRUE;
-            else if (strcmp("l", str) == 0)
+            else if (strcmp("leaks", str) == 0 ||
+                     strcmp("l", str) == 0)
                 leaks = TRUE;
             else if (strcmp("w", str) == 0) {
               warnOnMissingData = TRUE;
               warnOrErr = "WARNING";
-            } else {
+            }
+            else {
                 syntax = TRUE;
             }
         }else{
             name = TRUE;
-            all = FALSE;
         }
     }
 
-    if (all && name) syntax = TRUE;
-    if (!all && !name) syntax = TRUE;
+    if (!all && !name) {
+        all = TRUE;
+    } else if (all && name) {
+        syntax = TRUE;
+    }
 
     if (syntax) {
         fprintf(stdout,
                 "### Syntax:\n"
                 "### IntlTest [-option1 -option2 ...] [testname1 testname2 ...] \n"
                 "### where options are: verbose (v), all (a), noerrormsg (n), \n"
-                "### exhaustive (e) and leaks (l). \n"
+                "### exhaustive (e), leaks (l)"
                 "### (Specify either -all (shortcut -a) or a test name). \n"
                 "### -all will run all of the tests.\n"
                 "### \n"
@@ -1079,7 +1044,7 @@
                 "*** check that the data files are present.\n",
                 u_errorName(errorCode));
         if(!warnOnMissingData) {
-          fprintf(stdout, "*** Exitting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
+          fprintf(stdout, "*** Exiting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
           return 1;
         }
     }
@@ -1098,7 +1063,7 @@
                 "*** check that the data files are present.\n",
                 warnOrErr, ucnv_getDefaultName());
         if(!warnOnMissingData) {
-          fprintf(stdout, "*** Exitting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
+          fprintf(stdout, "*** Exiting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
           return 1;
         }
     }
@@ -1114,7 +1079,7 @@
                 "*** Check the ICU_DATA environment variable and \n"
                 "*** check that the data files are present.\n", warnOrErr);
         if(!warnOnMissingData) {
-          fprintf(stdout, "*** Exitting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
+          fprintf(stdout, "*** Exiting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
           return 1;
         }
     }
@@ -1127,7 +1092,7 @@
                 "*** Check the ICU_DATA environment variable and \n"
                 "*** check that the data files are present.\n", warnOrErr);
         if(!warnOnMissingData) {
-          fprintf(stdout, "*** Exitting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
+          fprintf(stdout, "*** Exiting.  Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n");
           return 1;
         }
     }
@@ -1186,18 +1151,6 @@
 
     fprintf(stdout, "--------------------------------------\n");
 
-    if (!MutexTest::gMutexInitialized) {
-        fprintf(stderr,
-            "#### WARNING!\n"
-            "  The global mutex was not initialized during C++ static initialization.\n"
-            "  You must use an ICU API in a single thread, like ucnv_open() or\n"
-            "  uloc_countAvailable(), before using ICU in multiple threads.\n"
-            "  Most ICU API functions will initialize the global mutex for you.\n"
-            "  If you are using ICU in a single threaded application, please ignore this\n"
-            "  warning.\n"
-            "#### WARNING!\n"
-            );
-    }
     if (execCount <= 0) {
         fprintf(stdout, "***** Not all called tests actually exist! *****\n");
     }
@@ -1322,6 +1275,50 @@
     return str.unescape();
 }
 
+#define RAND_M  (714025)
+#define RAND_IA (1366)
+#define RAND_IC (150889)
+
+static int32_t RAND_SEED;
+
+/**
+ * Returns a uniform random value x, with 0.0 <= x < 1.0.  Use
+ * with care: Does not return all possible values; returns one of
+ * 714,025 values, uniformly spaced.  However, the period is
+ * effectively infinite.  See: Numerical Recipes, section 7.1.
+ *
+ * @param seedp pointer to seed. Set *seedp to any negative value
+ * to restart the sequence.
+ */
+float IntlTest::random(int32_t* seedp) {
+    static int32_t iy, ir[98];
+    static UBool first=TRUE;
+    int32_t j;
+    if (*seedp < 0 || first) {
+        first = FALSE;
+        if ((*seedp=(RAND_IC-(*seedp)) % RAND_M) < 0) *seedp = -(*seedp);
+        for (j=1;j<=97;++j) {
+            *seedp=(RAND_IA*(*seedp)+RAND_IC) % RAND_M;
+            ir[j]=(*seedp);
+        }
+        *seedp=(RAND_IA*(*seedp)+RAND_IC) % RAND_M;
+        iy=(*seedp);
+    }
+    j=(int32_t)(1 + 97.0*iy/RAND_M);
+    U_ASSERT(j>=1 && j<=97);
+    iy=ir[j];
+    *seedp=(RAND_IA*(*seedp)+RAND_IC) % RAND_M;
+    ir[j]=(*seedp);
+    return (float) iy/RAND_M;
+}
+
+/**
+ * Convenience method using a global seed.
+ */
+float IntlTest::random() {
+    return random(&RAND_SEED);
+}
+
 /*
  * Hey, Emacs, please set the following:
  *
@@ -1330,4 +1327,3 @@
  * End:
  *
  */
-

Index: intltest.dsp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/intltest.dsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- intltest.dsp	10 Sep 2003 02:42:48 -0000	1.4
+++ intltest.dsp	6 Apr 2004 10:09:37 -0000	1.5
@@ -372,6 +372,14 @@
 # Begin Group "collections"
 
 # PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\v32test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\v32test.h
+# End Source File
 # End Group
 # Begin Group "configuration"
 
@@ -379,6 +387,7 @@
 # Begin Source File
 
 SOURCE=.\strtest.cpp
+# ADD CPP /Ze
 # End Source File
 # Begin Source File
 
@@ -395,19 +404,23 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\tsmutex.cpp
+SOURCE=.\tsputil.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\tsmutex.h
+SOURCE=.\tsputil.h
 # End Source File
+# End Group
+# Begin Group "conversion"
+
+# PROP Default_Filter ""
 # Begin Source File
 
-SOURCE=.\tsputil.cpp
+SOURCE=.\convtest.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\tsputil.h
+SOURCE=.\convtest.h
 # End Source File
 # End Group
 # Begin Group "data & memory"
@@ -427,6 +440,22 @@
 # PROP Default_Filter ""
 # Begin Source File
 
+SOURCE=.\astrotst.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\astrotst.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\calcasts.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\calcasts.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\callimts.cpp
 # End Source File
 # Begin Source File
@@ -702,6 +731,46 @@
 SOURCE=.\restsnew.h
 # End Source File
 # End Group
+# Begin Group "idna"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\idnaref.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\idnaref.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nptrans.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\nptrans.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\punyref.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\punyref.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\testidn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testidna.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testidna.h
+# End Source File
+# End Group
 # Begin Group "misc"
 
 # PROP Default_Filter ""
@@ -960,46 +1029,6 @@
 # Begin Source File
 
 SOURCE=.\unhxtrts.h
-# End Source File
-# End Group
-# Begin Group "idna"
-
-# PROP Default_Filter "*.c,*.h"
-# Begin Source File
-
-SOURCE=.\idnaref.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\idnaref.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\nptrans.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\nptrans.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\punyref.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\punyref.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\testidn.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\testidna.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\testidna.h
 # End Source File
 # End Group
 # End Target

Index: intltest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/intltest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- intltest.h	10 Sep 2003 02:42:48 -0000	1.3
+++ intltest.h	6 Apr 2004 10:09:38 -0000	1.4
@@ -11,10 +11,7 @@
 #ifndef _INTLTEST
 #define _INTLTEST
 
-#include <stdio.h>
-
-#include "unicode/utypes.h"
-#include "unicode/unistr.h"
+// The following includes utypes.h, uobject.h and unistr.h
 #include "unicode/fmtable.h"
 
 U_NAMESPACE_USE
@@ -25,13 +22,12 @@
 #pragma map(IntlTest::log( const UnicodeString &message ),"logos390")
 #endif
 
-#define it_out (*IntlTest::gTest)
-
 //-----------------------------------------------------------------------------
 //convenience classes to ease porting code that uses the Java
 //string-concatenation operator (moved from findword test by rtg)
 UnicodeString UCharToUnicodeString(UChar c);
-UnicodeString operator+(const UnicodeString& left, const UnicodeString& right);
+UnicodeString Int64ToUnicodeString(int64_t num);
+//UnicodeString operator+(const UnicodeString& left, int64_t num); // Some compilers don't allow this because of the long type.
 UnicodeString operator+(const UnicodeString& left, long num);
 UnicodeString operator+(const UnicodeString& left, unsigned long num);
 UnicodeString operator+(const UnicodeString& left, double num);
@@ -117,7 +113,21 @@
         
     virtual void usage( void ) ;
 
-    FILE *testoutfp;
+    /**
+     * Returns a uniform random value x, with 0.0 <= x < 1.0.  Use
+     * with care: Does not return all possible values; returns one of
+     * 714,025 values, uniformly spaced.  However, the period is
+     * effectively infinite.  See: Numerical Recipes, section 7.1.
+     *
+     * @param seedp pointer to seed. Set *seedp to any negative value
+     * to restart the sequence.
+     */
+    static float random(int32_t* seedp);
+
+    /**
+     * Convenience method using a global seed.
+     */
+    static float random();
 
 protected:
     virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); // overide !
@@ -142,7 +152,11 @@
     IntlTest*   caller;
     char*       path;           // specifies subtests
 
+    //FILE *testoutfp;
+    void *testoutfp;
+
 protected:
+
     virtual void LL_message( UnicodeString message, UBool newline );
 
     // used for collation result reporting, defined here for convenience
@@ -180,13 +194,6 @@
 void it_err(void);
 void it_err( UnicodeString message );
 void it_errln( UnicodeString message );
-
-IntlTest& operator<<(IntlTest& test, const UnicodeString& string);
-IntlTest& operator<<(IntlTest& test, const char* string);
-IntlTest& operator<<(IntlTest& test, const int32_t num);
-
-IntlTest& endl( IntlTest& test );
-IntlTest& operator<<(IntlTest& test,  IntlTest& ( * _f)(IntlTest&));
 
 /**
  * This is a variant of cintltst/ccolltst.c:CharsToUChars().

Index: intltest.vcproj
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/intltest.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- intltest.vcproj	10 Sep 2003 02:42:48 -0000	1.1
+++ intltest.vcproj	6 Apr 2004 10:09:38 -0000	1.2
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="7.00"
+	Version="7.10"
 	Name="intltest"
 	SccProjectName=""
 	SccLocalPath="">
@@ -24,7 +24,7 @@
 				ImproveFloatingPointConsistency="TRUE"
 				OptimizeForProcessor="2"
 				AdditionalIncludeDirectories="..\..\..\include,..\..\..\source\common,..\..\..\source\i18n,..\..\tools\toolutil"
-				PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE,UDATA_MAP_DLL"
+				PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
 				DisableLanguageExtensions="TRUE"
@@ -42,7 +42,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="odbc32.lib odbccp32.lib"
 				OutputFile=".\Debug/intltest.exe"
 				LinkIncremental="2"
 				SuppressStartupBanner="TRUE"
@@ -66,7 +65,13 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
@@ -97,7 +102,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="odbc32.lib odbccp32.lib"
 				OutputFile=".\Release/intltest.exe"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
@@ -121,9 +125,17 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 	</Configurations>
+	<References>
+	</References>
 	<Files>
 		<Filter
 			Name="break iteration"
@@ -290,6 +302,16 @@
 			</File>
 		</Filter>
 		<Filter
+			Name="collections"
+			Filter="">
+			<File
+				RelativePath=".\v32test.cpp">
+			</File>
+			<File
+				RelativePath=".\v32test.h">
+			</File>
+		</Filter>
+		<Filter
 			Name="configuration"
 			Filter="">
 			<File
@@ -317,16 +339,20 @@
 				RelativePath=".\tsmthred.h">
 			</File>
 			<File
-				RelativePath=".\tsmutex.cpp">
+				RelativePath=".\tsputil.cpp">
 			</File>
 			<File
-				RelativePath=".\tsmutex.h">
+				RelativePath=".\tsputil.h">
 			</File>
+		</Filter>
+		<Filter
+			Name="conversion"
+			Filter="">
 			<File
-				RelativePath=".\tsputil.cpp">
+				RelativePath=".\convtest.cpp">
 			</File>
 			<File
-				RelativePath=".\tsputil.h">
+				RelativePath=".\convtest.h">
 			</File>
 		</Filter>
 		<Filter
@@ -343,6 +369,18 @@
 			Name="formatting"
 			Filter="">
 			<File
+				RelativePath=".\astrotst.cpp">
+			</File>
+			<File
+				RelativePath=".\astrotst.h">
+			</File>
+			<File
+				RelativePath=".\calcasts.cpp">
+			</File>
+			<File
+				RelativePath=".\calcasts.h">
+			</File>
+			<File
 				RelativePath=".\callimts.cpp">
 			</File>
 			<File
@@ -530,6 +568,37 @@
 			</File>
 		</Filter>
 		<Filter
+			Name="idna"
+			Filter="*.c,*.h">
+			<File
+				RelativePath=".\idnaref.cpp">
+			</File>
+			<File
+				RelativePath=".\idnaref.h">
+			</File>
+			<File
+				RelativePath=".\nptrans.cpp">
+			</File>
+			<File
+				RelativePath=".\nptrans.h">
+			</File>
+			<File
+				RelativePath=".\punyref.c">
+			</File>
+			<File
+				RelativePath=".\punyref.h">
+			</File>
+			<File
+				RelativePath=".\testidn.cpp">
+			</File>
+			<File
+				RelativePath=".\testidna.cpp">
+			</File>
+			<File
+				RelativePath=".\testidna.h">
+			</File>
+		</Filter>
+		<Filter
 			Name="locales &amp; resources"
 			Filter="">
 			<File
@@ -684,6 +753,18 @@
 			</File>
 			<File
 				RelativePath=".\ustrtest.cpp">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath=".\ustrtest.h">
@@ -752,41 +833,6 @@
 			<File
 				RelativePath=".\unhxtrts.h">
 			</File>
-		</Filter>
-		<Filter
-			Name="idna"
-			Filter="*.c,*.h">
-			<File
-				RelativePath=".\idnaref.cpp">
-			</File>
-			<File
-				RelativePath=".\idnaref.h">
-			</File>
-			<File
-				RelativePath=".\nptrans.cpp">
-			</File>
-			<File
-				RelativePath=".\nptrans.h">
-			</File>
-			<File
-				RelativePath=".\punyref.c">
-			</File>
-			<File
-				RelativePath=".\punyref.h">
-			</File>
-			<File
-				RelativePath=".\testidn.cpp">
-			</File>
-			<File
-				RelativePath=".\testidna.cpp">
-			</File>
-			<File
-				RelativePath=".\testidna.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="collections"
-			Filter="">
 		</Filter>
 	</Files>
 	<Globals>

Index: itercoll.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/itercoll.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- itercoll.cpp	10 Sep 2003 02:42:48 -0000	1.4
+++ itercoll.cpp	6 Apr 2004 10:09:38 -0000	1.5
@@ -173,6 +173,18 @@
 void CollationIteratorTest::TestOffset(/* char* par */)
 {
     CollationElementIterator *iter = en_us->createCollationElementIterator(test1);
+    UErrorCode status = U_ZERO_ERROR;
+    // testing boundaries
+    iter->setOffset(0, status);
+    if (U_FAILURE(status) || iter->previous(status) != UCOL_NULLORDER) {
+        errln("Error: After setting offset to 0, we should be at the end "
+                "of the backwards iteration");
+    }
+    iter->setOffset(test1.length(), status);
+    if (U_FAILURE(status) || iter->next(status) != UCOL_NULLORDER) {
+        errln("Error: After setting offset to end of the string, we should "
+                "be at the end of the backwards iteration");
+    }
 
     // Run all the way through the iterator, then get the offset
     int32_t orderLength = 0;
@@ -190,7 +202,6 @@
 
     // Now set the offset back to the beginning and see if it works
     CollationElementIterator *pristine = en_us->createCollationElementIterator(test1);
-    UErrorCode status = U_ZERO_ERROR;
 
     iter->setOffset(0, status);
 

Index: itformat.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/itformat.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- itformat.cpp	10 Sep 2003 02:42:48 -0000	1.4
+++ itformat.cpp	6 Apr 2004 10:09:38 -0000	1.5
@@ -39,7 +39,9 @@
 #include "pptest.h"         // ParsePositionTest
 #include "calregts.h"       // CalendarRegressionTest
 #include "tzregts.h"        // TimeZoneRegressionTest
+#include "astrotst.h"       // AstroTest
 #include "incaltst.h"       // IntlCalendarTest
+#include "calcasts.h"       // CalendarCaseTest
 
 #define TESTCLASS(id, TestClass)          \
     case id:                              \
@@ -97,20 +99,9 @@
         TESTCLASS(24,CalendarRegressionTest);
         TESTCLASS(25,TimeZoneRegressionTest);
         TESTCLASS(26,IntlCalendarTest);
+        TESTCLASS(27,AstroTest);
+        TESTCLASS(28,CalendarCaseTest);
 
-        //TESTCLASS(0,IntlTestDateFormatSymbolsC);
-        //TESTCLASS(0,IntlTestDecimalFormatSymbolsC);
-        //TESTCLASS(0,IntlTestSimpleDateFormatAPIC);
-        //TESTCLASS(0,IntlTestDateFormatAPIC);
-        //TESTCLASS(0,IntlTestDecimalFormatAPIC);
-        //TESTCLASS(0,IntlTestNumberFormatAPIC);
-        //TESTCLASS(0,CNumberSpelloutFormatTest);
-        //TESTCLASS(0,CNumberSpelloutFormatRoundTripTest);
-        //TESTCLASS(0,TestCwrapperFormatSmallClasses);
-        //TESTCLASS(0,TestCwrapperMessageFormat);
-        //TESTCLASS(0,TestCwrapperChoiceFormat);
-        //TESTCLASS(0,TestCwrapperCalendar);
-        //TESTCLASS(0,TestCwrapperTimeZone);
         default: name = ""; break; //needed to end loop
     }
     if (exec) {

Index: itmajor.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/itmajor.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- itmajor.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ itmajor.cpp	6 Apr 2004 10:09:38 -0000	1.4
@@ -20,7 +20,6 @@
 #include "itutil.h"
 #include "tscoll.h"
 #include "itformat.h"
-//%#include "itconv.h"
 #include "ittrans.h"
 #include "itrbbi.h"
 #include "itrbnf.h"
@@ -31,6 +30,8 @@
 #include "canittst.h"
 #include "icusvtst.h"
 #include "testidna.h"
+#include "convtest.h"
+
 #define CASE_SUITE(id, suite) case id:                  \
                           name = #suite;                \
                           if(exec) {                    \
@@ -147,6 +148,16 @@
             }
 #endif
             break;
+        case 11: name = "convert";
+#if !UCONFIG_NO_LEGACY_CONVERSION
+                if (exec) {
+                    logln("TestSuite Conversion---"); logln();
+                    ConversionTest test;
+                    callTest( test, par );
+                }
+#endif
+                break;
+
         default: name = ""; break;
     }
 }

Index: itrbnf.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/itrbnf.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- itrbnf.cpp	10 Sep 2003 02:42:48 -0000	1.5
+++ itrbnf.cpp	6 Apr 2004 10:09:38 -0000	1.6
@@ -43,25 +43,25 @@
     if (exec) logln("TestSuite RuleBasedNumberFormat");
     switch (index) {
 #if U_HAVE_RBNF
-      TESTCASE(0, TestEnglishSpellout);
-      TESTCASE(1, TestOrdinalAbbreviations);
-      TESTCASE(2, TestDurations);
-      TESTCASE(3, TestSpanishSpellout);
-      TESTCASE(4, TestFrenchSpellout);
-      TESTCASE(5, TestSwissFrenchSpellout);
-      TESTCASE(6, TestItalianSpellout);
-      TESTCASE(7, TestGermanSpellout);
-      TESTCASE(8, TestThaiSpellout);
-      TESTCASE(9, TestAPI);
-      TESTCASE(10, TestFractionalRuleSet);
-      TESTCASE(11, TestSwedishSpellout);
-	  TESTCASE(12, TestBelgianFrenchSpellout);
+        TESTCASE(0, TestEnglishSpellout);
+        TESTCASE(1, TestOrdinalAbbreviations);
+        TESTCASE(2, TestDurations);
+        TESTCASE(3, TestSpanishSpellout);
+        TESTCASE(4, TestFrenchSpellout);
+        TESTCASE(5, TestSwissFrenchSpellout);
+        TESTCASE(6, TestItalianSpellout);
+        TESTCASE(7, TestGermanSpellout);
+        TESTCASE(8, TestThaiSpellout);
+        TESTCASE(9, TestAPI);
+        TESTCASE(10, TestFractionalRuleSet);
+        TESTCASE(11, TestSwedishSpellout);
+        TESTCASE(12, TestBelgianFrenchSpellout);
 #else
-      TESTCASE(0, TestRBNFDisabled);
+        TESTCASE(0, TestRBNFDisabled);
 #endif
     default:
-      name = "";
-      break;
+        name = "";
+        break;
     }
 }
 
@@ -1174,33 +1174,33 @@
 }
 
 static const char* swissFrenchTestData[][2] = {
-	{ "1", "un" },
-	{ "15", "quinze" },
-	{ "20", "vingt" },
-	{ "21", "vingt-et-un" },
-	{ "23", "vingt-trois" },
-	{ "62", "soixante-deux" },
-	{ "70", "septante" },
-	{ "71", "septante-et-un" },
-	{ "73", "septante-trois" },
-	{ "80", "huitante" },
-	{ "88", "huitante-huit" },
-	{ "100", "cent" },
-	{ "106", "cent six" },
-	{ "127", "cent vingt-sept" },
-	{ "200", "deux cents" },
-	{ "579", "cinq cents septante-neuf" },
-	{ "1,000", "mille" },
-	{ "1,123", "onze cents vingt-trois" },
-	{ "1,594", "mille cinq cents nonante-quatre" },
-	{ "2,000", "deux mille" },
-	{ "3,004", "trois mille quatre" },
-	{ "4,567", "quatre mille cinq cents soixante-sept" },
-	{ "15,943", "quinze mille neuf cents quarante-trois" },
-	{ "2,345,678", "deux million trois cents quarante-cinq mille six cents septante-huit" },
-	{ "-36", "moins trente-six" },
-	{ "234.567", "deux cents trente-quatre virgule cinq six sept" },
-	{ NULL, NULL}
+    { "1", "un" },
+    { "15", "quinze" },
+    { "20", "vingt" },
+    { "21", "vingt-et-un" },
+    { "23", "vingt-trois" },
+    { "62", "soixante-deux" },
+    { "70", "septante" },
+    { "71", "septante-et-un" },
+    { "73", "septante-trois" },
+    { "80", "huitante" },
+    { "88", "huitante-huit" },
+    { "100", "cent" },
+    { "106", "cent six" },
+    { "127", "cent vingt-sept" },
+    { "200", "deux cents" },
+    { "579", "cinq cents septante-neuf" },
+    { "1,000", "mille" },
+    { "1,123", "onze cents vingt-trois" },
+    { "1,594", "mille cinq cents nonante-quatre" },
+    { "2,000", "deux mille" },
+    { "3,004", "trois mille quatre" },
+    { "4,567", "quatre mille cinq cents soixante-sept" },
+    { "15,943", "quinze mille neuf cents quarante-trois" },
+    { "2,345,678", "deux million trois cents quarante-cinq mille six cents septante-huit" },
+    { "-36", "moins trente-six" },
+    { "234.567", "deux cents trente-quatre virgule cinq six sept" },
+    { NULL, NULL}
 };
 
 void 
@@ -1226,10 +1226,10 @@
         = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("fr", "BE", ""), status);
     
     if (U_FAILURE(status)) {
-		fprintf(stderr, "rbnf status: %d (%x)\n", status, status);
+        errln("rbnf status: 0x%x (%s)\n", status, u_errorName(status));
         errln("FAIL: could not construct formatter");
     } else {
-		// Belgian french should match Swiss french.
+        // Belgian french should match Swiss french.
         doTest(formatter, swissFrenchTestData, TRUE);
     }
     delete formatter;
@@ -1469,9 +1469,7 @@
                             UnicodeString msg = "FAIL: formatter could not parse ";
                             msg.append(actualString);
                             msg.append(" status code: " );
-                            char buffer[32];
-                            sprintf(buffer, "0x%x", status);
-                            msg.append(buffer);
+                            msg.append(u_errorName(status));
                             errln(msg);
                             break;
                         } else {

Index: itrbnfrt.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/itrbnfrt.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- itrbnfrt.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ itrbnfrt.cpp	6 Apr 2004 10:09:38 -0000	1.4
@@ -1,6 +1,6 @@
 /*
  *******************************************************************************
- * Copyright (C) 1996-2000, International Business Machines Corporation and    *
+ * Copyright (C) 1996-2003, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  */
@@ -12,7 +12,8 @@
 #include "itrbnfrt.h"
 
 #include "unicode/fmtable.h"
-#include "math.h" // fabs
+#include <math.h> // fabs
+#include <stdio.h>
 
 // current macro not in icu1.8.1
 #define TESTCASE(id,test)             \

Index: ittrans.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/ittrans.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ittrans.cpp	10 Sep 2003 02:42:48 -0000	1.4
+++ ittrans.cpp	6 Apr 2004 10:09:39 -0000	1.5
@@ -1,6 +1,6 @@
 /***************************************************************************
 *
-*   Copyright (C) 2000-2002, International Business Machines
+*   Copyright (C) 2000-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ************************************************************************
@@ -47,12 +47,14 @@
         CASE(2, CompoundTransliteratorTest);
         CASE(3, UniToHexTransliteratorTest);
         CASE(4, HexToUniTransliteratorTest);
-        CASE(5, UnicodeFilterLogicTest);
-        CASE(6, TransliteratorRoundTripTest);
-        CASE(7, UnicodeSetTest);
-        CASE(8, JamoTest);
-        CASE(9, TransliteratorErrorTest);
-        CASE(10, ReplaceableTest);
+        CASE(5, TransliteratorRoundTripTest);
+        CASE(6, UnicodeSetTest);
+        CASE(7, JamoTest);
+        CASE(8, TransliteratorErrorTest);
+        CASE(9, ReplaceableTest);
+#if !UCONFIG_NO_TRANSLITERATION && defined(U_USE_UNICODE_FILTER_LOGIC_OBSOLETE_2_8)
+        CASE(10, UnicodeFilterLogicTest);
+#endif
 
         default: name=""; break;
     }

Index: itutil.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/itutil.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- itutil.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ itutil.cpp	6 Apr 2004 10:09:39 -0000	1.4
@@ -18,10 +18,10 @@
 #include "ucdtest.h"
 #include "restest.h"
 #include "restsnew.h"
-#include "tsmutex.h"
 #include "tsmthred.h"
 #include "tsputil.h"
 #include "uobjtest.h"
+#include "v32test.h"
 //#include "custrtest.h"
 //#include "ccitrtst.h"
 //#include "cloctest.h"
@@ -33,15 +33,6 @@
     if (exec) logln("TestSuite Utilities: ");
     switch (index) {
         case 0:
-            name = "MutexTest"; 
-            if (exec) {
-                logln("MutexTest---"); logln("");
-                MutexTest test;
-                callTest( test, par );
-            }
-            break;
-
-        case 1:
             name = "MultithreadTest"; 
             if (exec) {
                 logln("MultithreadTest---"); logln("");
@@ -50,7 +41,7 @@
             }
             break;
 
-        case 2:
+        case 1:
             name = "StringTest"; 
             if (exec) {
                 logln("StringTest---"); logln("");
@@ -59,7 +50,7 @@
             }
             break;
 
-        case 3:
+        case 2:
             name = "UnicodeStringTest"; 
             if (exec) {
                 logln("UnicodeStringTest---"); logln("");
@@ -68,7 +59,7 @@
             }
             break;
 
-        case 4:
+        case 3:
             name = "LocaleTest"; 
             if (exec) {
                 logln("LocaleTest---"); logln("");
@@ -77,7 +68,7 @@
             }
             break;
 
-        case 5:
+        case 4:
             name = "CharIterTest"; 
             if (exec) {
                 logln("CharIterTest---"); logln("");
@@ -86,7 +77,7 @@
             }
             break;
 
-        case 6:
+        case 5:
             name = "UnicodeTest"; 
             if (exec) {
                 logln("UnicodeTest---"); logln("");
@@ -95,7 +86,7 @@
             }
             break;
 
-        case 7:
+        case 6:
             name = "ResourceBundleTest"; 
             if (exec) {
                 logln("ResourceBundleTest---"); logln("");
@@ -103,7 +94,7 @@
                 callTest( test, par );
             }
             break;
-        case 8:
+        case 7:
             name = "NewResourceBundleTest"; 
             if (exec) {
                 logln("NewResourceBundleTest---"); logln("");
@@ -112,7 +103,7 @@
             }
             break;
 
-        case 9:
+        case 8:
             name = "PUtilTest"; 
             if (exec) {
                 logln("PUtilTest---"); logln("");
@@ -121,14 +112,23 @@
             }
             break;
             
-    case 10:
-      name = "UObjectTest";
-      if(exec) {
-        logln ("UObjectTest---"); logln("");
-        UObjectTest test;
-        callTest( test, par );
-      }
-      break;;
+        case 9:
+            name = "UObjectTest";
+            if(exec) {
+                logln ("UObjectTest---"); logln("");
+                UObjectTest test;
+                callTest( test, par );
+            }
+            break;;
+
+        case 10:
+            name = "UVector32Test";
+            if(exec) {
+                logln ("UVector32Test---"); logln("");
+                UVector32Test test;
+                callTest( test, par );
+            }
+            break;;
 
         /*
         case 8:
@@ -137,44 +137,6 @@
                 logln("LocaleTest---"); logln("");
                 CLocaleTest test;
                 callTest( test, par );
-            }
-            break;
-
-
-        case 9:
-            name = "UnicodeStringCAPI";
-            if (exec) {
-                logln("UnicodeString C Round Trip test---"); logln("");
-                CUnicodeStringTest test;
-                callTest(test, par);
-            }
-            break;
-
-        case 10:
-            name = "CharacterIteratorCAPI";
-            if (exec) {
-                logln("CharacterIterator C Round Trip test---"); logln("");
-                CCharIterTest test;
-                callTest(test, par);
-            }
-            break;
-
-
-        case 11:
-            name = "UnicodeCAPI";
-            if (exec) {
-                logln("Unicode C-API test---"); logln();
-                TestCwrapperUnicode test;
-                callTest(test, par);
-            }
-            break;
-
-        case 12:
-            name = "ResourceBundleCAPI";
-            if (exec) {
-                logln("ResourceBundle C-API test---"); logln();
-                TestCwrapperResourceBundle test;
-                callTest(test, par);
             }
             break;
         */

Index: loctest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/loctest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- loctest.cpp	10 Sep 2003 02:42:48 -0000	1.4
+++ loctest.cpp	6 Apr 2004 10:09:39 -0000	1.5
@@ -1,85 +1,122 @@
 /********************************************************************
- * COPYRIGHT: 
+ * COPYRIGHT:
  * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
 #include "loctest.h"
 #include <stdio.h>
-#include <string.h>
-#include <cstring.h>
[...1514 lines suppressed...]
+            coll = 0;
+        }
+
+        // After unregistering, should behave normally again
+        coll = Collator::createInstance(reqLoc, ec);
+        if (U_FAILURE(ec)) {
+            errln("FAIL: Collator::createInstance failed");
+        } else {
+            valid = coll->getLocale(ULOC_VALID_LOCALE, ec);
+            actual = coll->getLocale(ULOC_ACTUAL_LOCALE, ec);
+            if (U_FAILURE(ec)) {
+                errln("FAIL: Collator::getLocale() failed");
+            } else {
+                _checklocs("Collator(unregistered)", req, valid, actual);
+            }
+        }
+    }
+    delete coll;
+#endif
+}

Index: loctest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/loctest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- loctest.h	10 Sep 2003 02:42:48 -0000	1.3
+++ loctest.h	6 Apr 2004 10:09:39 -0000	1.4
@@ -69,6 +69,15 @@
     void Test4147552(void);
     
     void TestVariantParsing(void);
+
+   /* Test getting keyword enumeratin */
+   void TestKeywordVariants(void);
+
+   /* Test getting keyword values */
+   void TestKeywordVariantParsing(void);
+
+   /* Test getting the locale base name */
+   void TestGetBaseName(void);
     
 #if !UCONFIG_NO_FORMATTING
     void Test4105828(void) ;
@@ -76,11 +85,20 @@
 
     void TestSetIsBogus(void);
 
+    void TestGetLocale();
+
 #if !UCONFIG_NO_FORMATTING
     static UDate date(int32_t y, int32_t m, int32_t d, int32_t hr = 0, int32_t min = 0, int32_t sec = 0);
 #endif
 
 private:
+    void _checklocs(const char* label,
+                    const char* req,
+                    const Locale& validLoc,
+                    const Locale& actualLoc,
+                    const char* expReqValid="gt",
+                    const char* expValidActual="ge"); 
+
     /**
      * routine to perform subtests, used by TestDisplayNames
      **/
@@ -98,37 +116,46 @@
         CROATIAN = 2,
         GREEK = 3,
         NORWEGIAN = 4,
-        MAX_LOCALES = 4
+        ITALIAN = 5,
+        XX = 6,
+        CHINESE = 7,
+        MAX_LOCALES = 7
     };
 
     enum {
         LANG = 0,
-        CTRY = 1,
-        VAR = 2,
-        NAME = 3,
-        LANG3 = 4,
-        CTRY3 = 5,
-        LCID = 6,
-        DLANG_EN = 7,
-        DCTRY_EN = 8,
-        DVAR_EN = 9,
-        DNAME_EN = 10,
-        DLANG_FR = 11,
-        DCTRY_FR = 12,
-        DVAR_FR = 13,
-        DNAME_FR = 14,
-        DLANG_HR = 15,
-        DCTRY_HR = 16,
-        DVAR_HR = 17,
-        DNAME_HR = 18,
-        DLANG_EL = 19,
-        DCTRY_EL = 20,
-        DVAR_EL = 21,
-        DNAME_EL = 22,
-        DLANG_RT = 23,
-        DCTRY_RT = 24,
-        DVAR_RT = 25,
-        DNAME_RT = 26
+        SCRIPT,
+        CTRY,
+        VAR,
+        NAME,
+        LANG3,
+        CTRY3,
+        LCID,
+        DLANG_EN,
+        DSCRIPT_EN,
+        DCTRY_EN,
+        DVAR_EN,
+        DNAME_EN,
+        DLANG_FR,
+        DSCRIPT_FR,
+        DCTRY_FR,
+        DVAR_FR,
+        DNAME_FR,
+        DLANG_CA,
+        DSCRIPT_CA,
+        DCTRY_CA,
+        DVAR_CA,
+        DNAME_CA,
+        DLANG_EL,
+        DSCRIPT_EL,
+        DCTRY_EL,
+        DVAR_EL,
+        DNAME_EL,
+        DLANG_NO,
+        DSCRIPT_NO,
+        DCTRY_NO,
+        DVAR_NO,
+        DNAME_NO
     };
 };
 

Index: miscdtfm.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/miscdtfm.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- miscdtfm.cpp	10 Sep 2003 02:42:48 -0000	1.5
+++ miscdtfm.cpp	6 Apr 2004 10:09:39 -0000	1.6
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
  

Index: msfmrgts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/msfmrgts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- msfmrgts.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ msfmrgts.cpp	6 Apr 2004 10:09:39 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
  
@@ -206,24 +206,33 @@
                 temp = obj.getString(temp);
             else {
                 fmt = NumberFormat::createInstance(status);
-                fmt->format(obj.getType() == Formattable::kLong ? obj.getLong() : obj.getDouble(), temp);
+                switch (obj.getType()) {
+                case Formattable::kLong: fmt->format(obj.getLong(), temp); break;
+                case Formattable::kInt64: fmt->format(obj.getInt64(), temp); break;
+                case Formattable::kDouble: fmt->format(obj.getDouble(), temp); break;
+                default: break;
+                }
             }
 
             // convert to string if not already
             Formattable obj1 = params[i];
             temp1.remove();
-            if(obj1.getType() == Formattable::kDouble || obj1.getType() == Formattable::kLong) {
+            if(obj1.getType() == Formattable::kString)
+                temp1 = obj1.getString(temp1);
+            else {
                 fmt = NumberFormat::createInstance(status);
-                fmt->format(obj1.getType() == Formattable::kLong ? obj1.getLong() : obj1.getDouble(), temp1);
+                switch (obj1.getType()) {
+                case Formattable::kLong: fmt->format(obj1.getLong(), temp1); break;
+                case Formattable::kInt64: fmt->format(obj1.getInt64(), temp1); break;
+                case Formattable::kDouble: fmt->format(obj1.getDouble(), temp1); break;
+                default: break;
+                }
             }
-            else
-                temp1 = obj1.getString(temp1);
 
             //if (objs[i] != NULL && objs[i].getString(temp1) != params[i].getString(temp2)) {
             if (temp != temp1) {
                 errln("Parse failed on object " + objs[i].getString(temp1) + " at index : " + i);
-            }
-        
+            }       
         }
 
         delete fmt;

Index: nmfmapts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/nmfmapts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- nmfmapts.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ nmfmapts.cpp	6 Apr 2004 10:09:39 -0000	1.4
@@ -257,7 +257,7 @@
 		delete currencyStyle;
 	}
 	
-    virtual NumberFormat* createFormat(const Locale& loc, UNumberFormatStyle formatType)
+    virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType)
 	{
 		if (formatType == UNUM_CURRENCY) {
 			return (NumberFormat*)currencyStyle->clone();

Index: nmfmtrt.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/nmfmtrt.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- nmfmtrt.cpp	10 Sep 2003 02:42:48 -0000	1.4
+++ nmfmtrt.cpp	6 Apr 2004 10:09:39 -0000	1.5
@@ -16,6 +16,7 @@
 
 #include <float.h>
 #include <stdio.h>    // for sprintf
+#include <stdlib.h>
  
 // *****************************************************************************
 // class NumberFormatRoundTripTest
@@ -51,6 +52,31 @@
     return FALSE;
 }
 
+uint32_t
+NumberFormatRoundTripTest::randLong()
+{
+    // Assume 8-bit (or larger) rand values.  Also assume
+    // that the system rand() function is very poor, which it always is.
+    uint32_t d;
+    uint32_t i;
+    char* poke = (char*)&d;
+    for (i=0; i < sizeof(uint32_t); ++i)
+    {
+        poke[i] = (char)(rand() & 0xFF);
+    }
+    return d;
+}
+
+/**
+ * Return a random value from -range..+range.
+ */
+double 
+NumberFormatRoundTripTest::randomDouble(double range)
+{
+    double a = randFraction();
+    return (2.0 * range * a) - range;
+}
+
 void 
 NumberFormatRoundTripTest::start()
 {
@@ -177,16 +203,6 @@
         test(fmt, randomDouble(1e-78));  /*OS390 and OS400*/
 #endif /* OS390 and OS400*/
     }
-}
-
-/**
- * Return a random value from -range..+range.
- */
-double 
-NumberFormatRoundTripTest::randomDouble(double range)
-{
-    double a = randFraction();
-    return (2.0 * range * a) - range;
 }
 
 void 

Index: nmfmtrt.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/nmfmtrt.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- nmfmtrt.h	10 Sep 2003 02:42:48 -0000	1.3
+++ nmfmtrt.h	6 Apr 2004 10:09:39 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -14,7 +14,6 @@
 #include "unicode/numfmt.h"
 #include "unicode/fmtable.h"
 #include "intltest.h"
-#include <stdlib.h>
 
 /** 
  * Performs round-trip tests for NumberFormat
@@ -57,19 +56,7 @@
     /*
      * Return a random uint32_t
      **/
-    static uint32_t randLong()
-    {
-        // Assume 8-bit (or larger) rand values.  Also assume
-        // that the system rand() function is very poor, which it always is.
-        uint32_t d;
-        uint32_t i;
-        char* poke = (char*)&d;
-        for (i=0; i < sizeof(uint32_t); ++i)
-        {
-            poke[i] = (char)(rand() & 0xFF);
-        }
-        return d;
-    }
+    static uint32_t randLong();
 
     /**
      * Return a random double 0 <= x < 1.0

Index: nptrans.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/nptrans.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- nptrans.cpp	10 Sep 2003 02:42:48 -0000	1.1
+++ nptrans.cpp	6 Apr 2004 10:09:39 -0000	1.2
@@ -63,8 +63,11 @@
         // create the mapping transliterator
         int32_t ruleLen = 0;
         const UChar* ruleUChar = ures_getStringByKey(bundle, "MapNFKC",&ruleLen, &status);
-        UnicodeString rule(ruleUChar, ruleLen);
-        
+        int32_t mapRuleLen = 0;
+        const UChar *mapRuleUChar = ures_getStringByKey(bundle, "MapNoNormalization", &mapRuleLen, &status);
+        UnicodeString rule(mapRuleUChar, mapRuleLen);
+        rule.append(ruleUChar, ruleLen);
+
         mapping = Transliterator::createFromRules(UnicodeString("NamePrepTransform", ""), rule,
                                                    UTRANS_FORWARD, parseError,status);
         if(U_FAILURE(status)) {
@@ -162,7 +165,7 @@
         for(;bufIndex<bufLen;){
             U16_NEXT(buffer, bufIndex, bufLen, ch);
             if(unassigned.contains(ch)){
-                status = U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR;
+                status = U_IDNA_UNASSIGNED_ERROR;
                 rsource.releaseBuffer();
                 return 0;
             }
@@ -231,7 +234,7 @@
         U16_NEXT(b1, b1Index, b1Len, ch);
 
         if(prohibited.contains(ch) && ch!=0x0020){
-            status = U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR;
+            status = U_IDNA_PROHIBITED_ERROR;
             goto CLEANUP;
         }
 

Index: nptrans.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/nptrans.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- nptrans.h	10 Sep 2003 02:42:48 -0000	1.1
+++ nptrans.h	6 Apr 2004 10:09:39 -0000	1.2
@@ -22,7 +22,6 @@
 #if !UCONFIG_NO_IDNA
 #if !UCONFIG_NO_TRANSLITERATION
 
-#include "strprep.h"
 #include "unicode/uniset.h"
 #include "unicode/ures.h"
 #include "unicode/translit.h"

Index: numfmtst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/numfmtst.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- numfmtst.cpp	10 Sep 2003 02:42:48 -0000	1.5
+++ numfmtst.cpp	6 Apr 2004 10:09:39 -0000	1.6
@@ -61,6 +61,10 @@
         CASE(20,TestSymbolsWithBadLocale);
         CASE(21,TestAdoptDecimalFormatSymbols);
 
+		CASE(22,TestScientific2);
+		CASE(23,TestScientificGrouping);
+		CASE(24,TestInt64);
+
         default: name = ""; break;
     }
 }
@@ -96,9 +100,6 @@
 
     delete test;  
   }
-
-
-
 }
 
 // Test various patterns
@@ -146,7 +147,7 @@
   list1.append('1');
   list1.fDecimalAt = 1;
   DigitList list2;
-  list2.set(1);
+  list2.set((int32_t)1);
   if (list1 != list2) {
     errln("digitlist append, operator!= or set failed ");
   }
@@ -313,8 +314,10 @@
             ParsePosition pos(0);
             Formattable af;
             fmt.parse(s, af, pos);
-            if (af.getType() == Formattable::kLong) {
-                int32_t a = af.getLong();
+            if (af.getType() == Formattable::kLong ||
+                af.getType() == Formattable::kInt64) {
+                UErrorCode status = U_ZERO_ERROR;
+                int32_t a = af.getLong(&status);
                 if (pos.getIndex() == s.length())
                 {
                     logln((UnicodeString)"  -parse-> " + a);
@@ -334,6 +337,138 @@
     }
 }
 
+void
+NumberFormatTest::TestScientific2() {
+	// jb 2552
+    UErrorCode status = U_ZERO_ERROR;
+    DecimalFormat* fmt = (DecimalFormat*)NumberFormat::createCurrencyInstance("en_US", status);
+	if (U_SUCCESS(status)) {
+		double num = 12.34;
+		expect(*fmt, num, "$12.34");
+		fmt->setScientificNotation(TRUE);
+		expect(*fmt, num, "$1.23E1");
+		fmt->setScientificNotation(FALSE);
+		expect(*fmt, num, "$12.34");
+	}
+	delete fmt;
+}
+
+void 
+NumberFormatTest::TestScientificGrouping() {
+	// jb 2552
+    UErrorCode status = U_ZERO_ERROR;
+	DecimalFormat fmt("##0.00E0",status);
+	if (U_SUCCESS(status)) {
+		expect(fmt, .01234, "12.3E-3");
+		expect(fmt, .1234, "123E-3");
+		expect(fmt, 1.234, "1.23E0");
+		expect(fmt, 12.34, "12.3E0");
+		expect(fmt, 123.4, "123E0");
+		expect(fmt, 1234., "1.23E3");
+	}
+}
+
+static void setFromString(DigitList& dl, const char* str) {
+	char c;
+	UBool decimalSet = FALSE;
+	dl.clear();
+	while ((c = *str++)) {
+		if (c == '-') {
+			dl.fIsPositive = FALSE;
+		} else if (c == '+') {
+			dl.fIsPositive = TRUE;
+		} else if (c == '.') {
+			dl.fDecimalAt = dl.fCount;
+			decimalSet = TRUE;
+		} else {
+			dl.append(c);
+		}
+	}
+	if (!decimalSet) {
+		dl.fDecimalAt = dl.fCount;
+	}
+}
+
+void
+NumberFormatTest::TestInt64() {
+    UErrorCode status = U_ZERO_ERROR;
+	DecimalFormat fmt("#.#E0",status);
+	fmt.setMaximumFractionDigits(20);
+	if (U_SUCCESS(status)) {
+		expect(fmt, (Formattable)(int64_t)0, "0E0");
+		expect(fmt, (Formattable)(int64_t)-1, "-1E0");
+		expect(fmt, (Formattable)(int64_t)1, "1E0");
+		expect(fmt, (Formattable)(int64_t)2147483647, "2.147483647E9");
+		expect(fmt, (Formattable)((int64_t)-2147483647-1), "-2.147483648E9");
+		expect(fmt, (Formattable)(int64_t)U_INT64_MAX, "9.223372036854775807E18");
+		expect(fmt, (Formattable)(int64_t)U_INT64_MIN, "-9.223372036854775808E18");
+	}
+
+	// also test digitlist
+	int64_t int64max = U_INT64_MAX;
+	int64_t int64min = U_INT64_MIN;
+	const char* int64maxstr = "9223372036854775807";
+	const char* int64minstr = "-9223372036854775808";
+	UnicodeString fail("fail: ");
+
+	// test max int64 value
+	DigitList dl;
+	setFromString(dl, int64maxstr);
+	{
+		if (!dl.fitsIntoInt64(FALSE)) {
+			errln(fail + int64maxstr + " didn't fit");
+		}
+		int64_t int64Value = dl.getInt64();
+		if (int64Value != int64max) {
+			errln(fail + int64maxstr);
+		}
+		dl.set(int64Value);
+		int64Value = dl.getInt64();
+		if (int64Value != int64max) {
+			errln(fail + int64maxstr);
+		}
+	}
+	// test negative of max int64 value (1 shy of min int64 value)
+	dl.fIsPositive = FALSE;
+	{
+		if (!dl.fitsIntoInt64(FALSE)) {
+			errln(fail + "-" + int64maxstr + " didn't fit");
+		}
+		int64_t int64Value = dl.getInt64();
+		if (int64Value != -int64max) {
+			errln(fail + "-" + int64maxstr);
+		}
+		dl.set(int64Value);
+		int64Value = dl.getInt64();
+		if (int64Value != -int64max) {
+			errln(fail + "-" + int64maxstr);
+		}
+	}
+	// test min int64 value
+	setFromString(dl, int64minstr);
+	{
+		if (!dl.fitsIntoInt64(FALSE)) {
+			errln(fail + "-" + int64minstr + " didn't fit");
+		}
+		int64_t int64Value = dl.getInt64();
+		if (int64Value != int64min) {
+			errln(fail + int64minstr);
+		}
+		dl.set(int64Value);
+		int64Value = dl.getInt64();
+		if (int64Value != int64min) {
+			errln(fail + int64minstr);
+		}
+	}
+	// test negative of min int 64 value (1 more than max int64 value)
+	dl.fIsPositive = TRUE; // won't fit
+	{
+		if (dl.fitsIntoInt64(FALSE)) {
+			errln(fail + "-(" + int64minstr + ") didn't fit");
+		}
+	}
+}
+
 // -------------------------------------
 
 // Test the handling of quotes
@@ -1163,56 +1298,67 @@
 }
 
 void NumberFormatTest::TestRegCurrency(void) {
-  UErrorCode status = U_ZERO_ERROR;
-  const UChar* USD = ucurr_forLocale("en_US", &status);
-  const UChar* YEN = ucurr_forLocale("ja_JP", &status);
-  if(U_FAILURE(status)) {
-    errln("Unable to get currency for locale, error %s", u_errorName(status));
-    return;
-  }
-
-  UCurrRegistryKey enkey = ucurr_register(YEN, "en_US", &status);
-  UCurrRegistryKey enUSEUROkey = ucurr_register(EUR, "en_US_EURO", &status);
-
-  if (u_strcmp(YEN, ucurr_forLocale("en_US", &status)) != 0) {
-    errln("FAIL: didn't return YEN registered for en_US");
-  }
-
-  if (u_strcmp(EUR, ucurr_forLocale("en_US_EURO", &status)) != 0) {
-    errln("FAIL: didn't return EUR for en_US_EURO");
-  }
-
-  if (ucurr_forLocale("en_XX_BAR", &status) != NULL) {
-    errln("FAIL: tried to fallback en_XX_BAR");
-  }
-  status = U_ZERO_ERROR; // reset
-  
-  if (!ucurr_unregister(enkey, &status)) {
-    errln("FAIL: couldn't unregister enkey");
-  }
-
-  if (u_strcmp(USD, ucurr_forLocale("en_US", &status)) != 0) {
-    errln("FAIL: didn't return USD for en_US after unregister of en_US");
-  }
-  status = U_ZERO_ERROR; // reset
-
-  if (u_strcmp(EUR, ucurr_forLocale("en_US_EURO", &status)) != 0) {
-    errln("FAIL: didn't return EUR for en_US_EURO after unregister of en_US");
-  }
-
-  if (u_strcmp(USD, ucurr_forLocale("en_US_BLAH", &status)) != 0) {
-    errln("FAIL: could not find USD for en_US_BLAH after unregister of en");
-  }
-  status = U_ZERO_ERROR; // reset
+    UErrorCode status = U_ZERO_ERROR;
+    UChar USD[4];
+    ucurr_forLocale("en_US", USD, 4, &status);
+    UChar YEN[4];
+    ucurr_forLocale("ja_JP", YEN, 4, &status);
+    UChar TMP[4];
+    static const UChar QQQ[] = {0x51, 0x51, 0x51, 0};
+    if(U_FAILURE(status)) {
+        errln("Unable to get currency for locale, error %s", u_errorName(status));
+        return;
+    }
+    
+    UCurrRegistryKey enkey = ucurr_register(YEN, "en_US", &status);
+    UCurrRegistryKey enUSEUROkey = ucurr_register(QQQ, "en_US_EURO", &status);
+    
+    ucurr_forLocale("en_US", TMP, 4, &status);
+    if (u_strcmp(YEN, TMP) != 0) {
+        errln("FAIL: didn't return YEN registered for en_US");
+    }
 
-  if (!ucurr_unregister(enUSEUROkey, &status)) {
-    errln("FAIL: couldn't unregister enUSEUROkey");
-  }
+    ucurr_forLocale("en_US_EURO", TMP, 4, &status);
+    if (u_strcmp(QQQ, TMP) != 0) {
+        errln("FAIL: didn't return QQQ for en_US_EURO");
+    }
+    
+    int32_t fallbackLen = ucurr_forLocale("en_XX_BAR", TMP, 4, &status);
+    if (fallbackLen) {
+        errln("FAIL: tried to fallback en_XX_BAR");
+    }
+    status = U_ZERO_ERROR; // reset
+    
+    if (!ucurr_unregister(enkey, &status)) {
+        errln("FAIL: couldn't unregister enkey");
+    }
 
-  if (ucurr_forLocale("en_US_EURO", &status) != NULL) {
-    errln("FAIL: didn't return NULL for en_US_EURO after unregister of en_US_EURO");
-  }
-  status = U_ZERO_ERROR; // reset
+    ucurr_forLocale("en_US", TMP, 4, &status);        
+    if (u_strcmp(USD, TMP) != 0) {
+        errln("FAIL: didn't return USD for en_US after unregister of en_US");
+    }
+    status = U_ZERO_ERROR; // reset
+    
+    ucurr_forLocale("en_US_EURO", TMP, 4, &status);
+    if (u_strcmp(QQQ, TMP) != 0) {
+        errln("FAIL: didn't return QQQ for en_US_EURO after unregister of en_US");
+    }
+    
+    ucurr_forLocale("en_US_BLAH", TMP, 4, &status);
+    if (u_strcmp(USD, TMP) != 0) {
+        errln("FAIL: could not find USD for en_US_BLAH after unregister of en");
+    }
+    status = U_ZERO_ERROR; // reset
+    
+    if (!ucurr_unregister(enUSEUROkey, &status)) {
+        errln("FAIL: couldn't unregister enUSEUROkey");
+    }
+    
+    ucurr_forLocale("en_US_EURO", TMP, 4, &status);
+    if (u_strcmp(EUR, TMP) != 0) {
+        errln("FAIL: didn't return EUR for en_US_EURO after unregister of en_US_EURO");
+    }
+    status = U_ZERO_ERROR; // reset
 }
 
 void NumberFormatTest::TestSymbolsWithBadLocale(void) {
@@ -1233,10 +1379,14 @@
     if (strcmp(mySymbols.getLocale().getName(), locBad.getName()) != 0) {
         errln("DecimalFormatSymbols does not have the right locale.");
     }
-    DecimalFormatSymbols::ENumberFormatSymbol symbolEnum;
-    int *symbolEnumPtr = (int*)(&symbolEnum);
-    for (symbolEnum = DecimalFormatSymbols::kDecimalSeparatorSymbol; symbolEnum < DecimalFormatSymbols::kFormatSymbolCount; (*symbolEnumPtr)++) {
-        if (mySymbols.getSymbol(symbolEnum).length() == 0 && symbolEnum != DecimalFormatSymbols::kGroupingSeparatorSymbol) {
+    int symbolEnum = (int)DecimalFormatSymbols::kDecimalSeparatorSymbol;
+    for (; symbolEnum < (int)DecimalFormatSymbols::kFormatSymbolCount; symbolEnum++) {
+        logln(UnicodeString("DecimalFormatSymbols[") + symbolEnum + UnicodeString("] = ")
+            + prettify(mySymbols.getSymbol((DecimalFormatSymbols::ENumberFormatSymbol)symbolEnum)));
+
+        if (mySymbols.getSymbol((DecimalFormatSymbols::ENumberFormatSymbol)symbolEnum).length() == 0
+            && symbolEnum != (int)DecimalFormatSymbols::kGroupingSeparatorSymbol)
+        {
             errln("DecimalFormatSymbols has an empty string at index %d.", symbolEnum);
         }
     }
@@ -1325,17 +1475,27 @@
 //----------------------------------------------------------------------
 
 UBool NumberFormatTest::equalValue(const Formattable& a, const Formattable& b) {
+    if (a.getType() == b.getType()) {
+        return a == b;
+    }
+
     if (a.getType() == Formattable::kLong) {
-        if (b.getType() == Formattable::kLong) {
+        if (b.getType() == Formattable::kInt64) {
             return a.getLong() == b.getLong();
         } else if (b.getType() == Formattable::kDouble) {
-            return (double) a.getLong() == b.getDouble();
+            return (double) a.getLong() == b.getDouble(); // TODO check use of double instead of long 
         }
     } else if (a.getType() == Formattable::kDouble) {
         if (b.getType() == Formattable::kLong) {
             return a.getDouble() == (double) b.getLong();
+        } else if (b.getType() == Formattable::kInt64) {
+            return a.getDouble() == (double)b.getInt64();
+        }
+    } else if (a.getType() == Formattable::kInt64) {
+        if (b.getType() == Formattable::kLong) {
+                return a.getInt64() == (int64_t)b.getLong();
         } else if (b.getType() == Formattable::kDouble) {
-            return a.getDouble() == b.getDouble();
+            return a.getInt64() == (int64_t)b.getDouble();
         }
     }
     return FALSE;
@@ -1433,9 +1593,10 @@
     UErrorCode ec = U_ZERO_ERROR;
     DecimalFormat& fmt = * (DecimalFormat*) &nf;
     const UChar DEFAULT_CURR[] = {45/*-*/,0};
-    const UChar* curr = DEFAULT_CURR;
+    UChar curr[4];
+    u_strcpy(curr, DEFAULT_CURR);
     if (*locale.getLanguage() != 0) {
-        curr = ucurr_forLocale(locale.getName(), &ec);
+        ucurr_forLocale(locale.getName(), curr, 4, &ec);
         if (U_FAILURE(ec)) {
             errln("FAIL: UCurrency::forLocale");
             return;
@@ -1503,9 +1664,11 @@
         apadStr = pad;
     }
     if (apos == pos && awidth == width && apadStr == pad) {
-        logln(UnicodeString("Ok   \"") + pat + "\" pos=" + apos +
-              ((pos == ILLEGAL) ? UnicodeString() :
-               (UnicodeString(" width=") + awidth + " pad=" + apadStr)));
+        UnicodeString infoStr;
+        if (pos == ILLEGAL) {
+            infoStr = UnicodeString(" width=", "") + awidth + UnicodeString(" pad=", "") + apadStr;
+        }
+        logln(UnicodeString("Ok   \"") + pat + "\" pos=" + apos + infoStr);
     } else {
         errln(UnicodeString("FAIL \"") + pat + "\" pos=" + apos +
               " width=" + awidth + " pad=" + apadStr +

Index: numfmtst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/numfmtst.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- numfmtst.h	10 Sep 2003 02:42:48 -0000	1.4
+++ numfmtst.h	6 Apr 2004 10:09:40 -0000	1.5
@@ -75,6 +75,12 @@
 
     void TestScientific(void);
 
+    void TestScientific2(void);
+
+    void TestScientificGrouping(void);
+
+    void TestInt64(void);
+
     void TestSurrogateSupport(void);
 
     /**

Index: numrgts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/numrgts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- numrgts.cpp	10 Sep 2003 02:42:48 -0000	1.3
+++ numrgts.cpp	6 Apr 2004 10:09:40 -0000	1.4
@@ -11,6 +11,7 @@
 #include "numrgts.h"
 
 #include <float.h> // DBL_MIN, DBL_MAX
+#include <stdio.h>
 
 #include "unicode/dcfmtsym.h"
 #include "unicode/decimfmt.h"
@@ -1306,7 +1307,7 @@
     UnicodeString temp;
     FieldPosition pos(FieldPosition::DONT_CARE);
 
-#if defined(HPUX)
+#if defined(U_HPUX)
     d1 = 0.0 * -1.0;    // old HPUX compiler ignores volatile keyword
 #else
     d1 *= -1.0; // Some compilers have a problem with defining -0.0
@@ -1437,7 +1438,7 @@
     FieldPosition pos(FieldPosition::DONT_CARE);
 
     logln("pattern: \"" + df->toPattern(temp) + "\"");
-#if defined(HPUX)
+#if defined(U_HPUX)
     d = 0.0 * -1.0;    // old HPUX compiler ignores volatile keyword
 #else
     d *= -1.0; // Some compilers have a problem with defining -0.0
@@ -1850,7 +1851,7 @@
     volatile double d1 = 0.0;   // volatile to prevent code optimization
     double d2 = -0.0001;
 
-#if defined(HPUX)
+#if defined(U_HPUX)
     d1 = 0.0 * -1.0;    // old HPUX compiler ignores volatile keyword
 #else
     d1 *= -1.0; // Some compilers have a problem with defining -0.0
@@ -1915,10 +1916,16 @@
     //}
     
     //logln("The string " + s + " parsed as " + n);
-    
-    if(n.getDouble() != dbl) {
-        errln("Round trip failure");
-    }
+
+    // {dlf} The old code assumes n is a double, but it isn't any more...
+    // Formattable apparently does not and never did interconvert... too bad.
+    //if(n.getDouble() != dbl) {
+    //    errln("Round trip failure");
+    //}
+	if (n.getInt64() != dbl) {
+		errln("Round trip failure");
+	}
+
     delete f;
 }
 

Index: numrgts.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/numrgts.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- numrgts.h	10 Sep 2003 02:42:49 -0000	1.3
+++ numrgts.h	6 Apr 2004 10:09:40 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -148,7 +148,13 @@
     }
     virtual Format* clone() const 
     { return NULL; }
+
     virtual UnicodeString& format(int32_t, 
+                UnicodeString& foo, 
+                FieldPosition&) const
+    { return foo.remove(); }
+
+    virtual UnicodeString& format(int64_t, 
                 UnicodeString& foo, 
                 FieldPosition&) const
     { return foo.remove(); }

Index: pptest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/pptest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pptest.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ pptest.cpp	6 Apr 2004 10:09:40 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -91,6 +91,11 @@
         errln("*** PP operator= operator== or operator != result");
     }
 
+    ParsePosition *ppp = pp5.clone();
+    if(ppp == &pp5 || *ppp != pp5) {
+        errln("ParsePosition.clone() failed");
+    }
+    delete ppp;
 }
 
 void ParsePositionTest::TestFieldPosition() 
@@ -142,6 +147,12 @@
     }
 
     logln("");
+
+    FieldPosition *pfp = fp.clone();
+    if(pfp == &fp || *pfp != fp) {
+        errln("FieldPosition.clone() failed");
+    }
+    delete pfp;
 }
 
 void ParsePositionTest::TestFieldPosition_example() 

Index: punyref.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/punyref.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- punyref.h	10 Sep 2003 02:42:49 -0000	1.1
+++ punyref.h	6 Apr 2004 10:09:40 -0000	1.2
@@ -34,7 +34,6 @@
 /************************************************************/
 /* Public interface (would normally go in its own .h file): */
 
-#include <limits.h>
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_IDNA

Index: rbbiapts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/rbbiapts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rbbiapts.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ rbbiapts.cpp	6 Apr 2004 10:09:41 -0000	1.4
@@ -20,6 +20,7 @@
 #include "rbbiapts.h"
 #include "rbbidata.h"
 #include "cstring.h"
+#include "unicode/ustring.h"
 
 /**
  * API Test the RuleBasedBreakIterator class
@@ -553,16 +554,17 @@
 }
 
 //
-//  TestWordStatus
+//  TestRuleStatus
 //      Test word break rule status constants.
 //
-void RBBIAPITest::TestWordStatus() {
-
-     
-     UnicodeString testString1 =   //                  Ideographic    Katakana       Hiragana
-             CharsToUnicodeString("plain word 123.45 \\u9160\\u9161 \\u30a1\\u30a2 \\u3041\\u3094");
-                                // 012345678901234567  8      9    0  1      2    3  4      5    6
-     int32_t bounds1[] =     {     0,   5,6, 10,11, 17,18,  19,   20,21,         23,24,    25,  26};
+void RBBIAPITest::TestRuleStatus() {
+     UChar str[30]; 
+     u_unescape("plain word 123.45 \\u9160\\u9161 \\u30a1\\u30a2 \\u3041\\u3094",
+              // 012345678901234567  8      9    0  1      2    3  4      5    6
+              //                    Ideographic    Katakana       Hiragana
+                str, 30);
+     UnicodeString testString1(str);
+     int32_t bounds1[] = {0, 5, 6, 10, 11, 17, 18, 19, 20, 21, 23, 24, 25, 26};
      int32_t tag_lo[]  = {UBRK_WORD_NONE,     UBRK_WORD_LETTER, UBRK_WORD_NONE,    UBRK_WORD_LETTER,
                           UBRK_WORD_NONE,     UBRK_WORD_NUMBER, UBRK_WORD_NONE,
                           UBRK_WORD_IDEO,     UBRK_WORD_IDEO,   UBRK_WORD_NONE,
@@ -599,6 +601,51 @@
          }
      }
      delete bi;
+
+     // Now test line break status.  This test mostly is to confirm that the status constants
+     //                              are correctly declared in the header.
+     testString1 =   "test line. \n";
+     // break type    s    s     h
+
+     bi = (RuleBasedBreakIterator *)
+         BreakIterator::createLineInstance(Locale::getEnglish(), status);
+     if(U_FAILURE(status)) {
+         errln("failed to create word break iterator.");
+     } else {
+         int32_t i = 0;
+         int32_t pos, tag;
+         UBool   success;
+
+         bi->setText(testString1);
+         pos = bi->current();
+         tag = bi->getRuleStatus();
+         for (i=0; i<3; i++) {
+             switch (i) {
+             case 0:
+                 success = pos==0  && tag==UBRK_LINE_SOFT; break;
+             case 1:
+                 success = pos==5  && tag==UBRK_LINE_SOFT; break;
+             case 2:
+                 success = pos==12 && tag==UBRK_LINE_HARD; break;
+             default:
+                 success = FALSE; break;
+             }
+             if (success == FALSE) {
+                 errln("Fail: incorrect word break status or position.  i=%d, pos=%d, tag=%d",
+                     i, pos, tag);
+                 break;
+             }
+             pos = bi->next();
+             tag = bi->getRuleStatus();
+         }
+         if (UBRK_LINE_SOFT >= UBRK_LINE_SOFT_LIMIT ||
+             UBRK_LINE_HARD >= UBRK_LINE_HARD_LIMIT ||
+             UBRK_LINE_HARD > UBRK_LINE_SOFT && UBRK_LINE_HARD < UBRK_LINE_SOFT_LIMIT ) {
+             errln("UBRK_LINE_* constants from header are inconsistent.");
+         }
+     }
+     delete bi;
+
 }
 
 
@@ -801,17 +848,17 @@
         case  2: name = "TestHashCode"; if (exec) TestHashCode(); break;
         case  3: name = "TestGetSetAdoptText"; if (exec) TestGetSetAdoptText(); break;
         case  4: name = "TestIteration"; if (exec) TestIteration(); break;
-        case  5: name = "extra"; break;   /* Extra */
-        case  6: name = "extra"; break;   /* Extra */
+        case  5: name = "extra"; break;   // Extra
+        case  6: name = "extra"; break;   // Extra
         case  7: name = "TestBuilder"; if (exec) TestBuilder(); break;
         case  8: name = "TestQuoteGrouping"; if (exec) TestQuoteGrouping(); break;
-        case  9: name = "TestWordStatus"; if (exec) TestWordStatus(); break;
+        case  9: name = "TestRuleStatus"; if (exec) TestRuleStatus(); break;
         case 10: name = "TestBug2190"; if (exec) TestBug2190(); break;
         case 11: name = "TestRegistration"; if (exec) TestRegistration(); break;
         case 12: name = "TestBoilerPlate"; if (exec) TestBoilerPlate(); break;
         case 13: name = "TestRoundtripRules"; if (exec) TestRoundtripRules(); break;
 
-        default: name = ""; break; /*needed to end loop*/
+        default: name = ""; break; // needed to end loop
     }
 }
 

Index: rbbiapts.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/rbbiapts.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rbbiapts.h	10 Sep 2003 02:42:49 -0000	1.3
+++ rbbiapts.h	6 Apr 2004 10:09:41 -0000	1.4
@@ -71,7 +71,7 @@
     /**
      *  Tests word break status returns.
      */
-    void TestWordStatus();
+    void TestRuleStatus();
 
     void TestBug2190();
 

Index: rbbitst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/rbbitst.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rbbitst.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ rbbitst.cpp	6 Apr 2004 10:09:41 -0000	1.5
@@ -22,6 +22,7 @@
 #include "unicode/schriter.h"
 #include "unicode/uniset.h"
 #include "unicode/regex.h"        // TODO: make conditional on regexp being built.
+#include "unicode/ustring.h"
 
 #include "intltest.h"
 #include "rbbitst.h"
@@ -292,6 +293,43 @@
 }
 
 
[...1748 lines suppressed...]
-                    errorText.append("<>");
-                }
+                errorText.append("<>");
                 errorText.append("</data>\n");
 
                 // Output the error
-                char  charErrorTxt[100];
+                char  charErrorTxt[500];
                 UErrorCode status = U_ZERO_ERROR;
                 errorText.extract(charErrorTxt, sizeof(charErrorTxt), NULL, status);
                 charErrorTxt[sizeof(charErrorTxt)-1] = 0;
-                errln("ERROR.  %s. Direction = %s; Random seed = %d;  buf Idx = %d\n%s",
-                    (expectedBreaks[i]? "break expected but not found" : "break found but not expected"),
-                    (forwardError?"forward":"reverse"), seed, i, charErrorTxt);
+                errln("%s break monkey test error.  %s. Operation = %s; Random seed = %d;  buf Idx = %d\n%s",
+                    name, (expectedBreaks[i]? "break expected but not found" : "break found but not expected"),
+                    errorType, seed, i, charErrorTxt);
                 break;
             }
         }

Index: rbbitst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/rbbitst.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rbbitst.h	10 Sep 2003 02:42:49 -0000	1.3
+++ rbbitst.h	6 Apr 2004 10:09:41 -0000	1.4
@@ -70,8 +70,10 @@
     UChar *ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode &status);
     void executeTest(TestParams *);
 
-    
- 
+    void TestWordBreaks();
+    void TestWordBoundary();
+    void TestLineBreaks();
+    void TestSentBreaks();
     
     
 /***********************/
@@ -117,7 +119,7 @@
     void doBreakInvariantTest(BreakIterator& tb, UnicodeString& testChars);
     void doOtherInvariantTest(BreakIterator& tb, UnicodeString& testChars);
 
-    void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, uint32_t  seed, int32_t loopCount);
+    void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t  seed, int32_t loopCount);
 
 };
 

Index: regextst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/regextst.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- regextst.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ regextst.cpp	6 Apr 2004 10:09:42 -0000	1.2
@@ -10,17 +10,18 @@
 //      ICU Regular Expressions test, part of intltest.
 //
 
-#include "unicode/utypes.h"
+#include "intltest.h"
 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
 
+#include "unicode/regex.h"
 #include "unicode/uchar.h"
 #include "unicode/ucnv.h"
-#include "intltest.h"
 #include "regextst.h"
 #include "uvector.h"
-#include "stdlib.h"
 #include "charstr.h"
 #include "util.h"
+#include <stdlib.h>
+#include <stdio.h>
 
 
 //---------------------------------------------------------------------------
@@ -127,7 +128,7 @@
             line, u_errorName(status));
         return FALSE;
     }
-    if (line==376) { REPattern->dump();}
+    if (line==376) { RegexPatternDump(REPattern);}
 
     UnicodeString inputString(inputText);
     UnicodeString unEscapedInput = inputString.unescape();
@@ -163,7 +164,7 @@
     }
 
     if (retVal == FALSE) {
-        REPattern->dump();
+        RegexPatternDump(REPattern);
     }
 
     delete REPattern;
@@ -243,12 +244,19 @@
 
     callerPattern = RegexPattern::compile(pattern, bflags, pe, status);
     if (status != U_ZERO_ERROR) {
+        #if UCONFIG_NO_BREAK_ITERATION==1
+        // 'v' test flag means that the test pattern should not compile if ICU was configured
+        //     to not include break iteration.  RBBI is needed for Unicode word boundaries.
+        if (flags.indexOf((UChar)0x76) >= 0 /*'v'*/ && status == U_UNSUPPORTED_ERROR) {
+            goto cleanupAndReturn;
+        }
+        #endif
         errln("Line %d: error %s compiling pattern.", line, u_errorName(status));
         goto cleanupAndReturn;
     }
 
     if (flags.indexOf((UChar)'d') >= 0) {
-        callerPattern->dump();
+        RegexPatternDump(callerPattern);
     }
 
     //
@@ -337,9 +345,9 @@
         
 cleanupAndReturn:
     if (failed) {
-        errln("\"%s\"  %s  \"%s\"", (const char *)CharString(pattern),
-                                    (const char *)CharString(flags),
-                                    (const char *)CharString(inputString));
+        errln("\"%s\"  %s  \"%s\"", (const char *)CharString(pattern, 0),
+                                    (const char *)CharString(flags, 0),
+                                    (const char *)CharString(inputString, 0));
         // callerPattern->dump();
     }
     delete parseMatcher;
@@ -599,6 +607,67 @@
         REGEX_ASSERT(m1->lookingAt(status) == FALSE);
         REGEX_ASSERT(m1->input() == empty);
         REGEX_ASSERT(&m1->pattern() == pat2);
+
+        //
+        //  reset(pos, status) 
+        //
+        m1->reset(inStr1);
+        m1->reset(4, status);
+        REGEX_CHECK_STATUS;
+        REGEX_ASSERT(m1->input() == inStr1);
+        REGEX_ASSERT(m1->lookingAt(status) == TRUE);
+
+        m1->reset(-1, status);
+        REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
+        status = U_ZERO_ERROR;
+
+        m1->reset(0, status);
+        REGEX_CHECK_STATUS;
+        status = U_ZERO_ERROR;
+
+        int32_t len = m1->input().length();
+        m1->reset(len-1, status);
+        REGEX_CHECK_STATUS;
+        status = U_ZERO_ERROR;
+
+        m1->reset(len, status);
+        REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
+        status = U_ZERO_ERROR;
+
+        //
+        // match(pos, status)
+        //
+        m1->reset(instr2);
+        REGEX_ASSERT(m1->matches(4, status) == TRUE);
+        m1->reset();
+        REGEX_ASSERT(m1->matches(3, status) == FALSE);
+        m1->reset();
+        REGEX_ASSERT(m1->matches(5, status) == FALSE);
+        REGEX_ASSERT(m1->matches(4, status) == TRUE);
+        REGEX_ASSERT(m1->matches(-1, status) == FALSE);
+        REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
+        status = U_ZERO_ERROR;
+        len = m1->input().length();
+        REGEX_ASSERT(m1->matches(len, status) == FALSE);
+        REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
+       
+
+        //
+        // lookingAt(pos, status)
+        //
+        status = U_ZERO_ERROR;
+        m1->reset(instr2);  // "not abc"
+        REGEX_ASSERT(m1->lookingAt(4, status) == TRUE);
+        REGEX_ASSERT(m1->lookingAt(5, status) == FALSE);
+        REGEX_ASSERT(m1->lookingAt(3, status) == FALSE);
+        REGEX_ASSERT(m1->lookingAt(4, status) == TRUE);
+        REGEX_ASSERT(m1->lookingAt(-1, status) == FALSE);
+        REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
+        status = U_ZERO_ERROR;
+        len = m1->input().length();
+        REGEX_ASSERT(m1->lookingAt(len, status) == FALSE);
+        REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
+        
         delete m1;
         delete pat2;
     }
@@ -750,6 +819,61 @@
     }
 
     //
+    //   find with zero length matches, match position should bump ahead
+    //     to prevent loops.
+    //
+    {
+        int                 i;
+        UErrorCode          status=U_ZERO_ERROR;
+        RegexMatcher        m("(?= ?)", 0, status);   // This pattern will zero-length matches anywhere,
+                                                      //   using an always-true look-ahead.
+        REGEX_CHECK_STATUS;
+        UnicodeString s("    ");
+        m.reset(s);
+        for (i=0; ; i++) {
+            if (m.find() == FALSE) {
+                break;
+            }
+            REGEX_ASSERT(m.start(status) == i);
+            REGEX_ASSERT(m.end(status) == i);
+        }
+        REGEX_ASSERT(i==5);
+
+        // Check that the bump goes over surrogate pairs OK
+        s = "\\U00010001\\U00010002\\U00010003\\U00010004";
+        s = s.unescape();
+        m.reset(s);
+        for (i=0; ; i+=2) {
+            if (m.find() == FALSE) {
+                break;
+            }
+            REGEX_ASSERT(m.start(status) == i);
+            REGEX_ASSERT(m.end(status) == i);
+        }
+        REGEX_ASSERT(i==10);
+    }
+    {
+        // find() loop breaking test.
+        //        with pattern of /.?/, should see a series of one char matches, then a single
+        //        match of zero length at the end of the input string.
+        int                 i;
+        UErrorCode          status=U_ZERO_ERROR;
+        RegexMatcher        m(".?", 0, status);     
+        REGEX_CHECK_STATUS;
+        UnicodeString s("    ");
+        m.reset(s);
+        for (i=0; ; i++) {
+            if (m.find() == FALSE) {
+                break;
+            }
+            REGEX_ASSERT(m.start(status) == i);
+            REGEX_ASSERT(m.end(status) == (i<4 ? i+1 : i));
+        }
+        REGEX_ASSERT(i==5);
+    }
+
+
+    //
     // Matchers with no input string behave as if they had an empty input string.
     //
 
@@ -947,7 +1071,7 @@
     REGEX_ASSERT(*pat1a == *pat1);
 
     REGEX_ASSERT(pat1a->flags() == 0);
-#if 0
+
     // Compile with different flags should be not equal
     RegexPattern        *pat1b = RegexPattern::compile(re1, UREGEX_CASE_INSENSITIVE, pe, status);
     REGEX_CHECK_STATUS;
@@ -956,18 +1080,12 @@
     REGEX_ASSERT(pat1b->flags() == UREGEX_CASE_INSENSITIVE);
     REGEX_ASSERT(pat1a->flags() == 0);
     delete pat1b;
-#endif    // add test back in when we actually support flag settings.
 
     // clone
     RegexPattern *pat1c = pat1->clone();
     REGEX_ASSERT(*pat1c == *pat1);
     REGEX_ASSERT(*pat1c != *pat2);
 
-
-    // TODO:  Actually do some matches with the cloned/copied/assigned patterns.
-
-
-
     delete pat1c;
     delete pat1a;
     delete pat1;
@@ -975,6 +1093,28 @@
 
 
     //
+    //   Verify that a matcher created from a cloned pattern works.
+    //     (Jitterbug 3423)
+    //
+    {
+        UErrorCode     status     = U_ZERO_ERROR;
+        RegexPattern  *pSource    = RegexPattern::compile("\\p{L}+", 0, status);
+        RegexPattern  *pClone     = pSource->clone();
+        delete         pSource;
+        RegexMatcher  *mFromClone = pClone->matcher(status);
+        REGEX_CHECK_STATUS;
+        UnicodeString s = "Hello World";
+        mFromClone->reset(s);
+        REGEX_ASSERT(mFromClone->find() == TRUE);
+        REGEX_ASSERT(mFromClone->group(status) == "Hello");
+        REGEX_ASSERT(mFromClone->find() == TRUE);
+        REGEX_ASSERT(mFromClone->group(status) == "World");
+        REGEX_ASSERT(mFromClone->find() == FALSE);
+        delete mFromClone;
+        delete pClone;
+    }
+
+    //
     //   matches convenience API
     //
     REGEX_ASSERT(RegexPattern::matches(".*", "random input", pe, status) == TRUE);
@@ -1175,29 +1315,49 @@
 //                     A description of the test data format is included in that file.
 //
 //---------------------------------------------------------------------------
+
+const char *
+RegexTest::getPath(char buffer[2048], const char *filename) {
+    UErrorCode status=U_ZERO_ERROR;
+    const char *testDataDirectory = loadTestData(status);
+    if (U_FAILURE(status)) {
+        errln("ERROR: loadTestData() failed - %s", u_errorName(status));
+	    return NULL;
+    }
+
+    const char *folder=U_FILE_SEP_STRING "out" U_FILE_SEP_STRING "testdata";
+    const char *outTestdata=strstr(testDataDirectory, folder);
+    if(outTestdata!=NULL) {
+        /* skip the initial '/' */
+        outTestdata+=strlen(U_FILE_SEP_STRING);
+        int32_t length=outTestdata-testDataDirectory;
+
+        /* replace the trailing folder with the filename */
+        memcpy(buffer, testDataDirectory, length);
+        strcpy(buffer+length, filename);
+        return buffer;
+    } else {
+        errln("Could not find test data file %s because test data directory does not contain %s", filename, folder);
+        return NULL;
+    }
+}
+
 void RegexTest::Extended() {
+    char tdd[2048];
+    const char *path;
     UErrorCode  status  = U_ZERO_ERROR;
     int32_t     lineNum = 0;
 
     //
     //  Open and read the test data file.
     //
-    const char *testDataDirectory = loadTestData(status);
-    if (U_FAILURE(status)) {
-        errln("ERROR: could not open test data %s", u_errorName(status));
-	    return;
-    }
-    UnicodeString tdd(testDataDirectory);
-    RegexMatcher m("([/\\\\])out[/\\\\]testdata", tdd, 0, status);
-    if(U_SUCCESS(status)) {
-      tdd = m.replaceFirst("$1regextst.txt", status);
-    } else {
-      errln("Couldn't set up tests. Error %s", u_errorName(status));
-      return;
+    path=getPath(tdd, "regextst.txt");
+    if(path==NULL) {
+        return; /* something went wrong, error already output */
     }
 
     int    len;
-    UChar *testData = ReadAndConvertFile((const char *)CharString(tdd), len, status);
+    UChar *testData = ReadAndConvertFile(path, len, status);
 
     //
     //  Put the test data into a UnicodeString
@@ -1206,7 +1366,7 @@
 
     RegexMatcher    quotedStuffMat("\\s*([\\'\\\"/])(.+?)\\1", 0, status);
     RegexMatcher    commentMat    ("\\s*(#.*)?$", 0, status); 
-    RegexMatcher    flagsMat      ("\\s*([ixsmdtG]*)([:letter:]*)", 0, status);
+    RegexMatcher    flagsMat      ("\\s*([ixsmdtGv]*)([:letter:]*)", 0, status);
 
     RegexMatcher    lineMat("(.*?)\\r?\\n", testString, 0, status);
     UnicodeString   testPattern;   // The pattern for test from the test file.
@@ -1502,28 +1662,21 @@
 //
 //-------------------------------------------------------------------------------
 void RegexTest::PerlTests() {
+    char tdd[2048];
+    const char *path;
     UErrorCode  status = U_ZERO_ERROR;
     UParseError pe;
 
     //
     //  Open and read the test data file.
     //
-    const char *testDataDirectory = loadTestData(status);
-    if (U_FAILURE(status)) {
-        errln("ERROR: could not open test data %s", u_errorName(status));
-	    return;
-    }
-    UnicodeString tdd(testDataDirectory);
-    RegexMatcher m("([/\\\\])out[/\\\\]testdata", tdd, 0, status);
-    if(U_SUCCESS(status)) {
-      tdd = m.replaceFirst("$1re_tests.txt", status);
-    } else {
-      errln("Couldn't set up tests. Error %s", u_errorName(status));
-      return;
+    path=getPath(tdd, "re_tests.txt");
+    if(path==NULL) {
+        return; /* something went wrong, error already output */
     }
 
     int    len;
-    UChar *testData = ReadAndConvertFile((const char *)CharString(tdd), len, status);
+    UChar *testData = ReadAndConvertFile(path, len, status);
 
     //
     //  Put the test data into a UnicodeString
@@ -1803,8 +1956,8 @@
 
         if (expectedS.compare(resultString) != 0) {
             errln("Line %d: Incorrect perl expression results.  Expected \"%s\"; got \"%s\"",
-                lineNum, (const char *)CharString(expectedS),
-                (const char *)CharString(resultString));
+                lineNum, (const char *)CharString(expectedS, 0),
+                (const char *)CharString(resultString, 0));
         }
 
         delete testMat;

Index: regextst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/regextst.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- regextst.h	10 Sep 2003 02:42:49 -0000	1.1
+++ regextst.h	6 Apr 2004 10:09:42 -0000	1.2
@@ -12,7 +12,6 @@
 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
 
 #include "intltest.h"
-#include "unicode/regex.h"
 
 
 class RegexTest: public IntlTest {
@@ -39,6 +38,8 @@
     virtual void regex_err(const char *pat, int32_t errline, int32_t errcol,
                             UErrorCode expectedStatus, int line);
     virtual UChar *ReadAndConvertFile(const char *fileName, int &len, UErrorCode &status);
+    virtual const char *getPath(char buffer[2048], const char *filename);
+
 };
 
 #endif   // !UCONFIG_NO_REGULAR_EXPRESSIONS

Index: restest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/restest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- restest.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ restest.cpp	6 Apr 2004 10:09:42 -0000	1.5
@@ -156,8 +156,7 @@
 */
 ResourceBundleTest::ResourceBundleTest()
 : pass(0),
-  fail(0),
-  OUT(it_out)
+  fail(0)
 {
     if (param[5].locale == NULL) {
         param[0].locale = new Locale("root");
@@ -187,6 +186,8 @@
     case 0: name = "TestResourceBundles"; if (exec) TestResourceBundles(); break;
     case 1: name = "TestConstruction"; if (exec) TestConstruction(); break;
     case 2: name = "TestExemplar"; if (exec) TestExemplar(); break;
+    case 3: name = "TestGetSize"; if (exec) TestGetSize(); break;
+    case 4: name = "TestGetLocaleByType"; if (exec) TestGetLocaleByType(); break;
         default: name = ""; break; //needed to end loop
     }
 }
@@ -479,6 +480,124 @@
     logln("Number of installed locales with exemplar characters that could be tested: %d",num);
 
 }
-            
+
+void 
+ResourceBundleTest::TestGetSize(void) 
+{
+    const struct {
+        const char* key;
+        int32_t size;
+    } test[] = {
+        { "zerotest", 1},
+        { "one", 1},
+        { "importtest", 1},
+        { "integerarray", 1},
+        { "emptyarray", 0},
+        { "emptytable", 0},
+        { "emptystring", 1}, /* empty string is still a string */
+        { "emptyint", 1}, 
+        { "emptybin", 1},
+        { "testinclude", 1},
+        { "collations", 1}, /* not 2 - there is hidden %%CollationBin */
+    };
+    
+    UErrorCode status = U_ZERO_ERROR;
+    
+    const char* testdatapath = loadTestData(status);
+    int32_t i = 0, j = 0;
+    int32_t size = 0;
+    
+    if(U_FAILURE(status))
+    {
+        err("Could not load testdata.dat %s\n", u_errorName(status));
+        return;
+    }
+    
+    ResourceBundle rb(testdatapath, "testtypes", status);
+    if(U_FAILURE(status))
+    {
+        err("Could not testtypes resource bundle %s\n", u_errorName(status));
+        return;
+    }
+    
+    for(i = 0; i < (int32_t)(sizeof(test)/sizeof(test[0])); i++) {
+        ResourceBundle res = rb.get(test[i].key, status);
+        if(U_FAILURE(status))
+        {
+            err("Couldn't find the key %s. Error: %s\n", u_errorName(status));
+            return;
+        }
+        size = res.getSize();
+        if(size != test[i].size) {
+            err("Expected size %i, got size %i for key %s\n", test[i].size, size, test[i].key);
+            for(j = 0; j < size; j++) {
+                ResourceBundle helper = res.get(j, status);
+                err("%s\n", helper.getKey());
+            }
+        }
+    }
+}
+
+void 
+ResourceBundleTest::TestGetLocaleByType(void) 
+{
+    const struct {
+        const char *requestedLocale;
+        const char *resourceKey;
+        const char *validLocale;
+        const char *actualLocale;
+    } test[] = {
+        { "te_IN_BLAH", "string_only_in_te_IN", "te_IN", "te_IN" },
+        { "te_IN_BLAH", "string_only_in_te", "te_IN", "te" },
+        { "te_IN_BLAH", "string_only_in_Root", "te_IN", "root" },
+        { "te_IN_BLAH_01234567890_01234567890_01234567890_01234567890_01234567890_01234567890", "array_2d_only_in_Root", "te_IN", "root" },
+        { "te_IN_BLAH@currency=euro", "array_2d_only_in_te_IN", "te_IN", "te_IN" },
+        { "te_IN_BLAH@calendar=thai;collation=phonebook", "array_2d_only_in_te", "te_IN", "te" }
+    };
+    
+    UErrorCode status = U_ZERO_ERROR;
+    
+    const char* testdatapath = loadTestData(status);
+    int32_t i = 0;
+    Locale locale;
+    
+    if(U_FAILURE(status))
+    {
+        err("Could not load testdata.dat %s\n", u_errorName(status));
+        return;
+    }
+    
+    for(i = 0; i < (int32_t)(sizeof(test)/sizeof(test[0])); i++) {
+        ResourceBundle rb(testdatapath, test[i].requestedLocale, status);
+        if(U_FAILURE(status))
+        {
+            err("Could not open resource bundle %s (error %s)\n", test[i].requestedLocale, u_errorName(status));
+            status = U_ZERO_ERROR;
+            continue;
+        }
+        
+        ResourceBundle res = rb.get(test[i].resourceKey, status);
+        if(U_FAILURE(status))
+        {
+            err("Couldn't find the key %s. Error: %s\n", test[i].resourceKey, u_errorName(status));
+            status = U_ZERO_ERROR;
+            continue;
+        }
+        
+        locale = res.getLocale(ULOC_REQUESTED_LOCALE, status);
+        if(locale != Locale::getDefault()) {
+            err("Expected requested locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
+        }
+        locale = res.getLocale(ULOC_VALID_LOCALE, status);
+        if(strcmp(locale.getName(), test[i].validLocale) != 0) {
+            err("Expected valid locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
+        }
+        locale = res.getLocale(ULOC_ACTUAL_LOCALE, status);
+        if(strcmp(locale.getName(), test[i].actualLocale) != 0) {
+            err("Expected actual locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
+        }
+    }
+}
+
 //eof
 

Index: restest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/restest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- restest.h	10 Sep 2003 02:42:49 -0000	1.3
+++ restest.h	6 Apr 2004 10:09:42 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -30,6 +30,9 @@
 
     void TestExemplar(void);
 
+    void TestGetSize(void);
+    void TestGetLocaleByType(void);
+
 private:
     /**
      * The assignment operator has no real implementation.
@@ -47,8 +50,6 @@
 
     int32_t pass;
     int32_t fail;
-
-    IntlTest& OUT;
 };
 
 #endif

Index: restsnew.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/restsnew.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- restsnew.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ restsnew.cpp	6 Apr 2004 10:09:42 -0000	1.5
@@ -155,8 +155,7 @@
 */
 NewResourceBundleTest::NewResourceBundleTest()
 : pass(0),
-  fail(0),
-  OUT(it_out)
+  fail(0)
 {
     if (param[5].locale == NULL) {
         param[0].locale = new Locale("root");
@@ -377,6 +376,25 @@
     delete locale;
 }
 
+// TODO: add operator== and != to ResourceBundle
+static UBool
+equalRB(ResourceBundle &a, ResourceBundle &b) {
+    UResType type;
+    UErrorCode status;
+
+    type=a.getType();
+    status=U_ZERO_ERROR;
+    return
+        type==b.getType() &&
+        a.getLocale()==b.getLocale() &&
+        0==strcmp(a.getName(), b.getName()) &&
+        type==URES_STRING ?
+            a.getString(status)==b.getString(status) :
+            type==URES_INT ?
+                a.getInt(status)==b.getInt(status) :
+                TRUE;
+}
+
 void
 NewResourceBundleTest::TestOtherAPI(){
     UErrorCode   err = U_ZERO_ERROR;
@@ -436,7 +454,19 @@
         errln("copy construction for subresource failed\n");
     }
 
+    ResourceBundle *p;
 
+    p = defaultresource.clone();
+    if(p == &defaultresource || !equalRB(*p, defaultresource)) {
+        errln("ResourceBundle.clone() failed");
+    }
+    delete p;
+
+    p = defaultSub.clone();
+    if(p == &defaultSub || !equalRB(*p, defaultSub)) {
+        errln("2nd ResourceBundle.clone() failed");
+    }
+    delete p;
 
     UVersionInfo ver;
     copyRes.getVersion(ver);

Index: restsnew.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/restsnew.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- restsnew.h	10 Sep 2003 02:42:49 -0000	1.3
+++ restsnew.h	6 Apr 2004 10:09:42 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -52,7 +52,6 @@
     int32_t pass;
     int32_t fail;
 
-    IntlTest& OUT;
 };
 
 #endif

Index: sdtfmtts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/sdtfmtts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sdtfmtts.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ sdtfmtts.cpp	6 Apr 2004 10:09:42 -0000	1.4
@@ -1,7 +1,7 @@
 
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 

Index: sfwdchit.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/sfwdchit.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sfwdchit.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ sfwdchit.cpp	6 Apr 2004 10:09:42 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /*   file name:  sfwdchit.cpp
@@ -21,6 +21,7 @@
 const int32_t SimpleFwdCharIterator::kInvalidHashCode = 0;
 const int32_t SimpleFwdCharIterator::kEmptyHashCode = 1;
 
+#if 0 // not used
 SimpleFwdCharIterator::SimpleFwdCharIterator(const UnicodeString& s) {
 
     fHashCode = kInvalidHashCode;
@@ -36,6 +37,7 @@
     }
     
 }
+#endif
 
 SimpleFwdCharIterator::SimpleFwdCharIterator(UChar *s, int32_t len, UBool adopt) {
 
@@ -65,6 +67,7 @@
     delete[] fStart;
 }
 
+#if 0 // not used
 UBool SimpleFwdCharIterator::operator==(const ForwardCharacterIterator& that) const {
     if(this == &that) {
         return TRUE;
@@ -84,7 +87,8 @@
 */
     return FALSE;
 }
-     
+#endif
+
 int32_t SimpleFwdCharIterator::hashCode(void) const {
     if (fHashCode == kInvalidHashCode)
     {

Index: sfwdchit.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/sfwdchit.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sfwdchit.h	10 Sep 2003 02:42:49 -0000	1.3
+++ sfwdchit.h	6 Apr 2004 10:09:42 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -12,7 +12,7 @@
 
 class SimpleFwdCharIterator : public ForwardCharacterIterator {
 public:
-    SimpleFwdCharIterator(const UnicodeString& s);
+    // not used -- SimpleFwdCharIterator(const UnicodeString& s);
     SimpleFwdCharIterator(UChar *s, int32_t len, UBool adopt = FALSE);
 
     virtual ~SimpleFwdCharIterator();
@@ -21,7 +21,7 @@
    * Returns true when both iterators refer to the same
    * character in the same character-storage object.  
    */
-  virtual UBool operator==(const ForwardCharacterIterator& that) const;
+  // not used -- virtual UBool operator==(const ForwardCharacterIterator& that) const;
         
   /**
    * Generates a hash code for this iterator.  

Index: srchtest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/srchtest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- srchtest.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ srchtest.cpp	6 Apr 2004 10:09:42 -0000	1.5
@@ -14,6 +14,7 @@
 #include "unicode/ustring.h"
 #include "unicode/schriter.h"
 #include <string.h>
+#include <stdio.h>
 
 // private definitions -----------------------------------------------------
 
@@ -344,7 +345,7 @@
     
     Collator      *collator = getCollator(search->collator);
     BreakIterator *breaker  = getBreakIterator(search->breaker);
-    StringSearch  *strsrch; 
+    StringSearch  *strsrch, *strsrch2;
     UChar          temp[128];
     
 #if UCONFIG_NO_BREAK_ITERATION
@@ -377,6 +378,20 @@
         delete strsrch;
         return FALSE;
     }
+
+
+    strsrch2 = strsrch->clone();
+    if( strsrch2 == strsrch || *strsrch2 != *strsrch ||
+        !assertEqualWithStringSearch(strsrch2, search)
+    ) {
+        errln("failure with StringSearch.clone()");
+        collator->setStrength(getECollationStrength(UCOL_TERTIARY));
+        delete strsrch;
+        delete strsrch2;
+        return FALSE;
+    }
+    delete strsrch2;
+
     collator->setStrength(getECollationStrength(UCOL_TERTIARY));
     delete strsrch;
     return TRUE;

Index: strcase.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/strcase.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- strcase.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ strcase.cpp	6 Apr 2004 10:09:42 -0000	1.2
@@ -26,6 +26,8 @@
 #include "ustrtest.h"
 #include "tstdtmod.h"
 
+StringCaseTest::~StringCaseTest() {}
+
 void
 StringCaseTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char * /*par*/) {
     if (exec) logln("TestSuite StringCaseTest: ");
@@ -322,51 +324,51 @@
 
 void
 StringCaseTest::TestTitleCasing() {
-  UErrorCode status = U_ZERO_ERROR;
-  UBreakIterator *iter;
-  char cLocaleID[100];
-  UnicodeString locale, input, result;
-  int32_t type;
-  TestLog myLog;
-  TestDataModule *driver = TestDataModule::getTestDataModule("casing", myLog, status);
-  if(U_SUCCESS(status)) {
-    TestData *casingTest = driver->createTestData("titlecasing", status);
-    const DataMap *myCase = NULL;
-    while(casingTest->nextCase(myCase, status)) {
-      locale = myCase->getString("Locale", status);
-      locale.extract(0, 0x7fffffff, cLocaleID, sizeof(cLocaleID), "");
-      type = myCase->getInt("Type", status);
+    UErrorCode status = U_ZERO_ERROR;
+    UBreakIterator *iter;
+    char cLocaleID[100];
+    UnicodeString locale, input, result;
+    int32_t type;
+    TestLog myLog;
+    TestDataModule *driver = TestDataModule::getTestDataModule("casing", myLog, status);
+    if(U_SUCCESS(status)) {
+        TestData *casingTest = driver->createTestData("titlecasing", status);
+        const DataMap *myCase = NULL;
+        while(casingTest->nextCase(myCase, status)) {
+            locale = myCase->getString("Locale", status);
+            locale.extract(0, 0x7fffffff, cLocaleID, sizeof(cLocaleID), "");
+            type = myCase->getInt("Type", status);
       
 
-      input = myCase->getString("Input", status);
-      if(type<0) {
-          iter=0;
-      } else {
-          iter=ubrk_open((UBreakIteratorType)type, cLocaleID, input.getBuffer(), input.length(), &status);
-      }
+            input = myCase->getString("Input", status);
+            if(type<0) {
+                iter=0;
+            } else {
+                iter=ubrk_open((UBreakIteratorType)type, cLocaleID, NULL, 0, &status);
+            }
 
-      if(U_FAILURE(status)) {
-          errln("error: TestTitleCasing() ubrk_open(%d) failed for test case  from casing.res: %s", type,  u_errorName(status));
-          status = U_ZERO_ERROR;
-      } else {
-          result=input;
-          result.toTitle((BreakIterator *)iter, Locale(cLocaleID));
-          if(result!=myCase->getString("Output", status)) {
-              errln("error: TestTitleCasing() got a wrong result for test case from casing.res");
-          }
-      }
-      ubrk_close(iter);
+            if(U_FAILURE(status)) {
+                errln("error: TestTitleCasing() ubrk_open(%d) failed for test case  from casing.res: %s", type,  u_errorName(status));
+                status = U_ZERO_ERROR;
+            } else {
+                result=input;
+                result.toTitle((BreakIterator *)iter, Locale(cLocaleID));
+                if(result!=myCase->getString("Output", status)) {
+                    errln("error: TestTitleCasing() got a wrong result for test case from casing.res");
+                }
+                ubrk_close(iter);
+            }
+        }
+        delete casingTest;
     }
-    delete casingTest;
-  }
-  delete driver;
+    delete driver;
 
     // more tests for API coverage
     status=U_ZERO_ERROR;
     input=UNICODE_STRING_SIMPLE("sTrA\\u00dfE").unescape();
     (result=input).toTitle(NULL);
     if(result!=UNICODE_STRING_SIMPLE("Stra\\u00dfe").unescape()) {
-        errln("UnicodeString::toTitle(BreakIterator *) failed");
+        errln("UnicodeString::toTitle(NULL) failed");
     }
 
 #if 0

Index: strtest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/strtest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- strtest.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ strtest.cpp	6 Apr 2004 10:09:43 -0000	1.4
@@ -18,6 +18,13 @@
 #include "strtest.h"
 #include "unicode/ustring.h"
 
+#if defined(WIN32) && defined(_MSC_VER)
+#include <vector>
+using namespace std;
+#endif
+
+StringTest::~StringTest() {}
+
 void StringTest::TestEndian(void) {
     union {
         uint8_t byte;
@@ -151,6 +158,16 @@
                 errln("Test_UTF8_COUNT_TRAIL_BYTES: UTF8_COUNT_TRAIL_BYTES does not work right! "
                       "See utf8.h.");
             }
+        }
+        break;
+    case 8:
+        name="TestSTLCompatibility";
+        if(exec) {
+#if defined(WIN32) && defined(_MSC_VER)
+            /* Just make sure that it compiles with STL's placement new usage. */
+            vector<UnicodeString> myvect;
+            myvect.push_back(UnicodeString("blah"));
+#endif
         }
         break;
     default:

Index: strtest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/strtest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- strtest.h	10 Sep 2003 02:42:49 -0000	1.3
+++ strtest.h	6 Apr 2004 10:09:43 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /*   file name:  strtest.h
@@ -25,7 +25,7 @@
 class StringTest : public IntlTest {
 public:
     StringTest() {}
-    virtual ~StringTest() {}
+    virtual ~StringTest();
 
     void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL);
 

Index: svccoll.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/svccoll.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- svccoll.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ svccoll.cpp	6 Apr 2004 10:09:43 -0000	1.2
@@ -97,7 +97,7 @@
         UnicodeString locName = fu_FU.getName();
         StringEnumeration* localeEnum = Collator::getAvailableLocales();
         UBool found = FALSE;
-        const UnicodeString* locStr;
+        const UnicodeString* locStr, *ls2;
         for (locStr = localeEnum->snext(status);
         !found && locStr != NULL;
         locStr = localeEnum->snext(status)) {
@@ -106,7 +106,32 @@
                 found = TRUE;
             }
         }
+
+        StringEnumeration *le2 = NULL;
+        localeEnum->reset(status);
+        int32_t i, count;
+        count = localeEnum->count(status);
+        for(i = 0; i < count; ++i) {
+            if(i == count / 2) {
+                le2 = localeEnum->clone();
+                if(le2 == NULL || count != le2->count(status)) {
+                    errln("ServiceEnumeration.clone() failed");
+                    break;
+                }
+            }
+            if(i >= count / 2) {
+                locStr = localeEnum->snext(status);
+                ls2 = le2->snext(status);
+                if(*locStr != *ls2) {
+                    errln("ServiceEnumeration.clone() failed for item %d", i);
+                }
+            } else {
+                localeEnum->snext(status);
+            }
+        }
+
         delete localeEnum;
+        delete le2;
         
         if (!found) {
             errln("new locale fu_FU not reported as supported locale");

Index: tchcfmt.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tchcfmt.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tchcfmt.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ tchcfmt.cpp	6 Apr 2004 10:09:43 -0000	1.4
@@ -64,7 +64,7 @@
         }
         //form->parse(res1, f, parse_pos);
         res2 = " ??? ";
-        it_out << ix << " -> " << res1 << " -> " << res2 << endl;
+        it_logln(UnicodeString("") + ix + UnicodeString(" -> ") + res1 + UnicodeString(" -> ") + res2);
     }
     //Testing ==operator
     const double filelimits[] = {0,1,2};
@@ -176,11 +176,11 @@
     UnicodeString str;
     UnicodeString res1, res2;
     pattform->toPattern( res1 );
-    it_out << "MessageFormat toPattern: " << res1 << endl;
+    it_logln("MessageFormat toPattern: " + res1);
     fileform->toPattern( res1 );
-    it_out << "ChoiceFormat toPattern: " << res1 << endl;
+    it_logln("ChoiceFormat toPattern: " + res1);
     if (res1 == "-1.0#are corrupted files|0.0#are no files|1.0#is one file|2.0#are {2} files") {
-        it_out << "toPattern tested!" << endl;
+        it_logln("toPattern tested!");
     }else{
         it_errln("***  ChoiceFormat to Pattern result!");
     }
@@ -219,15 +219,16 @@
             delete pattform;
             return;
         }
-        it_out << i << " -> " << res2 << endl;
+        it_logln(i + UnicodeString(" -> ") + res2);
         if (res2 != checkstr[i - start]) {
             it_errln("***  test_complex_example res string");
-            it_out << "*** " << i << " -> '" << res2 << "' unlike '" << checkstr[i] << "' ! " << endl;
+            it_errln(UnicodeString("*** ") + i + UnicodeString(" -> '") + res2 + UnicodeString("' unlike '") + checkstr[i] + UnicodeString("' ! "));
         }
     }
-    it_out << endl;
+    it_logln();
 
-    it_out << "------ additional testing in complex test ------" << endl << endl;
+    it_logln("------ additional testing in complex test ------");
+    it_logln();
     //
     int32_t retCount;
     const double* retLimits = fileform->getLimits( retCount );
@@ -236,7 +237,7 @@
     && (retLimits[1] == 0.0)
     && (retLimits[2] == 1.0)
     && (retLimits[3] == 2.0)) {
-        it_out << "getLimits tested!" << endl;
+        it_logln("getLimits tested!");
     }else{
         it_errln("***  getLimits unexpected result!");
     }
@@ -247,7 +248,7 @@
     && (retFormats[1] == "are no files") 
     && (retFormats[2] == "is one file")
     && (retFormats[3] == "are {2} files")) {
-        it_out << "getFormats tested!" << endl;
+        it_logln("getFormats tested!");
     }else{
         it_errln("***  getFormats unexpected result!");
     }
@@ -260,7 +261,8 @@
     };
 
     fileform->applyPattern("0#is no folder|1#is one folder|2#are many folders", status );
-    if (status == U_ZERO_ERROR) it_out << "status applyPattern OK!" << endl;
+    if (status == U_ZERO_ERROR)
+        it_logln("status applyPattern OK!");
     if (!chkstatus( status, "***  test_complex_example pattform" )) {
         delete fileform;
         delete filenumform;
@@ -281,10 +283,10 @@
             delete pattform;
             return;
         }
-        it_out << i << " -> " << res2 << endl;
+        it_logln(UnicodeString() + i + UnicodeString(" -> ") + res2);
         if (res2 != checkstr2[i]) {
             it_errln("***  test_complex_example res string");
-            it_out << "*** " << i << " -> '" << res2 << "' unlike '" << checkstr2[i] << "' ! " << endl;
+            it_errln(UnicodeString("*** ") + i + UnicodeString(" -> '") + res2 + UnicodeString("' unlike '") + checkstr2[i] + UnicodeString("' ! "));
         }
     }
 
@@ -299,13 +301,13 @@
         it_errln("***  test-choiceFormat not allocatable!");
     }else{
         if (*form_A == *form_A2) {
-            it_out << "operator== tested." << endl;
+            it_logln("operator== tested.");
         }else{
             it_errln("***  operator==");
         }
 
         if (*form_A != *form_B) {
-            it_out << "operator!= tested." << endl;
+            it_logln("operator!= tested.");
         }else{
             it_errln("***  operator!=");
         }
@@ -315,7 +317,7 @@
             it_errln("***  ChoiceFormat->clone is nil.");
         }else{
             if ((*form_A3 == *form_A) && (*form_A3 != *form_B)) {
-                it_out << "method clone tested." << endl;
+                it_logln("method clone tested.");
             }else{
                 it_errln("***  ChoiceFormat clone or operator==, or operator!= .");
             }
@@ -326,7 +328,7 @@
         form_Assigned = *form_B;
         ok = ok && (form_Assigned != *form_A) && (form_Assigned == *form_B);
         if (ok) {
-            it_out << "copy constructor and operator= tested." << endl;
+            it_logln("copy constructor and operator= tested.");
         }else{
             it_errln("***  copy constructor or operator= or operator == or operator != .");
         }
@@ -347,7 +349,7 @@
 
     form_pat.toPattern( res1 );
     if (res1 == "0.0#none|1.0#one|2.0#many") {
-        it_out << "ChoiceFormat contructor( newPattern, status) tested" << endl;
+        it_logln("ChoiceFormat contructor( newPattern, status) tested");
     }else{
         it_errln("***  ChoiceFormat contructor( newPattern, status) or toPattern result!");
     }
@@ -365,7 +367,7 @@
     form_pat.toPattern( res1 );
     it_out << "ChoiceFormat adoptChoices toPattern: " << res1 << endl;
     if (res1 == "1.0#first|2.0#second") {
-        it_out << "ChoiceFormat adoptChoices tested" << endl;
+        it_logln("ChoiceFormat adoptChoices tested");
     }else{
         it_errln("***  ChoiceFormat adoptChoices result!");
     }
@@ -376,9 +378,9 @@
 
     form_pat.setChoices( d_a2, s_a2, 2 );
     form_pat.toPattern( res1 );
-    it_out << "ChoiceFormat adoptChoices toPattern: " << res1 << endl;
+    it_logln(UnicodeString("ChoiceFormat adoptChoices toPattern: ") + res1);
     if (res1 == "3.0#third|4.0#forth") {
-        it_out << "ChoiceFormat adoptChoices tested" << endl;
+        it_logln("ChoiceFormat adoptChoices tested");
     }else{
         it_errln("***  ChoiceFormat adoptChoices result!");
     }
@@ -388,7 +390,7 @@
     status = U_ZERO_ERROR;
     double arg_double = 3.0;
     res1 = form_pat.format( arg_double, str, fpos );
-    it_out << "ChoiceFormat format:" << res1 << endl;
+    it_logln(UnicodeString("ChoiceFormat format:") + res1);
     if (res1 != "third") it_errln("***  ChoiceFormat format (double, ...) result!");
 
     str = "";
@@ -396,7 +398,7 @@
     status = U_ZERO_ERROR;
     int32_t arg_long = 3;
     res1 = form_pat.format( arg_long, str, fpos );
-    it_out << "ChoiceFormat format:" << res1 << endl;
+    it_logln(UnicodeString("ChoiceFormat format:") + res1);
     if (res1 != "third") it_errln("***  ChoiceFormat format (int32_t, ...) result!");
 
     Formattable ft( (int32_t)3 );
@@ -410,7 +412,7 @@
         delete pattform;
         return;
     }
-    it_out << "ChoiceFormat format:" << res1 << endl;
+    it_logln(UnicodeString("ChoiceFormat format:") + res1);
     if (res1 != "third") it_errln("***  ChoiceFormat format (Formattable, ...) result!");
 
     Formattable fta[] = { (int32_t)3 };
@@ -424,7 +426,7 @@
         delete pattform;
         return;
     }
-    it_out << "ChoiceFormat format:" << res1 << endl;
+    it_logln(UnicodeString("ChoiceFormat format:") + res1);
     if (res1 != "third") it_errln("***  ChoiceFormat format (Formattable[], cnt, ...) result!");
 
     ParsePosition parse_pos = 0;
@@ -433,7 +435,7 @@
     form_pat.parse( parsetext, result, parse_pos );
     double rd = (result.getType() == Formattable::kLong) ? result.getLong() : result.getDouble();
     if (rd == 3.0) {
-        it_out << "parse( ..., ParsePos ) tested." << endl;
+        it_logln("parse( ..., ParsePos ) tested.");
     }else{
         it_errln("*** ChoiceFormat parse( ..., ParsePos )!");
     }
@@ -441,7 +443,7 @@
     form_pat.parse( parsetext, result, status );
     rd = (result.getType() == Formattable::kLong) ? result.getLong() : result.getDouble();
     if (rd == 3.0) {
-        it_out << "parse( ..., UErrorCode ) tested." << endl;
+        it_logln("parse( ..., UErrorCode ) tested.");
     }else{
         it_errln("*** ChoiceFormat parse( ..., UErrorCode )!");
     }
@@ -455,7 +457,7 @@
     }
     */
 
-    it_out << endl;
+    it_logln();
 
     delete fileform; 
     delete filenumform;

Index: testdata.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/testdata.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- testdata.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ testdata.cpp	6 Apr 2004 10:09:43 -0000	1.2
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 2002, International Business Machines Corporation and
+ * Copyright (c) 2002-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 

Index: testidn.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/testidn.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- testidn.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ testidn.cpp	6 Apr 2004 10:09:43 -0000	1.2
@@ -25,6 +25,8 @@
 
 #if !UCONFIG_NO_IDNA && !UCONFIG_NO_TRANSLITERATION
 
+#define USPREP_TYPE_NAMES_ARRAY
+
 #include "unicode/uchar.h"
 #include "unicode/putil.h"
 #include "cmemory.h"
@@ -37,39 +39,22 @@
 #include "umutex.h"
 #include "sprpimpl.h"
 #include "testidna.h"
+#include "punyref.h"
 
 UBool beVerbose=FALSE, haveCopyright=TRUE;
 
 /* prototypes --------------------------------------------------------------- */
 
 
-static UBool isDataLoaded = FALSE;
-static UTrie idnTrie={ 0,0,0,0,0,0,0 };
-static UDataMemory *idnData=NULL;
-static UErrorCode dataErrorCode =U_ZERO_ERROR;
-
-
-static const uint16_t* mappingData = NULL;
-static int32_t indexes[_IDNA_INDEX_TOP]={ 0 };
-
-
 static void
-parseMappings(const char *filename, UBool withNorm, UBool reportError,TestIDNA& test, UErrorCode *pErrorCode);
-
-static void
-parseTable(const char *filename, UBool isUnassigned, TestIDNA& test, UErrorCode *pErrorCode);
-
-static UBool loadIDNData(UErrorCode &errorCode);
-
-static UBool cleanup();
+parseMappings(const char *filename, UBool reportError,TestIDNA& test, UErrorCode *pErrorCode);
 
 static void 
 compareMapping(uint32_t codepoint, uint32_t* mapping, int32_t mapLength, 
-               UBool withNorm);
+               UStringPrepType option);
 
 static void
-compareFlagsForRange(uint32_t start, uint32_t end,
-                     UBool isUnassigned);
+compareFlagsForRange(uint32_t start, uint32_t end,UStringPrepType option);
 
 static void
 testAllCodepoints(TestIDNA& test);
@@ -77,12 +62,12 @@
 static TestIDNA* pTestIDNA =NULL;
 
 static const char* fileNames[] = {
-                                    "rfc3454_A_1.txt", /* contains unassigned code points */
-                                    "rfc3454_C_X.txt", /* contains code points that are prohibited */
-                                    "rfc3454_B_1.txt", /* contains case mappings when normalization is turned off */
-                                    "rfc3454_B_2.txt", /* contains case mappings when normalization it turned on */
-                                    /* "NormalizationCorrections.txt",contains NFKC case mappings whicha are not included in UTR 21  */
-                                };
+                                    "NamePrepProfile.txt"
+                                 };
+static       UStringPrepProfile *profile = NULL;
+static const UTrie *idnTrie              = NULL;
+static const int32_t *indexes            = NULL;
+static const uint16_t *mappingData       = NULL;
 /* -------------------------------------------------------------------------- */
 
 /* file definitions */
@@ -93,19 +78,23 @@
 
 extern int
 testData(TestIDNA& test) {
-    char* filename = (char*) malloc(strlen(IntlTest::pathToDataDirectory())*3);
+    char* filename = (char*) malloc(strlen(IntlTest::pathToDataDirectory())*5555);
     //TODO get the srcDir dynamically 
     const char *srcDir=IntlTest::pathToDataDirectory();
     char *basename=NULL;
     UErrorCode errorCode=U_ZERO_ERROR;
     char *saveBasename =NULL;
 
-    loadIDNData(errorCode);
-    if(U_FAILURE(dataErrorCode)){
-        test.errln( "Could not load data. Error: %s\n",u_errorName(dataErrorCode));
-        return dataErrorCode;
+    profile = usprep_open(NULL, DATA_NAME, &errorCode);
+    if(U_FAILURE(errorCode)){
+        test.errln("Failed to load IDNA data file. " + UnicodeString(u_errorName(errorCode)));
+        return errorCode;
     }
     
+    idnTrie     = &profile->sprepTrie;
+    indexes     = profile->indexes;
+    mappingData = profile->mappingData;
+
     //initialize
     pTestIDNA = &test;
     
@@ -136,28 +125,7 @@
     
     /* process unassigned */
     uprv_strcpy(basename,fileNames[0]);
-    parseTable(filename,TRUE, test,&errorCode);
-    if(U_FAILURE(errorCode)) {
-        test.errln( "Could not open file %s for reading \n", filename);
-        return errorCode;
-    }
-    /* process prohibited */
-    uprv_strcpy(basename,fileNames[1]);
-    parseTable(filename,FALSE, test, &errorCode);
-    if(U_FAILURE(errorCode)) {
-        test.errln( "Could not open file %s for reading \n", filename);
-        return errorCode;
-    }
-
-    /* process mappings */
-    uprv_strcpy(basename,fileNames[2]);
-    parseMappings(filename, FALSE, FALSE,test, &errorCode);
-    if(U_FAILURE(errorCode)) {
-        test.errln( "Could not open file %s for reading \n", filename);
-        return errorCode;
-    }
-    uprv_strcpy(basename,fileNames[3]);
-    parseMappings(filename, TRUE, FALSE,test, &errorCode);
+    parseMappings(filename,TRUE, test,&errorCode);
     if(U_FAILURE(errorCode)) {
         test.errln( "Could not open file %s for reading \n", filename);
         return errorCode;
@@ -165,48 +133,74 @@
 
     testAllCodepoints(test);
 
-    cleanup();
+    usprep_close(profile);
     pTestIDNA = NULL;
     free(filename);
     return errorCode;
 }
 U_CDECL_BEGIN
+
 static void U_CALLCONV
-caseMapLineFn(void *context,
-              char *fields[][2], int32_t /*fieldCount*/,
+strprepProfileLineFn(void * /*context*/,
+              char *fields[][2], int32_t fieldCount,
               UErrorCode *pErrorCode) {
     uint32_t mapping[40];
-    char *end, *s;
+    char *end, *map;
     uint32_t code;
     int32_t length;
-    UBool* mapWithNorm = (UBool*) context;
+   /*UBool* mapWithNorm = (UBool*) context;*/
+    const char* typeName;
+    uint32_t rangeStart=0,rangeEnd =0;
+    
+    if(fieldCount != 3){
+        *pErrorCode = U_INVALID_FORMAT_ERROR;
+        return;
+    }
 
-    /* get the character code, field 0 */
-    code=(uint32_t)uprv_strtoul(fields[0][0], &end, 16);
-    if(end<=fields[0][0] || end!=fields[0][1]) {
-        *pErrorCode=U_PARSE_ERROR;
+    typeName = fields[2][0];
+    map = fields[1][0];
+   
+    if(uprv_strstr(typeName, usprepTypeNames[USPREP_UNASSIGNED])!=NULL){
 
-    }
+        u_parseCodePointRange(fields[0][0], &rangeStart,&rangeEnd, pErrorCode);
 
-    s = fields[1][0];
-    /* parse the mapping string */
-    length=u_parseCodePoints(s, mapping, sizeof(mapping)/4, pErrorCode);
+        /* store the range */
+        compareFlagsForRange(rangeStart,rangeEnd,USPREP_UNASSIGNED);
 
-    /* store the mapping */
+    }else if(uprv_strstr(typeName, usprepTypeNames[USPREP_PROHIBITED])!=NULL){
+
+        u_parseCodePointRange(fields[0][0], &rangeStart,&rangeEnd, pErrorCode);
+
+        /* store the range */
+        compareFlagsForRange(rangeStart,rangeEnd,USPREP_PROHIBITED);
+
+    }else if(uprv_strstr(typeName, usprepTypeNames[USPREP_MAP])!=NULL){
+        /* get the character code, field 0 */
+        code=(uint32_t)uprv_strtoul(fields[0][0], &end, 16);
+
+        /* parse the mapping string */
+        length=u_parseCodePoints(map, mapping, sizeof(mapping)/4, pErrorCode);
+        
+        /* store the mapping */
+        compareMapping(code,mapping, length,USPREP_MAP);
+
+    }else{
+        *pErrorCode = U_INVALID_FORMAT_ERROR;
+    }
 
-    compareMapping(code,mapping, length, *mapWithNorm);
 }
+
 U_CDECL_END
 
 static void
-parseMappings(const char *filename,UBool withNorm, UBool reportError, TestIDNA& test, UErrorCode *pErrorCode) {
+parseMappings(const char *filename,UBool reportError, TestIDNA& test, UErrorCode *pErrorCode) {
     char *fields[3][2];
 
     if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
         return;
     }
 
-    u_parseDelimitedFile(filename, ';', fields, 3, caseMapLineFn, &withNorm, pErrorCode);
+    u_parseDelimitedFile(filename, ';', fields, 3, strprepProfileLineFn, (void*)filename, pErrorCode);
 
     //fprintf(stdout,"Number of code points that have mappings with length >1 : %i\n",len);
 
@@ -215,142 +209,164 @@
     }
 }
 
-/* parser for UnicodeData.txt ----------------------------------------------- */
-U_CDECL_BEGIN
 
-static void U_CALLCONV
-unicodeDataLineFn(void *context,
-                  char *fields[][2], int32_t /*fieldCount*/,
-                  UErrorCode *pErrorCode) {
-    uint32_t rangeStart=0,rangeEnd =0;
-    UBool* isUnassigned = (UBool*) context;
+static inline UStringPrepType
+getValues(uint32_t result, int32_t& value, UBool& isIndex){
 
-    u_parseCodePointRange(fields[0][0], &rangeStart,&rangeEnd, pErrorCode);
-    
-    if(U_FAILURE(*pErrorCode)){
-        *pErrorCode  = U_PARSE_ERROR;
-        return;
-    }
+    UStringPrepType type;
 
+    if(result == 0){
+        /* 
+         * Initial value stored in the mapping table 
+         * just return USPREP_TYPE_LIMIT .. so that
+         * the source codepoint is copied to the destination
+         */
+        type = USPREP_TYPE_LIMIT;
+    }else if(result >= _SPREP_TYPE_THRESHOLD){
+        type = (UStringPrepType) (result - _SPREP_TYPE_THRESHOLD);
+    }else{
+        /* get the state */
+        type = USPREP_MAP;
+        /* ascertain if the value is index or delta */
+        if(result & 0x02){
+            isIndex = TRUE;
+            value = result  >> 2; //mask off the lower 2 bits and shift
 
-    compareFlagsForRange(rangeStart,rangeEnd,*isUnassigned);
+        }else{
+            isIndex = FALSE;
+            value = (int16_t)result;
+            value =  (value >> 2);
 
+        }
+        if((result>>2) == _SPREP_MAX_INDEX_VALUE){
+            type = USPREP_DELETE;
+            isIndex =FALSE;
+            value = 0;
+        }
+    }
+    return type;
 }
 
-U_CDECL_END
 
-static void
-parseTable(const char *filename,UBool isUnassigned,TestIDNA& test, UErrorCode *pErrorCode) {
-    char *fields[2][2];
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return;
-    }
 
-    u_parseDelimitedFile(filename, ';', fields, 1, unicodeDataLineFn, &isUnassigned, pErrorCode);
+static void
+testAllCodepoints(TestIDNA& test){
+    /*
+    {
+        UChar str[19] = {            
+                            0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
+                            0x070F,//prohibited
+                            0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74
+                        };
+        uint32_t in[19] = {0};
+        UErrorCode status = U_ZERO_ERROR;
+        int32_t inLength=0, outLength=100;
+        char output[100] = {0};
+        punycode_status error;
+        u_strToUTF32((UChar32*)in,19,&inLength,str,19,&status);
 
+        error= punycode_encode(inLength, in, NULL, (uint32_t*)&outLength, output);
+        printf(output);
 
-    if(U_FAILURE(*pErrorCode)) {
-        test.errln( "testidn error: u_parseDelimitedFile(\"%s\") failed - %s\n", filename, u_errorName(*pErrorCode));
     }
-}
-
-static void
-testAllCodepoints(TestIDNA& test){
-    if(isDataLoaded){
-        uint32_t i = 0;
-        int32_t unassigned      = 0;
-        int32_t prohibited      = 0;
-        int32_t mappedWithNorm  = 0;
-        int32_t mapped          = 0;
-        int32_t noValueInTrie   = 0;
+    */
 
+    uint32_t i = 0;
+    int32_t unassigned      = 0;
+    int32_t prohibited      = 0;
+    int32_t mappedWithNorm  = 0;
+    int32_t mapped          = 0;
+    int32_t noValueInTrie   = 0;
 
-        for(i=0;i<=0x10FFFF;i++){
-            uint32_t result = 0;
-            UTRIE_GET16(&idnTrie,i, result);
+    UStringPrepType type;
+    int32_t value;
+    UBool isIndex = FALSE;
 
-            if(result != UIDNA_NO_VALUE ){
-                if((result & 0x07) == UIDNA_UNASSIGNED){
-                    unassigned++;
-                }
-                if((result & 0x07) == UIDNA_PROHIBITED){
-                    prohibited++;
-                }
-                if((result>>5) == _IDNA_MAP_TO_NOTHING){
-                    mapped++;
-                }
-                if((result & 0x07) == UIDNA_MAP_NFKC){
-                    mappedWithNorm++;
-                }
-            }else{
-                noValueInTrie++;
-                if(result > 0){
-                    test.errln("The return value for 0x%06X is wrong. %i\n",i,result);
-                }
+    for(i=0;i<=0x10FFFF;i++){
+        uint32_t result = 0;
+        UTRIE_GET16(idnTrie,i, result);
+        type = getValues(result,value, isIndex);
+        if(type != USPREP_TYPE_LIMIT ){
+            if(type == USPREP_UNASSIGNED){
+                unassigned++;
+            }
+            if(type == USPREP_PROHIBITED){
+                prohibited++;
+            }
+            if(type == USPREP_MAP){
+                mapped++;
+            }
+        }else{
+            noValueInTrie++;
+            if(result > 0){
+                test.errln("The return value for 0x%06X is wrong. %i\n",i,result);
             }
         }
-
-        test.logln("Number of Unassinged code points : %i \n",unassigned);
-        test.logln("Number of Prohibited code points : %i \n",prohibited);
-        test.logln("Number of Mapped code points : %i \n",mapped);
-        test.logln("Number of Mapped with NFKC code points : %i \n",mappedWithNorm);
-        test.logln("Number of code points that have no value in Trie: %i \n",noValueInTrie);
-
     }
-}
 
-static inline void getValues(uint32_t result, int8_t& flag, 
-                             int8_t& length, int32_t& index){
-    /* first 3 bits contain the flag */
-    flag = (int8_t) (result & 0x07);
-    /* next 2 bits contain the length */
-    length = (int8_t) ((result>>3) & 0x03);
-    /* next 11 bits contain the index */
-    index  = (result>> 5);
+    test.logln("Number of Unassinged code points : %i \n",unassigned);
+    test.logln("Number of Prohibited code points : %i \n",prohibited);
+    test.logln("Number of Mapped code points : %i \n",mapped);
+    test.logln("Number of Mapped with NFKC code points : %i \n",mappedWithNorm);
+    test.logln("Number of code points that have no value in Trie: %i \n",noValueInTrie);
+
+    
 }
 
 static void 
 compareMapping(uint32_t codepoint, uint32_t* mapping,int32_t mapLength, 
-               UBool withNorm){
-    if(isDataLoaded){
-        uint32_t result = 0;
-        UTRIE_GET16(&idnTrie,codepoint, result);
+               UStringPrepType type){
+    uint32_t result = 0;
+    UTRIE_GET16(idnTrie,codepoint, result);
 
-        int8_t flag, length;
-        int32_t index;
-        getValues(result,flag,length, index);
+    int32_t length=0;
+    UBool isIndex;
+    UStringPrepType retType;
+    int32_t value, index=0, delta=0;
+  
+    retType = getValues(result,value,isIndex);
 
 
-        if(withNorm){
-            if(flag != UIDNA_MAP_NFKC){
-                pTestIDNA->errln( "Did not get the assigned flag for codepoint 0x%08X. Expected: %i Got: %i\n",codepoint, UIDNA_MAP_NFKC, flag);
-            }
+    if(type != retType && retType != USPREP_DELETE){
+
+        pTestIDNA->errln( "Did not get the assigned type for codepoint 0x%08X. Expected: %i Got: %i\n",codepoint, USPREP_MAP, type);
+
+    }
+
+    if(isIndex){
+        index = value;
+        if(index >= indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] &&
+                 index < indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START]){
+            length = 1;
+        }else if(index >= indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START] &&
+                 index < indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START]){
+            length = 2;
+        }else if(index >= indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START] &&
+                 index < indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START]){
+            length = 3;
         }else{
-            if(flag==UIDNA_NO_VALUE || flag == UIDNA_PROHIBITED){
-                if(index != _IDNA_MAP_TO_NOTHING ){
-                    pTestIDNA->errln( "Did not get the assigned flag for codepoint 0x%08X. Expected: %i Got: %i\n", codepoint, _IDNA_MAP_TO_NOTHING, index);
-                }
-            }
-        }
-        if(length ==_IDNA_LENGTH_IN_MAPPING_TABLE){
-            length = (int8_t)mappingData[index];
-            index++;
-        }
-        int32_t realLength =0;
-        /* figure out the real length */ 
-        for(int32_t j=0; j<mapLength; j++){
-            if(mapping[j] > 0xFFFF){
-                realLength +=2;
-            }else{
-                realLength++;
-            }      
+            length = mappingData[index++];
         }
+    }else{
+        delta = value;
+        length = (retType == USPREP_DELETE)? 0 :  1;
+    }
 
-        if(realLength != length){
-            pTestIDNA->errln( "Did not get the expected length. Expected: %i Got: %i\n", mapLength, length);
-        }
-        
+    int32_t realLength =0;
+    /* figure out the real length */ 
+    for(int32_t j=0; j<mapLength; j++){
+        if(mapping[j] > 0xFFFF){
+            realLength +=2;
+        }else{
+            realLength++;
+        }      
+    }
 
+    if(realLength != length){
+        pTestIDNA->errln( "Did not get the expected length. Expected: %i Got: %i\n", mapLength, length);
+    }
+    
+    if(isIndex){
         for(int8_t i =0; i< mapLength; i++){
             if(mapping[i] <= 0xFFFF){
                 if(mappingData[index+i] != (uint16_t)mapping[i]){
@@ -365,132 +381,58 @@
                 }
             }
         }
-
+    }else{
+        if(retType!=USPREP_DELETE && (codepoint-delta) != (uint16_t)mapping[0]){
+            pTestIDNA->errln("Did not get the expected result. Expected: 0x%04X Got: 0x%04X \n", mapping[0],(codepoint-delta));
+        }
     }
 
 }
 
 static void
 compareFlagsForRange(uint32_t start, uint32_t end,
-                     UBool isUnassigned){
-    if(isDataLoaded){
-        uint32_t result =0 ;
-        while(start < end+1){
-            UTRIE_GET16(&idnTrie,start, result);
-            if(isUnassigned){
-                if(result != UIDNA_UNASSIGNED){
-                    pTestIDNA->errln( "UIDNA_UASSIGNED flag failed for 0x%06X. Expected: %04X Got: %04X\n",start,UIDNA_UNASSIGNED, result);
-                }
-            }else{
-                if((result & 0x03) != UIDNA_PROHIBITED){
-                    pTestIDNA->errln( "UIDNA_PROHIBITED flag failed for 0x%06X. Expected: %04X Got: %04X\n\n",start,UIDNA_PROHIBITED, result);
-                }
-            }
-            start++;
-        }
-    }
-}
+                     UStringPrepType type){
 
-UBool
-cleanup() {
-    if(idnData!=NULL) {
-        udata_close(idnData);
-        idnData=NULL;
-    }
-    dataErrorCode=U_ZERO_ERROR;
-    isDataLoaded=FALSE;
+    uint32_t result =0 ;
+    UStringPrepType retType;
+    UBool isIndex=FALSE;
+    int32_t value=0;
+/*        
+    // supplementary code point 
+    UChar __lead16=UTF16_LEAD(0x2323E);
+    int32_t __offset;
 
-    return TRUE;
-}
-U_CDECL_BEGIN
-static UBool U_CALLCONV
-isAcceptable(void * /* context */,
-             const char * /* type */, const char * /* name */,
-             const UDataInfo *pInfo) {
-    if(
-        pInfo->size>=20 &&
-        pInfo->isBigEndian==U_IS_BIG_ENDIAN &&
-        pInfo->charsetFamily==U_CHARSET_FAMILY &&
-        pInfo->dataFormat[0]==0x49 &&   /* dataFormat="IDNA" 0x49, 0x44, 0x4e, 0x41  */
-        pInfo->dataFormat[1]==0x44 &&
-        pInfo->dataFormat[2]==0x4e &&
-        pInfo->dataFormat[3]==0x41 &&
-        pInfo->formatVersion[0]==2 &&
-        pInfo->formatVersion[2]==UTRIE_SHIFT &&
-        pInfo->formatVersion[3]==UTRIE_INDEX_SHIFT
-    ) {
-        return TRUE;
-    } else {
-        return FALSE;
-    }
-}
+    // get data for lead surrogate 
+    (result)=_UTRIE_GET_RAW((&idnTrie), index, 0, (__lead16));
+    __offset=(&idnTrie)->getFoldingOffset(result);
 
-/* idnTrie: the folding offset is the lead FCD value itself */
-static int32_t U_CALLCONV
-getFoldingOffset(uint32_t data) {
-    if(data&0x8000) {
-        return (int32_t)(data&0x7fff);
+    // get the real data from the folded lead/trail units 
+    if(__offset>0) {
+        (result)=_UTRIE_GET_RAW((&idnTrie), index, __offset, (0x2323E)&0x3ff);
     } else {
-        return 0;
+        (result)=(uint32_t)((&idnTrie)->initialValue);
     }
-}
-U_CDECL_END
 
-static UBool
-loadIDNData(UErrorCode &errorCode) {
-    /* load Unicode normalization data from file */
-    if(isDataLoaded==FALSE) {
-        UTrie _idnTrie={ 0,0,0,0,0,0,0 };
-        UDataMemory *data;
-        const int32_t *p=NULL;
-        const uint8_t *pb;
-        if(&errorCode==NULL || U_FAILURE(errorCode)) {
-            return 0;
-        }
-
-        /* open the data outside the mutex block */
-        data=udata_openChoice(NULL, DATA_TYPE, DATA_NAME, isAcceptable, NULL, &errorCode);
-        dataErrorCode=errorCode;
-        if(U_FAILURE(errorCode)) {
-            return isDataLoaded=FALSE;
-        }
-
-        p=(const int32_t *)udata_getMemory(data);
-        pb=(const uint8_t *)(p+_IDNA_INDEX_TOP);
-        utrie_unserialize(&_idnTrie, pb, p[_IDNA_INDEX_TRIE_SIZE], &errorCode);
-        _idnTrie.getFoldingOffset=getFoldingOffset;
-
-
-        if(U_FAILURE(errorCode)) {
-            dataErrorCode=errorCode;
-            udata_close(data);
-            return isDataLoaded=FALSE;
-        }
-
-        /* in the mutex block, set the data for this process */
-        umtx_lock(NULL);
-        if(idnData==NULL) {
-            idnData=data;
-            data=NULL;
-            uprv_memcpy(&indexes, p, sizeof(indexes));
-            uprv_memcpy(&idnTrie, &_idnTrie, sizeof(UTrie));
-        } else {
-            p=(const int32_t *)udata_getMemory(idnData);
+    UTRIE_GET16(&idnTrie,0x2323E, result);
+*/
+    while(start < end+1){
+        UTRIE_GET16(idnTrie,start, result);
+        retType = getValues(result,value,isIndex);
+        if(result > _SPREP_TYPE_THRESHOLD){
+            if(retType != type){
+                pTestIDNA->errln( "FAIL: Did not get the expected type for 0x%06X. Expected: %s Got: %s\n",start,usprepTypeNames[type], usprepTypeNames[retType]);
+            }
+        }else{
+            if(type == USPREP_PROHIBITED && ((result & 0x01) != 0x01)){
+                pTestIDNA->errln( "FAIL: Did not get the expected type for 0x%06X. Expected: %s Got: %s\n",start,usprepTypeNames[type], usprepTypeNames[retType]);
+            }
         }
-        umtx_unlock(NULL);
-        /* initialize some variables */
-        mappingData=(uint16_t *)((uint8_t *)(p+_IDNA_INDEX_TOP)+indexes[_IDNA_INDEX_TRIE_SIZE]);
-
-        isDataLoaded = TRUE;
 
-        /* if a different thread set it first, then close the extra data */
-        if(data!=NULL) {
-            udata_close(data); /* NULL if it was set correctly */
-        }
+        start++;
     }
-
-    return isDataLoaded;
+    
 }
+
 
 #endif /* #if !UCONFIG_NO_IDNA */
 

Index: testidna.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/testidna.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- testidna.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ testidna.cpp	6 Apr 2004 10:09:43 -0000	1.2
@@ -146,8 +146,8 @@
         0x043e, 0x043d, 0x0438, 0x043d, 0x0435, 0x0433, 0x043e, 0x0432,
         0x043e, 0x0440, 0x044f, 0x0442, 0x043f, 0x043e, 0x0440, 0x0443,
         0x0441, 0x0441, 0x043a, 0x0438
-    }
-   
+    },
+
 };
 
 static const char *asciiIn[] = {
@@ -174,7 +174,6 @@
     "xn--hxargifdar",                       // Greek
     "xn--bonusaa-5bb1da",                   // Maltese
     "xn--b1abfaaepdrnnbgefbadotcwatmq2g4l", // Russian (Cyrillic)
-
 };
 
 static const char *domainNames[] = {
@@ -221,7 +220,7 @@
     "www.\\u0021.com",
     "www.\\u0024.com",
     "\\u003f",
-    // These yeild U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+    // These yeild U_IDNA_PROHIBITED_ERROR
     //"\\u00CF\\u0082.com",
     //"\\u00CE\\u00B2\\u00C3\\u009Fss.com",
     //"\\u00E2\\u0098\\u00BA.com",
@@ -245,13 +244,13 @@
         { 
             0x0077, 0x0077, 0x0077, 0x002e, /* www. */
             0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
-            0x2060,/*prohibited*/
+            0x070F,/*prohibited*/
             0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
             0x002e, 0x0063, 0x006f, 0x006d, /* com. */
             0x0000
         },
-        "www.XN--fxG2146CsoA28OruCyA378BqrE2tCwOp06C5qBw82A1rFfmAE0361DeA96B.com",
-        U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR,
+        "www.XN--8mb5595fsoa28orucya378bqre2tcwop06c5qbw82a1rffmae0361dea96b.com",
+        U_IDNA_PROHIBITED_ERROR,
         FALSE, TRUE, TRUE
     },
 
@@ -265,7 +264,7 @@
         },
         "www.XN--6lA2Bz548Fj1GuA391Bf1Gb1N59Ab29A7iA.com",
 
-        U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR,
+        U_IDNA_UNASSIGNED_ERROR,
         FALSE, TRUE, TRUE
     },
     {
@@ -349,7 +348,7 @@
         0x0000
       },
       "www.XN--ghbgi278xia.com",
-      U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR,
+      U_IDNA_PROHIBITED_ERROR,
       FALSE, TRUE, TRUE
     },
     { 
@@ -423,78 +422,78 @@
        "Non-ASCII multibyte space character U+1680",
        "\xE1\x9A\x80", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Non-ASCII 8bit control character U+0085",
        "\xC2\x85", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Non-ASCII multibyte control character U+180E",
        "\xE1\xA0\x8E", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Non-ASCII control character U+1D175",
        "\xF0\x9D\x85\xB5", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Plane 0 private use character U+F123",
        "\xEF\x84\xA3", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Plane 15 private use character U+F1234",
        "\xF3\xB1\x88\xB4", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Plane 16 private use character U+10F234",
        "\xF4\x8F\x88\xB4", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Non-character code point U+8FFFE",
        "\xF2\x8F\xBF\xBE", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Non-character code point U+10FFFF",
        "\xF4\x8F\xBF\xBF", NULL,
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR 
+       U_IDNA_PROHIBITED_ERROR 
      },
  /* 
      {
        "Surrogate code U+DF42",
        "\xED\xBD\x82", NULL, "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
 */
      {
        "Non-plain text character U+FFFD",
        "\xEF\xBF\xBD", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Ideographic description character U+2FF5",
        "\xE2\xBF\xB5", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Display property character U+0341",
-       "\xCD\x81", "\xCD\x81",
+       "\xCD\x81", "\xCC\x81",
        "Nameprep", UIDNA_DEFAULT, U_ZERO_ERROR
 
      },
@@ -503,26 +502,26 @@
        "Left-to-right mark U+200E",
        "\xE2\x80\x8E", "\xCC\x81", 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
 
        "Deprecated U+202A",
        "\xE2\x80\xAA", "\xCC\x81", 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Language tagging character U+E0001",
        "\xF3\xA0\x80\x81", "\xCC\x81", 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Language tagging character U+E0042",
        "\xF3\xA0\x81\x82", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_PROHIBITED_CODEPOINT_FOUND_ERROR
+       U_IDNA_PROHIBITED_ERROR
      },
      {
        "Bidi: RandALCat character U+05BE and LCat characters",
@@ -538,7 +537,7 @@
      },
      {
        "Bidi: RandALCat character U+FB38 and LCat characters",
-       "\x66\x6F\x6F\xEF\xB9\xB6\x62\x61\x72", "\x66\x6F\x6F \xd9\x8e\x62\x61\x72",
+       "\x66\x6F\x6F\xEF\xB9\xB6\x62\x61\x72", "\x66\x6F\x6F\x20\xd9\x8e\x62\x61\x72",
        "Nameprep", UIDNA_DEFAULT,
        U_ZERO_ERROR
      },
@@ -557,7 +556,7 @@
        "Unassigned code point U+E0002",
        "\xF3\xA0\x80\x82", NULL, 
        "Nameprep", UIDNA_DEFAULT,
-       U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR
+       U_IDNA_UNASSIGNED_ERROR
      },
 
 /*  // Invalid UTF-8
@@ -585,7 +584,41 @@
 
 #define MAX_DEST_SIZE 300
 
+void TestIDNA::debug(const UChar* src, int32_t srcLength, int32_t options){
+    UParseError parseError;
+    UErrorCode transStatus = U_ZERO_ERROR;
+    UErrorCode prepStatus  = U_ZERO_ERROR;
+    NamePrepTransform* trans = NamePrepTransform::createInstance(parseError,transStatus);
+    int32_t prepOptions = (((options & UIDNA_ALLOW_UNASSIGNED) != 0) ? USPREP_ALLOW_UNASSIGNED: 0);
+    UStringPrepProfile* prep = usprep_open(NULL,"uidna",&prepStatus);
+    UChar *transOut=NULL, *prepOut=NULL;
+    int32_t transOutLength=0, prepOutLength=0;
+    
+    
+    transOutLength  = trans->process(src,srcLength,transOut, 0, prepOptions>0, &parseError, transStatus);
+    if( transStatus == U_BUFFER_OVERFLOW_ERROR){
+        transStatus = U_ZERO_ERROR;
+        transOut    = (UChar*) uprv_malloc(U_SIZEOF_UCHAR * transOutLength);
+        transOutLength = trans->process(src,srcLength,transOut, transOutLength, prepOptions>0, &parseError, transStatus);
+    }
 
+    prepOutLength  = usprep_prepare(prep, src, srcLength, prepOut, 0, prepOptions, &parseError, &prepStatus);
+
+    if( prepStatus == U_BUFFER_OVERFLOW_ERROR){
+        prepStatus = U_ZERO_ERROR;
+        prepOut    = (UChar*) uprv_malloc(U_SIZEOF_UCHAR * prepOutLength);
+        prepOutLength  = usprep_prepare(prep, src, srcLength, prepOut, prepOutLength, prepOptions, &parseError, &prepStatus);
+    }
+
+    if(UnicodeString(transOut,transOutLength)!= UnicodeString(prepOut, prepOutLength)){
+        errln("Failed. Expected: " + prettify(UnicodeString(transOut, transOutLength))
+              + " Got: " + prettify(UnicodeString(prepOut,prepOutLength)));
+    }
+    uprv_free(transOut);
+    uprv_free(prepOut);
+    delete trans;
+
+}
 
 void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* testName, 
             UBool useSTD3ASCIIRules,UErrorCode expectedStatus,
@@ -609,7 +642,7 @@
 
     // test null-terminated source and return value of number of UChars required
     if( expectedStatus != U_IDNA_STD3_ASCII_RULES_ERROR ){
-        destLen = func(src,-1,dest,0,options, &parseError , &status);
+        destLen = func(src,-1,NULL,0,options, &parseError , &status);
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
             if(destLen+1 < MAX_DEST_SIZE){
@@ -634,7 +667,7 @@
         } 
         if(testUnassigned ){
             status = U_ZERO_ERROR;
-            destLen = func(src,-1,dest,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
+            destLen = func(src,-1,NULL,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
             if(status == U_BUFFER_OVERFLOW_ERROR){
                 status = U_ZERO_ERROR; // reset error code
                 if(destLen+1 < MAX_DEST_SIZE){
@@ -643,7 +676,12 @@
                     // TODO : compare output with expected
                     if(U_SUCCESS(status) && (doCompare==TRUE) && u_strCaseCompare(dest,destLen, expected,expectedLen,0,&status)!=0){
                         //errln("Did not get the expected result for %s null terminated source with both options set.\n",testName);
-                        errln("Did not get the expected result for "+UnicodeString(testName) +" null terminated source with both options set. Expected: "+ prettify(UnicodeString(expected,expectedLen)));
+                        errln("Did not get the expected result for "+UnicodeString(testName) +
+                              " null terminated source "+ prettify(src) + 
+                              " with both options set. Expected: "+  prettify(UnicodeString(expected,expectedLen))+
+                              "Got: " + prettify(UnicodeString(dest,destLen)));
+
+                        debug(src,-1,options | UIDNA_ALLOW_UNASSIGNED);
                 
                     }
                 }else{
@@ -651,7 +689,7 @@
                 }
             }
             //testing query string
-            if(status != expectedStatus && expectedStatus != U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR){
+            if(status != expectedStatus && expectedStatus != U_IDNA_UNASSIGNED_ERROR){
                 errln( "Did not get the expected error for %s null terminated source with options set. Expected: %s Got: %s\n",testName, u_errorName(expectedStatus), u_errorName(status));
             }  
         }
@@ -659,7 +697,7 @@
         status = U_ZERO_ERROR;
 
         // test source with lengthand return value of number of UChars required
-        destLen = func(tSrc, tSrcLen, dest,0,options, &parseError, &status);
+        destLen = func(tSrc, tSrcLen, NULL,0,options, &parseError, &status);
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
             if(destLen+1 < MAX_DEST_SIZE){
@@ -680,7 +718,7 @@
         if(testUnassigned){
             status = U_ZERO_ERROR;
 
-            destLen = func(tSrc,tSrcLen,dest,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
+            destLen = func(tSrc,tSrcLen,NULL,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
 
             if(status == U_BUFFER_OVERFLOW_ERROR){
                 status = U_ZERO_ERROR; // reset error code
@@ -696,14 +734,14 @@
                 }
             }
             //testing query string
-            if(status != expectedStatus && expectedStatus != U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR){
+            if(status != expectedStatus && expectedStatus != U_IDNA_UNASSIGNED_ERROR){
                 errln( "Did not get the expected error for %s with source length and options set. Expected: %s Got: %s\n",testName, u_errorName(expectedStatus), u_errorName(status));
             }
         }
     }else{
 
         status = U_ZERO_ERROR;
-        destLen = func(src,-1,dest,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
+        destLen = func(src,-1,NULL,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
             if(destLen+1 < MAX_DEST_SIZE){
@@ -726,7 +764,7 @@
 
         status = U_ZERO_ERROR;
 
-        destLen = func(tSrc,tSrcLen,dest,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
+        destLen = func(tSrc,tSrcLen,NULL,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
 
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
@@ -742,7 +780,7 @@
             }
         }
         //testing query string
-        if(status != expectedStatus && expectedStatus != U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR){
+        if(status != expectedStatus && expectedStatus != U_IDNA_UNASSIGNED_ERROR){
             errln( "Did not get the expected error for %s with source length and options set. Expected: %s Got: %s\n",testName, u_errorName(expectedStatus), u_errorName(status));
         }
     }
@@ -801,7 +839,7 @@
     UChar buf[MAX_DEST_SIZE];
 
     for(i=0;i< (int32_t)(sizeof(unicodeIn)/sizeof(unicodeIn[0])); i++){
-        u_charsToUChars(asciiIn[i],buf, uprv_strlen(asciiIn[i])+1);
+        u_charsToUChars(asciiIn[i],buf, (int32_t)(uprv_strlen(asciiIn[i])+1));
         testAPI(unicodeIn[i], buf,testName, FALSE,U_ZERO_ERROR, TRUE, TRUE, func);
         
     }
@@ -813,7 +851,7 @@
     UChar buf[MAX_DEST_SIZE];
     
     for(i=0;i< (int32_t)(sizeof(asciiIn)/sizeof(asciiIn[0])); i++){
-        u_charsToUChars(asciiIn[i],buf, uprv_strlen(asciiIn[i])+1);
+        u_charsToUChars(asciiIn[i],buf, (int32_t)(uprv_strlen(asciiIn[i])+1));
         testAPI(buf,unicodeIn[i],testName,FALSE,U_ZERO_ERROR, TRUE, TRUE, func);
     }
 }
@@ -827,7 +865,7 @@
     int32_t bufLen = 0;
     UParseError parseError;
     for(i=0;i< (int32_t)(sizeof(domainNames)/sizeof(domainNames[0])); i++){
-        bufLen = uprv_strlen(domainNames[i]);
+        bufLen = (int32_t)uprv_strlen(domainNames[i]);
         bufLen = u_unescape(domainNames[i],buf, bufLen+1);
         func(buf,bufLen,expected,MAX_DEST_SIZE, UIDNA_ALLOW_UNASSIGNED, &parseError,&status);
         if(U_FAILURE(status)){
@@ -853,7 +891,7 @@
     int32_t bufLen = 0;
     UParseError parseError; 
     for(i=0;i< (int32_t)(sizeof(domainNames)/sizeof(domainNames[0])); i++){
-        bufLen = uprv_strlen(domainNames[i]);
+        bufLen = (int32_t)uprv_strlen(domainNames[i]);
         bufLen = u_unescape(domainNames[i],buf, bufLen+1);
         func(buf,bufLen,expected,MAX_DEST_SIZE, UIDNA_ALLOW_UNASSIGNED, &parseError,&status);
         if(U_FAILURE(status)){
@@ -899,7 +937,7 @@
 
     for(i=0;i< (int32_t)(sizeof(unicodeIn)/sizeof(unicodeIn[0])); i++){
 
-        u_charsToUChars(asciiIn[i],buf+4, uprv_strlen(asciiIn[i])+1);
+        u_charsToUChars(asciiIn[i],buf+4, (int32_t)(uprv_strlen(asciiIn[i])+1));
         u_strcat(buf,com);
 
         // for every entry in unicodeIn array
@@ -1015,7 +1053,7 @@
         ErrorCases errorCase = errorCases[i];
         UChar* src =NULL;
         if(errorCase.ascii != NULL){
-            bufLen =  uprv_strlen(errorCase.ascii);
+            bufLen =  (int32_t)uprv_strlen(errorCase.ascii);
             u_charsToUChars(errorCase.ascii,buf, bufLen+1);
         }else{
             bufLen = 1 ;
@@ -1054,9 +1092,9 @@
     int32_t expectedLen = 0;
     for(int32_t i=0;i< (int32_t)(sizeof(conformanceTestCases)/sizeof(conformanceTestCases[0]));i++){
         const char* utf8Chars1 = conformanceTestCases[i].in;
-        int32_t utf8Chars1Len = strlen(utf8Chars1);
+        int32_t utf8Chars1Len = (int32_t)strlen(utf8Chars1);
         const char* utf8Chars2 = conformanceTestCases[i].out;
-        int32_t utf8Chars2Len = (utf8Chars2 == NULL) ? 0 : strlen(utf8Chars2);
+        int32_t utf8Chars2Len = (utf8Chars2 == NULL) ? 0 : (int32_t)strlen(utf8Chars2);
 
         UErrorCode status = U_ZERO_ERROR;
         u_strFromUTF8(src,MAX_DEST_SIZE,&srcLen,utf8Chars1,utf8Chars1Len,&status);
@@ -1078,13 +1116,13 @@
                     IDNToASCIIName, FALSE,
                     conformanceTestCases[i].expectedStatus, 
                     TRUE, 
-                    (conformanceTestCases[i].expectedStatus != U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR),
+                    (conformanceTestCases[i].expectedStatus != U_IDNA_UNASSIGNED_ERROR),
                     IDNToASCII);
 
             testAPI(src,expected,
                     toASCIIName, FALSE,
                     conformanceTestCases[i].expectedStatus, TRUE, 
-                    (conformanceTestCases[i].expectedStatus != U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR),
+                    (conformanceTestCases[i].expectedStatus != U_IDNA_UNASSIGNED_ERROR),
                     toASCII);
         }
 
@@ -1264,7 +1302,7 @@
     UChar buf[MAX_DEST_SIZE];
     
     for(i=0;i< (int32_t)(sizeof(asciiIn)/sizeof(asciiIn[0])); i++){
-        u_charsToUChars(asciiIn[i],buf, uprv_strlen(asciiIn[i])+1);
+        u_charsToUChars(asciiIn[i],buf, (int32_t)(uprv_strlen(asciiIn[i])+1));
         testChaining(buf,5,toUnicodeName, FALSE, FALSE, toUnicode);
     }
     for(i=0;i< (int32_t)(sizeof(unicodeIn)/sizeof(unicodeIn[0])); i++){
@@ -1303,7 +1341,7 @@
 
     for(i=0;i< (int32_t)(sizeof(unicodeIn)/sizeof(unicodeIn[0])); i++){
 
-        u_charsToUChars(asciiIn[i],buf+4, uprv_strlen(asciiIn[i])+1);
+        u_charsToUChars(asciiIn[i],buf+4, (int32_t)(uprv_strlen(asciiIn[i])+1));
         u_strcat(buf,com);
 
         // for every entry in unicodeIn array
@@ -1474,11 +1512,15 @@
         asciiLen = idnaref_toASCII(labelUChars, label.length()-1,ascii,asciiCapacity,
                                       UIDNA_DEFAULT,&parseError,&expectedStatus);
 
-        if(expectedStatus == U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR){
+        if(expectedStatus == U_IDNA_UNASSIGNED_ERROR){
             expectedStatus = U_ZERO_ERROR;
             asciiLen = idnaref_toASCII(labelUChars, label.length()-1,ascii,asciiCapacity,
                             UIDNA_ALLOW_UNASSIGNED,&parseError,&expectedStatus);
-            expectedStatus = U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR;
+            if(expectedStatus==U_BUFFER_OVERFLOW_ERROR){
+                errln("idnaref_toASCII failed. Error:" + UnicodeString(u_errorName(expectedStatus)));
+                return;
+            }
+            expectedStatus = U_IDNA_UNASSIGNED_ERROR;
         }
 
         testAPI(labelUChars,ascii, "uidna_toASCII",FALSE,
@@ -1488,11 +1530,15 @@
             expectedStatus = U_ZERO_ERROR;
             uniLen = idnaref_toUnicode(ascii, asciiLen, uni,uniCapacity,UIDNA_DEFAULT,
                                         &parseError,&expectedStatus);
-            if(expectedStatus == U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR){
+            if(expectedStatus == U_IDNA_UNASSIGNED_ERROR){
                 expectedStatus = U_ZERO_ERROR;
                 uniLen = idnaref_toUnicode(ascii, asciiLen, uni,uniCapacity,UIDNA_DEFAULT,
                                         &parseError,&expectedStatus);
-                expectedStatus = U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR;
+                if(expectedStatus==U_BUFFER_OVERFLOW_ERROR){
+                    errln("idnaref_toASCII failed. Error:" + UnicodeString(u_errorName(expectedStatus)));
+                    return;
+                }
+                expectedStatus = U_IDNA_UNASSIGNED_ERROR;
             }
             testAPI(ascii,uni,"uidna_toUnicode",FALSE,expectedStatus,TRUE, FALSE, uidna_toUnicode);
         }
@@ -1512,17 +1558,42 @@
         testCompareReferenceImpl(source.getBuffer(),source.length()-1);
         source.releaseBuffer();
     }
-    /* for debugging
-    source.append("\\U000E5BC8\\U00025112\\U00016846\\U0001B375\\U0002EDE4"
-                  "\\U00016E18\\U00010B84\\U000E1639\\U0001C3BE\\u336B\\u5F66"
-                  "\\u2AA6\\uD817\\u0000");
+    
+    /* for debugging */ 
+    source.append( "\\u2109\\u3E1B\\U000E65CA\\U0001CAC5" );
+                   
     source = source.unescape();
-    testCompareReferenceImpl(source.getBuffer(),source.length()-1);
+    //testCompareReferenceImpl(source.getBuffer(),source.length());
+    debug(source.getBuffer(),source.length(),UIDNA_ALLOW_UNASSIGNED);
     source.releaseBuffer();
-    */
 
-    delete TestIDNA::prep;
-    TestIDNA::prep = NULL;
+    
+    source.truncate(0);
+    source.append("\\uCF18\\U00021161\\U000EEF11\\U0002BB82\\U0001D63C");
+    debug(source.getBuffer(),source.length(),UIDNA_ALLOW_UNASSIGNED);
+    source.releaseBuffer();
+    
+    { // test deletion of code points
+        UnicodeString source("\\u043f\\u00AD\\u034f\\u043e\\u0447\\u0435\\u043c\\u0443\\u0436\\u0435\\u043e\\u043d\\u0438\\u043d\\u0435\\u0433\\u043e\\u0432\\u043e\\u0440\\u044f\\u0442\\u043f\\u043e\\u0440\\u0443\\u0441\\u0441\\u043a\\u0438\\u0000");
+        source = source.unescape();
+        UnicodeString expected("\\u043f\\u043e\\u0447\\u0435\\u043c\\u0443\\u0436\\u0435\\u043e\\u043d\\u0438\\u043d\\u0435\\u0433\\u043e\\u0432\\u043e\\u0440\\u044f\\u0442\\u043f\\u043e\\u0440\\u0443\\u0441\\u0441\\u043a\\u0438\\u0000");
+        expected = expected.unescape();
+        UnicodeString ascii("xn--b1abfaaepdrnnbgefbadotcwatmq2g4l");
+        ascii.append((UChar)0x0000);
+        testAPI(source.getBuffer(),ascii.getBuffer(), "uidna_toASCII", FALSE, U_ZERO_ERROR, TRUE, TRUE, uidna_toASCII);
+        source.releaseBuffer();
+        ascii.releaseBuffer();
+        
+        testAPI(source.getBuffer(),ascii.getBuffer(), "idnaref_toASCII", FALSE, U_ZERO_ERROR, TRUE, TRUE, idnaref_toASCII);
+        source.releaseBuffer();
+        ascii.releaseBuffer();
+
+
+        testCompareReferenceImpl(source.getBuffer(), source.length()-1);
+        source.releaseBuffer();
+
+    }
+
 }
 
 void TestIDNA::TestCompareReferenceImpl(){
@@ -1535,7 +1606,7 @@
         if(quick==TRUE && i> 0x1FFFF){
             return;
         }
-        if(i >= 0x30000){
+        if(i >= 0x30000 && i <= 0xF0000){
            i+=0xB0000;
         }
         if(i>0xFFFF){
@@ -1566,12 +1637,30 @@
                             "idnaref_IDNToUnicode",idnaref_IDNToUnicode
                             );
     testChaining("idnaref_toASCII",idnaref_toASCII, "idnaref_toUnicode", idnaref_toUnicode);
-    delete TestIDNA::prep;
-    TestIDNA::prep = NULL;
 }
 
 void TestIDNA::TestDataFile(){
      testData(*this);
 }
+TestIDNA::~TestIDNA(){
+    if(gPrep!=NULL){
+        delete gPrep;
+        gPrep = NULL;
+    }
+}
 
+NamePrepTransform* TestIDNA::gPrep = NULL;
+
+NamePrepTransform* TestIDNA::getInstance(UErrorCode& status){
+    if(TestIDNA::gPrep == NULL){
+        UParseError parseError;
+        TestIDNA::gPrep = NamePrepTransform::createInstance(parseError, status);
+        if(TestIDNA::gPrep ==NULL){
+           //status = U_MEMORY_ALLOCATION_ERROR;
+           return NULL;
+        }
+    }
+    return TestIDNA::gPrep;
+
+}
 #endif /* #if !UCONFIG_NO_IDNA */

Index: testidna.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/testidna.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- testidna.h	10 Sep 2003 02:42:49 -0000	1.1
+++ testidna.h	6 Apr 2004 10:09:43 -0000	1.2
@@ -21,7 +21,6 @@
 
 #if !UCONFIG_NO_IDNA && !UCONFIG_NO_TRANSLITERATION
 
-#include "sprpimpl.h"
 #include "intltest.h"
 #include "unicode/parseerr.h"
 
@@ -65,7 +64,9 @@
     void TestIDNAMonkeyTest();
     void TestConformance();
     static NamePrepTransform* getInstance(UErrorCode& status);
-    static NamePrepTransform* prep;
+    static NamePrepTransform* gPrep;
+    virtual ~TestIDNA();
+
 private:
     void testToASCII(const char* testName, TestFunc func);
     void testToUnicode(const char* testName, TestFunc func);
@@ -74,7 +75,7 @@
     void testCompare(const char* testName, CompareFunc func);
     void testChaining(const char* toASCIIName, TestFunc toASCII,
                     const char* toUnicodeName, TestFunc toUnicode);
-
+    void debug(const UChar* src, int32_t srcLength, int32_t options);
     // main testing functions
     void testAPI(const UChar *src, const UChar *expected, const char *testName, 
              UBool useSTD3ASCIIRules, UErrorCode expectedStatus,

Index: tfsmalls.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tfsmalls.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tfsmalls.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ tfsmalls.cpp	6 Apr 2004 10:09:43 -0000	1.4
@@ -1,7 +1,7 @@
 
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -19,6 +19,7 @@
 #include "unicode/fieldpos.h"
 #include "unicode/fmtable.h"
 
+#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
 
 /*static UBool chkstatus( UErrorCode &status, char* msg = NULL )
 {
@@ -31,7 +32,7 @@
 {
     ParsePosition* pp1 = new ParsePosition();
     if (pp1 && (pp1->getIndex() == 0)) {
-        it_out << "PP constructor() tested." << endl;
+        it_logln("PP constructor() tested.");
     }else{
         it_errln("*** PP getIndex or constructor() result");
     }
@@ -42,13 +43,13 @@
         int32_t to = 5;
         ParsePosition pp2( to );
         if (pp2.getIndex() == 5) {
-            it_out << "PP getIndex and constructor(int32_t) tested." << endl;
+            it_logln("PP getIndex and constructor(int32_t) tested.");
         }else{
             it_errln("*** PP getIndex or constructor(int32_t) result");
         }
         pp2.setIndex( 3 );
         if (pp2.getIndex() == 3) {
-            it_out << "PP setIndex tested." << endl;
+            it_logln("PP setIndex tested.");
         }else{
             it_errln("*** PP getIndex or setIndex result");
         }
@@ -59,7 +60,7 @@
     pp3 = 5;
     ParsePosition pp4( pp3 );
     if ((pp2 != pp3) && (pp3 == pp4)) {
-        it_out << "PP copy contructor, operator== and operator != tested." << endl;
+        it_logln("PP copy contructor, operator== and operator != tested.");
     }else{
         it_errln("*** PP operator== or operator != result");
     }
@@ -67,7 +68,7 @@
     ParsePosition pp5;
     pp5 = pp4;
     if ((pp4 == pp5) && (!(pp4 != pp5))) {
-        it_out << "PP operator= tested." << endl;
+        it_logln("PP operator= tested.");
     }else{
         it_errln("*** PP operator= operator== or operator != result");
     }
@@ -102,11 +103,11 @@
         int32_t tempOffset = (tempLen <= (tempLen - pos.getEndIndex())) ? 
             tempLen : (tempLen - pos.getEndIndex());
         temp[tempOffset] = '\0';
-        it_out << "FP " << temp << res << endl;
+        it_logln(UnicodeString("FP ") + UnicodeString(temp) + res);
     }
     delete fmt;
     
-    it_out << endl;
+    it_logln("");
 
 }
 
@@ -116,7 +117,7 @@
     FieldPosition fp( 7 );
 
     if (fp.getField() == 7) {
-        it_out << "FP constructor(int32_t) and getField tested." << endl;
+        it_logln("FP constructor(int32_t) and getField tested.");
     }else{
         it_errln("*** FP constructor(int32_t) or getField");
     }
@@ -137,22 +138,22 @@
         if (fp.getEndIndex() != i+7) err3 = TRUE;
     }
     if (!err1) {
-        it_out << "FP setField and getField tested." << endl;
+        it_logln("FP setField and getField tested.");
     }else{
         it_errln("*** FP setField or getField");
     }
     if (!err2) {
-        it_out << "FP setBeginIndex and getBeginIndex tested." << endl;
+        it_logln("FP setBeginIndex and getBeginIndex tested.");
     }else{
         it_errln("*** FP setBeginIndex or getBeginIndex");
     }
     if (!err3) {
-        it_out << "FP setEndIndex and getEndIndex tested." << endl;
+        it_logln("FP setEndIndex and getEndIndex tested.");
     }else{
         it_errln("*** FP setEndIndex or getEndIndex");
     }
 
-    it_out << endl;
+    it_logln("");
 
 }
 
@@ -167,27 +168,27 @@
     Formattable fta, ftb;
     fta.setLong(1); ftb.setLong(2);
     if ((fta != ftb) || !(fta == ftb)) {
-        it_out << "FT setLong, operator== and operator!= tested." << endl;
+        it_logln("FT setLong, operator== and operator!= tested.");
     }else{
         it_errln("*** Formattable setLong or operator== or !=");
     }
     fta = ftb;
     if ((fta == ftb) || !(fta != ftb)) {
-        it_out << "FT operator= tested." << endl;
+        it_logln("FT operator= tested.");
     }else{
         it_errln("*** FT operator= or operator== or operator!=");
     }
     
     fta.setDouble( 3.0 );
     if ((fta.getType() == Formattable::kDouble) && (fta.getDouble() == 3.0)) {
-        it_out << "FT set- and getDouble tested." << endl;
+        it_logln("FT set- and getDouble tested.");
     }else{
         it_errln("*** FT set- or getDouble");
     }
 
     fta.setDate( 4.0 );
     if ((fta.getType() == Formattable::kDate) && (fta.getDate() == 4.0)) {
-        it_out << "FT set- and getDate tested." << endl;
+        it_logln("FT set- and getDate tested.");
     }else{
         it_errln("*** FT set- or getDate");
     }
@@ -195,7 +196,7 @@
     fta.setString("abc");
     UnicodeString res;
     if ((fta.getType() == Formattable::kString) && (fta.getString(res) == "abc")) {
-        it_out << "FT set- and getString tested." << endl;
+        it_logln("FT set- and getString tested.");
     }else{
         it_errln("*** FT set- or getString");
     }
@@ -212,7 +213,7 @@
         ucs,
         ucs_ptr
     };
-    const int32_t ft_cnt = (int32_t)(sizeof(ftarray) / sizeof(Formattable));
+    const int32_t ft_cnt = LENGTHOF(ftarray);
     Formattable ft_arr( ftarray, ft_cnt );
     UnicodeString temp;
     if ((ft_arr[0].getType() == Formattable::kDate)   && (ft_arr[0].getDate()   == 1.0)
@@ -220,28 +221,37 @@
      && (ft_arr[2].getType() == Formattable::kLong)   && (ft_arr[2].getLong()   == (int32_t)3)
      && (ft_arr[3].getType() == Formattable::kString) && (ft_arr[3].getString(temp) == ucs)
      && (ft_arr[4].getType() == Formattable::kString) && (ft_arr[4].getString(temp) == *ucs_ptr) ) {
-        it_out << "FT constr. for date, double, long, ustring, ustring* and array tested" << endl;
+        it_logln("FT constr. for date, double, long, ustring, ustring* and array tested");
     }else{
         it_errln("*** FT constr. for date, double, long, ustring, ustring* or array");
     }
 
-    int32_t res_cnt;
+    int32_t i, res_cnt;
     const Formattable* res_array = ft_arr.getArray( res_cnt );
     if (res_cnt == ft_cnt) {
         UBool same  = TRUE;
-        for (int32_t i = 0; i < res_cnt; i++ ) {
+        for (i = 0; i < res_cnt; i++ ) {
             if (res_array[i] != ftarray[i]) {
                 same = FALSE;
             }
         }
         if (same) {
-            it_out << "FT getArray tested" << endl;
+            it_logln("FT getArray tested");
         }else{
             it_errln("*** FT getArray comparison");
         }
     }else{
-        it_out << res_cnt << " " << ft_cnt << endl;
-        it_errln("*** FT getArray count");
+        it_errln(UnicodeString("*** FT getArray count res_cnt=") + res_cnt + UnicodeString("ft_cnt=") + ft_cnt);
+    }
+
+
+    Formattable *pf;
+    for(i = 0; i < ft_cnt; ++i) {
+        pf = ftarray[i].clone();
+        if(pf == (ftarray + i) || *pf != ftarray[i]) {
+            it_errln("Formattable.clone() failed for item %d" + i);
+        }
+        delete pf;
     }
 
     const Formattable ftarr1[] = { Formattable( (int32_t)1 ), Formattable( (int32_t)2 ) };
@@ -252,18 +262,18 @@
 
     ft_arr.setArray( ftarr1, ftarr1_cnt );
     if ((ft_arr[0].getType() == Formattable::kLong) && (ft_arr[0].getLong() == (int32_t)1)) {
-        it_out << "FT setArray tested" << endl;
+        it_logln("FT setArray tested");
     }else{
         it_errln("*** FT setArray");
     }
 
     Formattable* ft_dynarr = new Formattable[ftarr2_cnt];
-    for (int32_t i = 0; i < ftarr2_cnt; i++ ) {
+    for (i = 0; i < ftarr2_cnt; i++ ) {
         ft_dynarr[i] = ftarr2[i];
     }
     if ((ft_dynarr[0].getType() == Formattable::kLong) && (ft_dynarr[0].getLong() == (int32_t)3)
      && (ft_dynarr[1].getType() == Formattable::kLong) && (ft_dynarr[1].getLong() == (int32_t)4)) {
-        it_out << "FT operator= and array operations tested" << endl;
+        it_logln("FT operator= and array operations tested");
     }else{
         it_errln("*** FT operator= or array operations");
     }
@@ -271,7 +281,7 @@
     ft_arr.adoptArray( ft_dynarr, ftarr2_cnt );
     if ((ft_arr[0].getType() == Formattable::kLong) && (ft_arr[0].getLong() == (int32_t)3)
      && (ft_arr[1].getType() == Formattable::kLong) && (ft_arr[1].getLong() == (int32_t)4)) {
-        it_out << "FT adoptArray tested" << endl;
+        it_logln("FT adoptArray tested");
     }else{
         it_errln("*** FT adoptArray or operator[]");
     }
@@ -283,14 +293,13 @@
 
     fta.adoptString( ucs_dyn );
     if ((fta.getType() == Formattable::kString) && (fta.getString(tmp2) == "ttt")) {
-        it_out << "FT adoptString tested" << endl;
+        it_logln("FT adoptString tested");
     }else{
         it_errln("*** FT adoptString or getString");
     }
     fta.setLong(0);   // calls 'dispose' and deletes adopted string !
 
-    it_out << endl;
-
+    it_logln();
 }
 
 void TestFormatSmallClasses::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )

Index: thcoll.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/thcoll.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- thcoll.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ thcoll.cpp	6 Apr 2004 10:09:44 -0000	1.4
@@ -16,6 +16,7 @@
 #include "unicode/utypes.h"
 #include "unicode/coll.h"
 #include "unicode/sortkey.h"
+#include "unicode/ustring.h"
 #include "cstring.h"
 #include "filestrm.h"
 
@@ -23,14 +24,15 @@
  * The TestDictionary test expects a file of this name, with this
  * encoding, to be present in the directory $ICU/source/test/testdata.
  */
-#define TEST_FILE           "th18057.txt"
+//#define TEST_FILE           "th18057.txt"
+#define TEST_FILE           "riwords.txt"
 #define TEST_FILE_ENCODING  "UTF8"
 
 /**
  * This is the most failures we show in TestDictionary.  If this number
  * is < 0, we show all failures.
  */
-#define MAX_FAILURES_TO_SHOW 8
+#define MAX_FAILURES_TO_SHOW -1
 
 #define CASE(id,test)                 \
     case id:                          \
@@ -46,7 +48,7 @@
     UErrorCode status = U_ZERO_ERROR;
     coll = Collator::createInstance(Locale("th", "TH", ""), status);
     if (coll && U_SUCCESS(status)) {
-        coll->setStrength(Collator::TERTIARY);
+        //coll->setStrength(Collator::TERTIARY);
     } else {
         delete coll;
         coll = 0;
@@ -70,6 +72,8 @@
         CASE(0,TestDictionary)
         CASE(1,TestCornerCases)
         CASE(2,TestNamesList)
+        CASE(3,TestInvalidThai)
+        CASE(4,TestReordering)
         default: name = ""; break;
     }
 }
@@ -84,7 +88,7 @@
     if (T_FileStream_eof(in)) {
         return FALSE;
     }
-    char buffer[128];
+    char buffer[1024];
     char* p = buffer;
     char* limit = p + sizeof(buffer) - 1; // Leave space for 0
     while (p<limit) {
@@ -201,7 +205,7 @@
 
     FileStream *in = T_FileStream_open(buffer, "rb");
     if (in == 0) {
-        errln((UnicodeString)"Error: could not open test file " + buffer);
+        infoln((UnicodeString)"INFO: could not open test file " + buffer + ". Aborting test.");
         return;        
     }
 
@@ -330,18 +334,17 @@
 // Internal utilities
 //------------------------------------------------------------------------
 
-void CollationThaiTest::compareArray(const Collator& c, const char* tests[],
+void CollationThaiTest::compareArray(Collator& c, const char* tests[],
                                      int32_t testsLength) {
-    UErrorCode status = U_ZERO_ERROR;
     for (int32_t i = 0; i < testsLength; i += 3) {
 
-        int32_t expect = 0;
+        Collator::EComparisonResult expect;
         if (tests[i+1][0] == '<') {
-            expect = -1;
+          expect = Collator::LESS;
         } else if (tests[i+1][0] == '>') {
-            expect = 1;
+          expect = Collator::GREATER;
         } else if (tests[i+1][0] == '=') {
-            expect = 0;
+          expect = Collator::EQUAL;
         } else {
             // expect = Integer.decode(tests[i+1]).intValue();
             errln((UnicodeString)"Error: unknown operator " + tests[i+1]);
@@ -352,6 +355,9 @@
         parseChars(s1, tests[i]);
         parseChars(s2, tests[i+2]);
 
+        doTest(&c, s1, s2, expect);
+#if 0
+        UErrorCode status = U_ZERO_ERROR;
         int32_t result = c.compare(s1, s2);
         if (sign(result) != sign(expect))
         {
@@ -393,6 +399,7 @@
                 errln((UnicodeString)"  " + prettify(k1, t1) + " vs. " + prettify(k2, t2));
             }
         }
+#endif
     }
 }
 
@@ -411,5 +418,123 @@
                                              const char* chars) {
     return result = CharsToUnicodeString(chars);
 }
+
+UCollator *thaiColl = NULL;
+
+U_CDECL_BEGIN
+static int U_CALLCONV
+StrCmp(const void *p1, const void *p2) {
+  return ucol_strcoll(thaiColl, *(UChar **) p1, -1,  *(UChar **)p2, -1);
+}
+U_CDECL_END
+
+
+#define LINES 6
+
+void CollationThaiTest::TestInvalidThai(void) {
+  const char *tests[LINES] = {
+    "\\u0E44\\u0E01\\u0E44\\u0E01",
+    "\\u0E44\\u0E01\\u0E01\\u0E44",
+    "\\u0E01\\u0E44\\u0E01\\u0E44",
+    "\\u0E01\\u0E01\\u0E44\\u0E44",
+    "\\u0E44\\u0E44\\u0E01\\u0E01",
+    "\\u0E01\\u0E44\\u0E44\\u0E01",
+  };
+
+  UChar strings[LINES][20];
+
+  UChar *toSort[LINES];
+
+  int32_t i = 0, j = 0, len = 0;
+
+  UErrorCode coll_status = U_ZERO_ERROR;
+  UnicodeString iteratorText;
+
+  thaiColl = ucol_open ("th_TH", &coll_status);
+  if (U_FAILURE(coll_status)) {
+    errln("Error opening Thai collator: %s", u_errorName(coll_status));
+    return;
+  }
+
+  CollationElementIterator* c = ((RuleBasedCollator *)coll)->createCollationElementIterator( iteratorText );
+
+  for(i = 0; i < (int32_t)(sizeof(tests)/sizeof(tests[0])); i++) {
+    len = u_unescape(tests[i], strings[i], 20);
+    strings[i][len] = 0;
+    toSort[i] = strings[i];
+  }
+
+  qsort (toSort, LINES, sizeof (UChar *), StrCmp);
+
+  for (i=0; i < LINES; i++)
+  {
+    logln("%i", i);
+	  for (j=i+1; j < LINES; j++) {
+		  if (ucol_strcoll (thaiColl, toSort[i], -1, toSort[j], -1) == UCOL_GREATER)
+		  {
+			  // inconsistency ordering found!
+            errln("Inconsistent ordering between strings %i and %i", i, j);
+		  }
+	  }
+      iteratorText.setTo(toSort[i]);
+      c->setText(iteratorText, coll_status);
+      backAndForth(*c);
+  }
+
+  
+  ucol_close(thaiColl);
+  delete c;
+}
+
+void CollationThaiTest::TestReordering(void) {
+  const char *tests[] = { 
+                          "\\u0E41c\\u0301",       "=", "\\u0E41\\u0107", // composition
+                          "\\u0E41\\uD835\\uDFCE", "<", "\\u0E41\\uD835\\uDFCF", // supplementaries
+                          "\\u0E41\\uD834\\uDD5F", "=", "\\u0E41\\uD834\\uDD58\\uD834\\uDD65", // supplementary composition decomps to supplementary
+                          "\\u0E41\\uD87E\\uDC02", "=", "\\u0E41\\u4E41", // supplementary composition decomps to BMP
+                          "\\u0E41\\u0301",        "=", "\\u0E41\\u0301", // unsafe (just checking backwards iteration)
+                          "\\u0E41\\u0301\\u0316", "=", "\\u0E41\\u0316\\u0301",
+                          "\\u0e24\\u0e41",        "=", "\\u0e41\\u0e24", // exiting contraction bug
+                          "\\u0e3f\\u0e3f\\u0e24\\u0e41", "=", "\\u0e3f\\u0e3f\\u0e41\\u0e24",
+
+                          "abc\\u0E41c\\u0301",       "=", "abc\\u0E41\\u0107", // composition
+                          "abc\\u0E41\\uD834\\uDC00", "<", "abc\\u0E41\\uD834\\uDC01", // supplementaries
+                          "abc\\u0E41\\uD834\\uDD5F", "=", "abc\\u0E41\\uD834\\uDD58\\uD834\\uDD65", // supplementary composition decomps to supplementary
+                          "abc\\u0E41\\uD87E\\uDC02", "=", "abc\\u0E41\\u4E41", // supplementary composition decomps to BMP
+                          "abc\\u0E41\\u0301",        "=", "abc\\u0E41\\u0301", // unsafe (just checking backwards iteration)
+                          "abc\\u0E41\\u0301\\u0316", "=", "abc\\u0E41\\u0316\\u0301",
+
+                          "\\u0E41c\\u0301abc",       "=", "\\u0E41\\u0107abc", // composition
+                          "\\u0E41\\uD834\\uDC00abc", "<", "\\u0E41\\uD834\\uDC01abc", // supplementaries
+                          "\\u0E41\\uD834\\uDD5Fabc", "=", "\\u0E41\\uD834\\uDD58\\uD834\\uDD65abc", // supplementary composition decomps to supplementary
+                          "\\u0E41\\uD87E\\uDC02abc", "=", "\\u0E41\\u4E41abc", // supplementary composition decomps to BMP
+                          "\\u0E41\\u0301abc",        "=", "\\u0E41\\u0301abc", // unsafe (just checking backwards iteration)
+                          "\\u0E41\\u0301\\u0316abc", "=", "\\u0E41\\u0316\\u0301abc",
+
+                          "abc\\u0E41c\\u0301abc",       "=", "abc\\u0E41\\u0107abc", // composition
+                          "abc\\u0E41\\uD834\\uDC00abc", "<", "abc\\u0E41\\uD834\\uDC01abc", // supplementaries
+                          "abc\\u0E41\\uD834\\uDD5Fabc", "=", "abc\\u0E41\\uD834\\uDD58\\uD834\\uDD65abc", // supplementary composition decomps to supplementary
+                          "abc\\u0E41\\uD87E\\uDC02abc", "=", "abc\\u0E41\\u4E41abc", // supplementary composition decomps to BMP
+                          "abc\\u0E41\\u0301abc",        "=", "abc\\u0E41\\u0301abc", // unsafe (just checking backwards iteration)
+                          "abc\\u0E41\\u0301\\u0316abc", "=", "abc\\u0E41\\u0316\\u0301abc",
+                        };
+
+  compareArray(*coll, tests, sizeof(tests)/sizeof(tests[0]));
+ 
+  const char *rule = "& c < ab";
+  const char *testcontraction[] = { "\\u0E41ab", "<", "\\u0E41c"};
+  UnicodeString rules;
+  UErrorCode status = U_ZERO_ERROR;
+  parseChars(rules, rule);
+  RuleBasedCollator *rcoll = new RuleBasedCollator(rules, status);
+  if(U_SUCCESS(status)) {
+    compareArray(*rcoll, testcontraction, 3);
+    delete rcoll;
+  } else {
+    errln("Couldn't instantiate collator from rules");
+  }
+
+}
+
 
 #endif /* #if !UCONFIG_NO_COLLATION */

Index: thcoll.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/thcoll.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- thcoll.h	10 Sep 2003 02:42:49 -0000	1.3
+++ thcoll.h	6 Apr 2004 10:09:44 -0000	1.4
@@ -49,9 +49,19 @@
      */
     void TestNamesList(void);
 
+    /** 
+     * test that invalid Thai sorts properly
+     */
+    void TestInvalidThai(void);
+
+    /** 
+     * test that reording is done properly
+     */
+    void TestReordering(void);
+
 private:
 
-    void compareArray(const Collator& c, const char* tests[],
+    void compareArray(Collator& c, const char* tests[],
                       int32_t testsLength);
 
     int8_t sign(int32_t i);

Index: tmsgfmt.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tmsgfmt.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tmsgfmt.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ tmsgfmt.cpp	6 Apr 2004 10:09:44 -0000	1.4
@@ -129,9 +129,7 @@
         success = U_ZERO_ERROR;
         ParsePosition parsePos;
         form->parse(buffer, result, parsePos);
-#ifdef _DEBUG
-        it_out << " -> " /*<< dec*/ /*<< result*/ << "[supposed output for result]" <<endl;
-#endif
+        logln(UnicodeString(" -> ") /* + << dec*/ + toString(result) + UnicodeString("[supposed output for result]"));
         if (U_FAILURE(success)) {
             errln("Err: Number Format parse");
             logln("Number format parse failed.");

Index: transapi.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/transapi.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- transapi.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ transapi.cpp	6 Apr 2004 10:09:44 -0000	1.5
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include "unicode/rep.h"
 #include "unicode/locid.h"
-
+#include "unicode/uniset.h"
 int32_t getInt(UnicodeString str)
 {
     char buffer[20];
@@ -308,6 +308,7 @@
         message.append(Data[i][1]);
         doTest(message, temp, Data[i+2]);
 
+        callEverything(t, __LINE__);
         delete t;
     }
 }
@@ -349,6 +350,7 @@
         t->transliterate(temp, start, limit);
         doTest(t->getID() + ".transliterate(Replaceable, int32_t, int32_t, ):(" + start + "," + limit + ")  for \n\t source: " + prettify(Data2[i+1]), temp, Data2[i+5]);
         status = U_ZERO_ERROR;
+        callEverything(t, __LINE__);
         delete t;
         t = NULL;
     }
@@ -363,11 +365,13 @@
     }
     gotResBuf = temp = "try start greater than limit";
     t->transliterate(gotResBuf, 10, 5);
-    if(gotResBuf == temp)
+    if(gotResBuf == temp) {
         logln("OK: start greater than limit value handled correctly");
-    else
+    } else {
         errln("FAIL: start greater than limit value returned" + gotResBuf);
+    }
 
+    callEverything(t, __LINE__);
     delete t;
 
 }
@@ -408,12 +412,16 @@
     UParseError parseError;
     Transliterator* t=Transliterator::createInstance("Any-Hex", UTRANS_FORWARD, parseError, status);
     if(t == 0) {
+        UnicodeString context;
+
+        if (parseError.preContext[0]) {
+            context += (UnicodeString)" at " + parseError.preContext;
+        }
+        if (parseError.postContext[0]) {
+            context += (UnicodeString)" | " + parseError.postContext;
+        }
         errln((UnicodeString)"FAIL: can't create Any-Hex, " +
-              (UnicodeString)u_errorName(status) +
-              (parseError.preContext[0] ?
-               ((UnicodeString)" at " + parseError.preContext +
-                (parseError.postContext[0] ?
-                 ((UnicodeString)" | " + parseError.postContext) : (UnicodeString)"")) : (UnicodeString)""));
+              (UnicodeString)u_errorName(status) + context);
         return;
     }
     UTransPosition index={19,20,20,20};
@@ -627,6 +635,7 @@
         errln("ERROR: NullTransliterator->handleTransliterate() failed");
     }
     doTest((UnicodeString)"NullTransliterator->handleTransliterate", replaceable, s);
+    callEverything(nullTrans, __LINE__);
     delete nullTrans;
 
     
@@ -662,6 +671,8 @@
       errln("FAIL: TestA-TestB not registered\n");
       return;
    }
+   callEverything(s, __LINE__);
+   callEverything(t, __LINE__);
    delete s;
    
    /* Check inverse too
@@ -801,6 +812,7 @@
     doTest("adoptFilter round trip", got, temp);
 
     t->adoptFilter(new TestFilter2);
+    callEverything(t, __LINE__);
     data="heelloe";
     exp=UnicodeString("\\u0068eell\\u006Fe", "");
     got = data;
@@ -889,5 +901,64 @@
     else 
         errln((UnicodeString)"FAIL:" + message + " failed  Got-->" + prettify(result)+ ", Expected--> " + prettify(expected) );
 }
+
+
+//
+//  callEverything    call all of the const (non-destructive) methods on a
+//                    transliterator, just to verify that they don't fail in some
+//                    destructive way.
+//
+#define CEASSERT(a) {if (!(a)) { \
+errln("FAIL at line %d from line %d: %s", __LINE__, line, #a);  return; }}
+
+void TransliteratorAPITest::callEverything(const Transliterator *tr, int line) {
+    Transliterator *clonedTR = tr->clone();
+    CEASSERT(clonedTR != NULL);
+
+    int32_t  maxcl = tr->getMaximumContextLength();
+    CEASSERT(clonedTR->getMaximumContextLength() == maxcl);
+
+    UnicodeString id;
+    UnicodeString clonedId;
+    id = tr->getID();
+    clonedId = clonedTR->getID();
+    CEASSERT(id == clonedId);
+
+    const UnicodeFilter *filter = tr->getFilter();
+    const UnicodeFilter *clonedFilter = clonedTR->getFilter();
+    if (filter == NULL || clonedFilter == NULL) {
+        // If one filter is NULL they better both be NULL.
+        CEASSERT(filter == clonedFilter);
+    } else {
+        CEASSERT(filter != clonedFilter);
+    }
+
+    UnicodeString rules;
+    UnicodeString clonedRules;
+    rules = tr->toRules(rules, FALSE);
+    clonedRules = clonedTR->toRules(clonedRules, FALSE);
+    CEASSERT(rules == clonedRules);
+
+    UnicodeSet sourceSet;
+    UnicodeSet clonedSourceSet;
+    tr->getSourceSet(sourceSet);
+    clonedTR->getSourceSet(clonedSourceSet);
+    CEASSERT(clonedSourceSet == sourceSet);
+
+    UnicodeSet targetSet;
+    UnicodeSet clonedTargetSet;
+    tr->getTargetSet(targetSet);
+    clonedTR->getTargetSet(clonedTargetSet);
+    CEASSERT(targetSet == clonedTargetSet);
+
+    UClassID classID = tr->getDynamicClassID();
+    CEASSERT(classID == clonedTR->getDynamicClassID());
+    CEASSERT(classID != 0);
+
+    delete clonedTR;
+}
+
+
+
 
 #endif /* #if !UCONFIG_NO_TRANSLITERATION */

Index: transapi.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/transapi.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- transapi.h	10 Sep 2003 02:42:49 -0000	1.3
+++ transapi.h	6 Apr 2004 10:09:44 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 2001, International Business Machines Corporation and
+ * Copyright (c) 2001-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /************************************************************************
@@ -66,6 +66,8 @@
 
     void displayOutput(const UnicodeString&, const UnicodeString&, UnicodeString&,
                        UTransPosition&);
+
+    void callEverything(const Transliterator *t, int line);
 
 };
 

Index: transrt.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/transrt.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- transrt.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ transrt.cpp	6 Apr 2004 10:09:44 -0000	1.5
@@ -564,7 +564,7 @@
     TransliteratorPointer sourceToTarget(
         Transliterator::createInstance(transliteratorID, UTRANS_FORWARD, parseError,
                                        status));
-    if (sourceToTarget == NULL) {
+    if ((const Transliterator *)sourceToTarget == NULL) {
         parent->errln("FAIL: createInstance(" + transliteratorID +
                    ") returned NULL. Error: " + u_errorName(status)
                    + "\n\tpreContext : " + prettify(parseError.preContext) 
@@ -573,7 +573,7 @@
                 return;
     }
     TransliteratorPointer targetToSource(sourceToTarget->createInverse(status));
-    if (targetToSource == NULL) {
+    if ((const Transliterator *)targetToSource == NULL) {
         parent->errln("FAIL: " + transliteratorID +
                    ".createInverse() returned NULL. Error:" + u_errorName(status)          
                    + "\n\tpreContext : " + prettify(parseError.preContext) 
@@ -1173,26 +1173,32 @@
 void TransliteratorRoundTripTest::TestDevanagariLatin() {
     {
         UErrorCode status = U_ZERO_ERROR;
-        TransliteratorPointer t1(Transliterator::createInstance("[\\u0000-\\u00FE \\u0982\\u0983 [:Bengali:][:nonspacing mark:]];NFD;Bengali-InterIndic;InterIndic-Gujarati;NFC;( [ \\u0000-\\u00FE [:Gujarati:][[:nonspacing mark:]])",UTRANS_FORWARD, status));
-        if(t1){
+        UParseError parseError;
+        TransliteratorPointer t1(Transliterator::createInstance("[\\u0964-\\u0965\\u0981-\\u0983\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC\\u09BE-\\u09C4\\u09C7-\\u09C8\\u09CB-\\u09CD\\u09D7\\u09DC-\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09FA];NFD;Bengali-InterIndic;InterIndic-Gujarati;NFC;",UTRANS_FORWARD, parseError, status));
+        if((const Transliterator *)t1 != NULL){
             TransliteratorPointer t2(t1->createInverse(status));
             if(U_FAILURE(status)){
                 errln("FAIL: could not create the Inverse:-( \n");
             }
+        }else {
+            errln("FAIL: could not create the transliterator. Error: %s\n", u_errorName(status));
         }
+
     }
     RTTest test("Latin-Devanagari");
     Legal *legal = new LegalIndic();
 
-#if (U_ICU_VERSION_MAJOR_NUM==2 && U_ICU_VERSION_MINOR_NUM==6)
-    test.test(UnicodeString(latinForIndic, ""), 
+    if (isICUVersionAtLeast(ICU_30)) {
+        // We temporarily filter against Unicode 3.2, but we only do this
+        // before version 3.0.    
+        test.test(UnicodeString(latinForIndic, ""), 
               UnicodeString("[[:Devanagari:]&[:Age=3.2:]]", ""), NULL, this, quick, 
               legal, 50);
-#else
-    test.test(UnicodeString(latinForIndic, ""), 
-              UnicodeString("[:Devanagari:]", ""), NULL, this, quick, 
-              legal, 50);
-#endif
+        return;
+    } else {
+        logln("Warning: TestDevanagariLatin needs to be updated to remove Unicode 3.2 filter");
+    }
+
     delete legal;
 }
 
@@ -1459,22 +1465,26 @@
     for(int i = 0; i < num;i++){
         RTTest test(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 0]);
         Legal *legal = new LegalIndic();
-#if (U_ICU_VERSION_MAJOR_NUM==2 && U_ICU_VERSION_MINOR_NUM==6)
-        UnicodeString temp1 = "[";
-        temp1.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1]);
-        temp1.append("& [:Age=3.2:]]");
-        UnicodeString temp2 = "[";
-        temp2.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2]);
-        temp2.append("& [:Age=3.2:]]");
-#else
-        UnicodeString temp1 = interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1];
-        UnicodeString temp2 = interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2];
-#endif
-        test.test(temp1, 
-                  temp2, 
-                  interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions 
-                  this, quick, legal, 50);
-       delete legal;
+
+        if (isICUVersionAtLeast(ICU_30)) {
+            // We temporarily filter against Unicode 3.2, but we only do this
+            // before version 3.0.    
+            UnicodeString temp1 = "[";
+            temp1.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1]);
+            temp1.append("& [:Age=3.2:]]");
+            UnicodeString temp2 = "[";
+            temp2.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2]);
+            temp2.append("& [:Age=3.2:]]");
+
+            test.test(temp1, 
+                      temp2, 
+                      interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions 
+                      this, quick, legal, 50);
+            return;
+        } else {
+            logln("Warning: TestDevanagariLatin needs to be updated to remove Unicode 3.2 filter");
+        }
+        delete legal;
     }
     
 }

Index: transtst.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/transtst.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- transtst.cpp	10 Sep 2003 02:42:49 -0000	1.5
+++ transtst.cpp	6 Apr 2004 10:09:45 -0000	1.6
@@ -17,13 +17,10 @@
 #include "unicode/dtfmtsym.h"
 #include "unicode/normlzr.h"
 #include "unicode/translit.h"
-#include "unicode/ucnv.h"
-#include "unicode/ucnv_err.h"
 #include "unicode/uchar.h"
 #include "unicode/unifilt.h"
 #include "unicode/uniset.h"
 #include "unitohex.h"
-#include "unicode/utypes.h"
 #include "unicode/ustring.h"
 #include "unicode/usetiter.h"
 #include "unicode/uscript.h"
@@ -42,6 +39,7 @@
 #include "unesctrn.h"
 #include "uni2name.h"
 #include "cstring.h"
+#include <stdio.h>
 
 /***********************************************************************
 
@@ -102,6 +100,8 @@
 {
 }
 
+TransliteratorTest::~TransliteratorTest() {}
+
 void
 TransliteratorTest::runIndexedTest(int32_t index, UBool exec,
                                    const char* &name, char* /*par*/) {
@@ -1296,7 +1296,10 @@
         UnicodeString expID(DATA[i+2]);
         Transliterator* t =
             Transliterator::createInstance(id,dir,err,ec);
-        UnicodeString newID = t?t->getID():UnicodeString();
+        UnicodeString newID;
+        if (t) {
+            newID = t->getID();
+        }
         UBool ok = (newID == expID);
         if (!t) {
             newID = u_errorName(ec);
@@ -2250,15 +2253,22 @@
             t = Transliterator::createInstance(id, direction, pe, ec);
         }
         UBool ok = (t != NULL && U_SUCCESS(ec));
+        UnicodeString transID;
+        if (t!=0) {
+            transID = t->getID();
+        }
+        else {
+            transID = UnicodeString("NULL", "");
+        }
         if (ok == expOk) {
-            logln((UnicodeString)"Ok: " + id + " => " + (t!=0?t->getID():(UnicodeString)"NULL") + ", " +
+            logln((UnicodeString)"Ok: " + id + " => " + transID + ", " +
                   u_errorName(ec));
             if (source.length() != 0) {
                 expect(*t, source, exp);
             }
             delete t;
         } else {
-            errln((UnicodeString)"FAIL: " + id + " => " + (t!=0?t->getID():(UnicodeString)"NULL") + ", " +
+            errln((UnicodeString)"FAIL: " + id + " => " + transID + ", " +
                   u_errorName(ec));
         }
     }

Index: transtst.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/transtst.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- transtst.h	10 Sep 2003 02:42:49 -0000	1.5
+++ transtst.h	6 Apr 2004 10:09:45 -0000	1.6
@@ -25,7 +25,7 @@
 
 public:
     TransliteratorTest();
-    virtual ~TransliteratorTest() {}
+    virtual ~TransliteratorTest();
 
 private:
     void runIndexedTest(int32_t index, UBool exec, const char* &name,

Index: tscoll.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tscoll.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- tscoll.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ tscoll.cpp	6 Apr 2004 10:09:45 -0000	1.5
@@ -20,7 +20,7 @@
 #if !UCONFIG_NO_COLLATION
 
 #include "unicode/uchar.h"
-
+#include "unicode/ustring.h"
 
 #include "dadrcoll.h"
 
@@ -48,6 +48,7 @@
 #include "lcukocol.h"
 #include "ucaconf.h"
 #include "svccoll.h"
+#include "cmemory.h"
 
 void IntlTestCollator::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
 {
@@ -96,9 +97,9 @@
         break;
 
     case 3:
-        name = "CollationDanishTest";
+        name = "CollationDanishTest"; 
 
-        if (exec)
+        if (0) // exec // removed by weiv - we have changed Danish collation
         {
             logln("CollationDanishtest---");
             logln("");
@@ -124,7 +125,7 @@
     case 5:
         name = "CollationFinnishTest"; 
 
-        if (exec)
+        if (0) // exec // removed by weiv - we have changed Finnish collation
         {
             logln("CollationFinnishtest---");
             
@@ -386,7 +387,7 @@
     const UChar* trg = target.getBuffer();
     UCollationResult compareResultIter = (UCollationResult)result;
 
-    if(!quick) {
+    if(1) {
       UCharIterator sIter, tIter;
       uiter_setString(&sIter, src, sLen);
       uiter_setString(&tIter, trg, tLen);
@@ -636,6 +637,15 @@
 
     while ((o = iter.previous(status)) != CollationElementIterator::NULLORDER)
     {
+        if (index == 0) {
+          if(o == 0) {
+            continue;
+          } else { // this is an error, orders exhausted but there are non-ignorable CEs from
+            // going backwards
+            errln("Backward iteration returned a non ignorable after orders are exhausted");
+            break;
+        }
+        }
         if (o != orders[--index])
         {
             if (o == 0)
@@ -647,8 +657,8 @@
                 }
                 if (o != orders[index])
                 {
-                    errln("Mismatch at index %d: 0x%X vs 0x%X", index,
-                        orders[index], o);
+            errln("Mismatch at index %d: 0x%X vs 0x%X", index,
+                  orders[index], o);
                     break;
                 }
             }

Index: tscoll.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tscoll.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tscoll.h	10 Sep 2003 02:42:49 -0000	1.3
+++ tscoll.h	6 Apr 2004 10:09:45 -0000	1.4
@@ -17,11 +17,7 @@
 
 #include "intltest.h"
 #include "unicode/coll.h"
-#include "unicode/sortkey.h"
-#include "unicode/schriter.h"
-#include "unicode/ures.h"
 #include "unicode/coleitr.h"
-#include "cmemory.h"
 
 
 class IntlTestCollator: public IntlTest {

Index: tsdate.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tsdate.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- tsdate.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ tsdate.cpp	6 Apr 2004 10:09:45 -0000	1.5
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -17,6 +17,8 @@
 
 const double IntlTestDateFormat::ONEYEAR = 365.25 * ONEDAY; // Approximate
 
+IntlTestDateFormat::~IntlTestDateFormat() {}
+
 /**
  * This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
  * DateFormat.
@@ -150,6 +152,9 @@
     int32_t dateMatch = 0;
     int32_t stringMatch = 0;
     UBool dump = FALSE;
+#if defined (U_CAL_DEBUG)
+    dump = TRUE;
+#endif
     int32_t i;
 
     date[0] = theDate;

Index: tsdate.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tsdate.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tsdate.h	10 Sep 2003 02:42:49 -0000	1.3
+++ tsdate.h	6 Apr 2004 10:09:45 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -74,7 +74,7 @@
         DATE_TIME
     };
 public:
-    virtual ~IntlTestDateFormat() {}
+    virtual ~IntlTestDateFormat();
 };
 
 #endif /* #if !UCONFIG_NO_FORMATTING */

Index: tsdtfmsy.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tsdtfmsy.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tsdtfmsy.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ tsdtfmsy.cpp	6 Apr 2004 10:09:45 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 

Index: tsmthred.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tsmthred.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- tsmthred.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ tsmthred.cpp	6 Apr 2004 10:09:45 -0000	1.5
@@ -10,19 +10,19 @@
 # endif
 #endif
 
-#include <unicode/umachine.h>
+#include "unicode/utypes.h"
+#include "unicode/ustring.h"
+#include "umutex.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "uparse.h"
 
-// Just turn off threads on cygwin, so that we can test
-// the other stuff. This needs to be investigated further.
-#if defined(U_CYGWIN)
-#define ICU_USE_THREADS 0
-#endif
 
 #if !defined(WIN32) && !defined(XP_MAC) && !defined(U_RHAPSODY)
 #define POSIX 1
 #endif
 
-#if defined(POSIX) || defined(U_SOLARIS) || defined(AIX) || defined(HPUX)
+#if defined(POSIX) || defined(U_SOLARIS) || defined(U_AIX) || defined(U_HPUX)
 
 #define HAVE_IMP
 
@@ -66,17 +66,7 @@
 #undef sleep
 #endif
 
-#include "unicode/utypes.h"
 
-/* APP_NO_THREADS is an old symbol. We'll honour it if present. */
-#ifdef APP_NO_THREADS
-# define ICU_USE_THREADS 0
-#endif
-
-/* Default: use threads. */
-#ifndef ICU_USE_THREADS
-# define ICU_USE_THREADS 1
-#endif
 
 #include "tsmthred.h"
 
@@ -217,7 +207,7 @@
 #endif
 
 
-#if defined(POSIX)||defined(U_SOLARIS)||defined(AIX)||defined(HPUX)
+#if defined(POSIX)||defined(U_SOLARIS)||defined(U_AIX)||defined(U_HPUX)
 #define HAVE_IMP
 
 struct PosixThreadImplementation
@@ -271,7 +261,7 @@
 
 #ifdef HPUX_CMA
     cma_sleep(millis/100);
-#elif defined(HPUX) || defined(OS390)
+#elif defined(U_HPUX) || defined(OS390)
     millis *= 1000;
     while(millis >= 1000000) {
         usleep(999999);
@@ -894,6 +884,7 @@
     }
     umtx_destroy(&ftMutex);
     return;
+
 }
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
@@ -1046,8 +1037,8 @@
     }
   }
 
-  Line *lines = new Line[65000];
-  uprv_memset(lines, 0, sizeof(Line)*65000);
+  Line *lines = new Line[200000];
+  uprv_memset(lines, 0, sizeof(Line)*200000);
   int32_t lineNum = 0;
 
   UChar bufferU[1024];

Index: tsnmfmt.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tsnmfmt.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tsnmfmt.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ tsnmfmt.cpp	6 Apr 2004 10:09:46 -0000	1.4
@@ -11,6 +11,9 @@
 #include "unicode/decimfmt.h"
 #include "tsnmfmt.h"
 #include <float.h>
+#include <stdlib.h>
+
+IntlTestNumberFormat::~IntlTestNumberFormat() {}
 
 static const char * formattableTypeName(Formattable::Type t)
 {
@@ -20,6 +23,7 @@
   case Formattable::kLong: return "kLong";
   case Formattable::kString: return "kString";
   case Formattable::kArray: return "kArray";
+  case Formattable::kInt64: return "kInt64";
   default: return "??unknown??";
   }
 }
@@ -128,13 +132,15 @@
 }
 
 
-/* Make sure that we don't get something too large and multiply into infinity. */
+/* Make sure that we don't get something too large and multiply into infinity.
+   @param smallerThanMax the requested maximum value smaller than DBL_MAX */
 double IntlTestNumberFormat::getSafeDouble(double smallerThanMax) {
     double it;
+    double high = (DBL_MAX/smallerThanMax)/10.0;
+    double low = -high;
     do {
         it = randDouble();
-    } while (-DBL_MAX/smallerThanMax > it || it > DBL_MAX/smallerThanMax);
-    it *= smallerThanMax/10.0;
+    } while (low > it || it > high);
     return it;
 }
 
@@ -290,6 +296,8 @@
         // Convert from long to double
         if (number[i].getType() == Formattable::kLong)
             number[i].setDouble(number[i].getLong());
+		else if (number[i].getType() == Formattable::kInt64)
+			number[i].setDouble((double)number[i].getInt64());
         else if (number[i].getType() != Formattable::kDouble)
         {
             errMsg = ("**** FAIL: Parse of " + prettify(string[i-1])

Index: tsnmfmt.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tsnmfmt.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tsnmfmt.h	10 Sep 2003 02:42:49 -0000	1.3
+++ tsnmfmt.h	6 Apr 2004 10:09:46 -0000	1.4
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -8,14 +8,11 @@
 #define _INTLTESTNUMBERFORMAT
 
 
-#include <stdlib.h>
-
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_FORMATTING
 
 #include "unicode/numfmt.h"
-#include "unicode/fmtable.h"
 #include "unicode/locid.h"
 #include "intltest.h"
 
@@ -60,7 +57,7 @@
 
 public:
 
-    virtual ~IntlTestNumberFormat() {}
+    virtual ~IntlTestNumberFormat();
 
     /*
      * Return a random double that isn't too large.

Index: tzbdtest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tzbdtest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tzbdtest.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ tzbdtest.cpp	6 Apr 2004 10:09:46 -0000	1.4
@@ -175,7 +175,11 @@
 UnicodeString
 TimeZoneBoundaryTest::showNN(int32_t n)
 {
-    return ((n < 10) ? UnicodeString("0"): UnicodeString("")) + n;
+    UnicodeString nStr;
+    if (n < 10) {
+        nStr += UnicodeString("0", "");
+    }
+    return nStr + n;
 }
  
 // -------------------------------------
@@ -401,7 +405,7 @@
 void
 TimeZoneBoundaryTest::TestStepwise()
 {
-    TimeZone *zone =  TimeZone::createTimeZone("EST");
+    TimeZone *zone =  TimeZone::createTimeZone("America/New_York");
     findBoundariesStepwise(1997, ONE_DAY, zone, 2);
     delete zone;
     zone = TimeZone::createTimeZone("UTC"); // updated 12/3/99 aliu

Index: tzregts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tzregts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tzregts.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ tzregts.cpp	6 Apr 2004 10:09:46 -0000	1.4
@@ -126,7 +126,7 @@
 {
     UErrorCode status = U_ZERO_ERROR;
     UnicodeString str, str2;
-    SimpleTimeZone *z = (SimpleTimeZone*) TimeZone::createTimeZone("GMT");
+    SimpleTimeZone *z = new SimpleTimeZone(0, "GMT");
     if (z->useDaylightTime())
         errln("Fail: Fix test to start with non-DST zone");
     z->setStartRule(UCAL_FEBRUARY, 1, UCAL_SUNDAY, 0, status);
@@ -486,7 +486,7 @@
         // h is in half-hours from GMT; rawoffset is in millis
         int32_t rawoffset = h * 1800000;
         int32_t hh = (h<0) ? -h : h;
-        UnicodeString hname = ((h<0) ? UnicodeString("GMT-") : UnicodeString("GMT+")) +
+        UnicodeString hname = UnicodeString((h<0) ? "GMT-" : "GMT+") +
             ((hh/2 < 10) ? "0" : "") +
             (hh/2) + ':' +
             ((hh%2==0) ? "00" : "30");
@@ -497,8 +497,11 @@
             count = ids->count(ec);
             if (count> max) 
                 max = count;
-            logln(hname + ' ' + count +
-                  ((count > 0) ? (" e.g. " + *ids->snext(ec)) : UnicodeString("")));
+            if (count > 0) {
+                logln(hname + ' ' + (UnicodeString)count + (UnicodeString)" e.g. " + *ids->snext(ec));
+            } else {
+                logln(hname + ' ' + count);
+            }
             // weiv 11/27/2002: why uprv_free? This should be a delete
             delete ids;
             //delete [] ids;
@@ -795,10 +798,17 @@
         //   e = ex;
         //}
         if(good != U_SUCCESS(status)) {
+            UnicodeString errMsg;
+            if (good) {
+                errMsg = (UnicodeString(") threw ") + u_errorName(status));
+            }
+            else {
+                errMsg = UnicodeString(") accepts invalid args", "");
+            }
             errln(UnicodeString("Fail: getOffset(") +
                   DATA[i+1] + ", " + DATA[i+2] + ", " + DATA[i+3] + ", " +
                   DATA[i+4] + ", " + DATA[i+5] + ", " + DATA[i+6] +
-                  (good ? (UnicodeString(") threw ") + u_errorName(status)) : UnicodeString(") accepts invalid args")));
+                  errMsg);
         }
         status = U_ZERO_ERROR; // reset
     }
@@ -834,9 +844,10 @@
       0, 0, 0 };
 
     int32_t DATA_INT [] [5] = {
-        {98, UCAL_SEPTEMBER, 30, 22, 0},
-        {100, UCAL_FEBRUARY, 28, 22, 0},
-        {100, UCAL_FEBRUARY, 29, 22, 0},
+        // These years must be AFTER the Gregorian cutover
+        {1998, UCAL_SEPTEMBER, 30, 22, 0},
+        {2000, UCAL_FEBRUARY, 28, 22, 0},
+        {2000, UCAL_FEBRUARY, 29, 22, 0},
      };
 
     UBool DATA_BOOL [] = {
@@ -933,7 +944,7 @@
     // specify two zones in the same equivalency group.  One must have
     // locale data in 'loc'; the other must not.
     const char* idWithLocaleData = "America/Los_Angeles";
-    const char* idWithoutLocaleData = "America/Vancouver";
+    const char* idWithoutLocaleData = "US/Pacific";
     const Locale loc("en", "", "");
 
     TimeZone *zoneWith = TimeZone::createTimeZone(idWithLocaleData);
@@ -941,7 +952,7 @@
     // Make sure we got valid zones
     if (zoneWith->getID(str) != UnicodeString(idWithLocaleData) ||
         zoneWithout->getID(str) != UnicodeString(idWithoutLocaleData)) {
-        errln("Fail: Unable to create zones");
+      errln(UnicodeString("Fail: Unable to create zones - wanted ") + idWithLocaleData + ", got " + zoneWith->getID(str) + ", and wanted " + idWithoutLocaleData + " but got " + zoneWithout->getID(str));
     } else {
         GregorianCalendar calWith(*zoneWith, status);
         GregorianCalendar calWithout(*zoneWithout, status);
@@ -975,8 +986,29 @@
 void
 TimeZoneRegressionTest::TestJDK12API()
 {
-    TimeZone *pst = TimeZone::createTimeZone("PST");
-    TimeZone *cst1 = TimeZone::createTimeZone("CST");
+    // TimeZone *pst = TimeZone::createTimeZone("PST");
+    // TimeZone *cst1 = TimeZone::createTimeZone("CST");
+    UErrorCode ec = U_ZERO_ERROR;
+    //d,-28800,3,1,-1,120,w,9,-1,1,120,w,60
+    TimeZone *pst = new SimpleTimeZone(-28800*U_MILLIS_PER_SECOND,
+                                       "PST",
+                                       3,1,-1,120*U_MILLIS_PER_MINUTE,
+                                       SimpleTimeZone::WALL_TIME,
+                                       9,-1,1,120*U_MILLIS_PER_MINUTE,
+                                       SimpleTimeZone::WALL_TIME,
+                                       60*U_MILLIS_PER_MINUTE,ec);
+    //d,-21600,3,1,-1,120,w,9,-1,1,120,w,60
+    TimeZone *cst1 = new SimpleTimeZone(-21600*U_MILLIS_PER_SECOND,
+                                       "CST",
+                                       3,1,-1,120*U_MILLIS_PER_MINUTE,
+                                       SimpleTimeZone::WALL_TIME,
+                                       9,-1,1,120*U_MILLIS_PER_MINUTE,
+                                       SimpleTimeZone::WALL_TIME,
+                                       60*U_MILLIS_PER_MINUTE,ec);
+    if (U_FAILURE(ec)) {
+        errln("FAIL: SimpleTimeZone constructor");
+        return;
+    }
 
     SimpleTimeZone *cst = 0;
 

Index: tztest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tztest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- tztest.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ tztest.cpp	6 Apr 2004 10:09:46 -0000	1.5
@@ -43,8 +43,10 @@
         CASE(7, TestDisplayName);
         CASE(8, TestDSTSavings);
         CASE(9, TestAlternateRules);
-        CASE(10,TestCountries);
-        default: name = ""; break;
+        CASE(10,TestCountries); 
+        CASE(11,TestHistorical);
+        CASE(12,TestEquivalentIDs);
+       default: name = ""; break;
     }
 }
 
@@ -81,14 +83,15 @@
     if (!(copy == *zoneclone)) errln("FAIL: assignment operator or operator== failed");
 
     TimeZone* saveDefault = TimeZone::createDefault();
-    TimeZone* pstZone = TimeZone::createTimeZone("PST");
+    logln((UnicodeString)"TimeZone::createDefault() => " + saveDefault->getID(id));
+    //TimeZone* pstZone = TimeZone::createTimeZone("PST");
 
-    logln("call u_t_timezone() which uses the host");
+    logln("call uprv_timezone() which uses the host");
     logln("to get the difference in seconds between coordinated universal");
     logln("time and local time. E.g., -28,800 for PST (GMT-8hrs)");
 
     int32_t tzoffset = uprv_timezone();
-    logln(UnicodeString("Value returned from t_timezone = ") + tzoffset);
+    logln(UnicodeString("Value returned from uprv_timezone = ") + tzoffset);
     // Invert sign because UNIX semantics are backwards
     if (tzoffset < 0)
         tzoffset = -tzoffset;
@@ -99,7 +102,7 @@
     //}
 
     if (tzoffset != 28800) {
-        logln("***** WARNING: If testing in the PST timezone, t_timezone should return 28800! *****");
+        logln("***** WARNING: If testing in the PST timezone, uprv_timezone should return 28800! *****");
     }
     if ((tzoffset % 1800 != 0)) {
       errln("FAIL: t_timezone may be incorrect. It is not a multiple of 30min. It is %d", tzoffset);
@@ -113,7 +116,7 @@
     TimeZone::adoptDefault(saveDefault);
     delete defaultzone;
     delete zoneclone;
-    delete pstZone;
+    //delete pstZone;
 }
 
 // ---------------------------------------------------------------------------------
@@ -174,8 +177,8 @@
           " = " + dateToString(expJulyOne));
     }
 
-    testUsingBinarySearch(zone, date(90, UCAL_JANUARY, 1), date(90, UCAL_JUNE, 15), marchOne);
-    testUsingBinarySearch(zone, date(90, UCAL_JUNE, 1), date(90, UCAL_DECEMBER, 31), julyOne);
+    testUsingBinarySearch(*zone, date(90, UCAL_JANUARY, 1), date(90, UCAL_JUNE, 15), marchOne);
+    testUsingBinarySearch(*zone, date(90, UCAL_JUNE, 1), date(90, UCAL_DECEMBER, 31), julyOne);
 
     if (zone->inDaylightTime(marchOne - 1000, status) ||
         !zone->inDaylightTime(marchOne, status))
@@ -195,25 +198,56 @@
 }
 
 void
-TimeZoneTest::testUsingBinarySearch(SimpleTimeZone* tz, UDate min, UDate max, UDate expectedBoundary)
+TimeZoneTest::findTransition(const TimeZone& tz,
+                             UDate min, UDate max) {
+    UErrorCode ec = U_ZERO_ERROR;
+    UnicodeString id,s;
+    UBool startsInDST = tz.inDaylightTime(min, ec);
+    if (failure(ec, "TimeZone::inDaylightTime")) return;
+    if (tz.inDaylightTime(max, ec) == startsInDST) {
+        logln("Error: " + tz.getID(id) + ".inDaylightTime(" + dateToString(min) + ") = " + (startsInDST?"TRUE":"FALSE") +
+              ", inDaylightTime(" + dateToString(max) + ") = " + (startsInDST?"TRUE":"FALSE"));
+        return;
+    }
+    if (failure(ec, "TimeZone::inDaylightTime")) return;
+    while ((max - min) > INTERVAL) {
+        UDate mid = (min + max) / 2;
+        if (tz.inDaylightTime(mid, ec) == startsInDST) {
+            min = mid;
+        } else {
+            max = mid;
+        }
+        if (failure(ec, "TimeZone::inDaylightTime")) return;
+    }
+    min = 1000.0 * uprv_floor(min/1000.0);
+    max = 1000.0 * uprv_floor(max/1000.0);
+    logln(tz.getID(id) + " Before: " + min/1000 + " = " +
+          dateToString(min,s,tz));
+    logln(tz.getID(id) + " After:  " + max/1000 + " = " +
+          dateToString(max,s,tz));
+}
+
+void
+TimeZoneTest::testUsingBinarySearch(const TimeZone& tz,
+                                    UDate min, UDate max,
+                                    UDate expectedBoundary)
 {
     UErrorCode status = U_ZERO_ERROR;
-    UBool startsInDST = tz->inDaylightTime(min, status);
-    if (failure(status, "SimpleTimeZone::inDaylightTime")) return;
-    if (tz->inDaylightTime(max, status) == startsInDST) {
+    UBool startsInDST = tz.inDaylightTime(min, status);
+    if (failure(status, "TimeZone::inDaylightTime")) return;
+    if (tz.inDaylightTime(max, status) == startsInDST) {
         logln("Error: inDaylightTime(" + dateToString(max) + ") != " + ((!startsInDST)?"TRUE":"FALSE"));
         return;
     }
-    if (failure(status, "SimpleTimeZone::inDaylightTime")) return;
+    if (failure(status, "TimeZone::inDaylightTime")) return;
     while ((max - min) > INTERVAL) {
         UDate mid = (min + max) / 2;
-        if (tz->inDaylightTime(mid, status) == startsInDST) {
+        if (tz.inDaylightTime(mid, status) == startsInDST) {
             min = mid;
-        }
-        else {
+        } else {
             max = mid;
         }
-        if (failure(status, "SimpleTimeZone::inDaylightTime")) return;
+        if (failure(status, "TimeZone::inDaylightTime")) return;
     }
     logln(UnicodeString("Binary Search Before: ") + uprv_floor(0.5 + min) + " = " + dateToString(min));
     logln(UnicodeString("Binary Search After:  ") + uprv_floor(0.5 + max) + " = " + dateToString(max));
@@ -245,7 +279,15 @@
         errln("FAIL: TimeZone(PRT) is null");
     }
     else {
-        if (tz->getRawOffset() != (- 4 * millisPerHour)) errln("FAIL: Offset for PRT should be -4");
+      int32_t expectedHour = -4;
+      double expectedOffset = (((double)expectedHour) * millisPerHour);
+      double foundOffset = tz->getRawOffset();
+      int32_t foundHour = (int32_t)foundOffset / millisPerHour;
+      if (expectedOffset != foundOffset) {
+        errln("FAIL: Offset for PRT should be %d, found %d", expectedHour, foundHour);
+      } else {
+        logln("PASS: Offset for PRT should be %d, found %d", expectedHour, foundHour);
+      }
     }
     delete tz;
 }
@@ -288,15 +330,81 @@
 TimeZoneTest::TestGetAvailableIDs913()
 {
     UErrorCode ec = U_ZERO_ERROR;
+    int32_t i;
+
+#ifdef U_USE_TIMEZONE_OBSOLETE_2_8
+    // Test legacy API -- remove these tests when the corresponding API goes away (duh)
+    int32_t numIDs = -1;
+    const UnicodeString** ids = TimeZone::createAvailableIDs(numIDs);
+    if (ids == 0 || numIDs < 1) {
+        errln("FAIL: createAvailableIDs()");
+    } else {
+        UnicodeString buf("TimeZone::createAvailableIDs() = { ");
+        for(i=0; i<numIDs; ++i) {
+            if (i) buf.append(", ");
+            buf.append(*ids[i]);
+        }
+        buf.append(" } ");
+        logln(buf + numIDs);
+        // we own the array; the caller owns the contained strings (yuck)
+        uprv_free(ids);
+    }
+
+    numIDs = -1;
+    ids = TimeZone::createAvailableIDs(-8*U_MILLIS_PER_HOUR, numIDs);
+    if (ids == 0 || numIDs < 1) {
+        errln("FAIL: createAvailableIDs(-8:00)");
+    } else {
+        UnicodeString buf("TimeZone::createAvailableIDs(-8:00) = { ");
+        for(i=0; i<numIDs; ++i) {
+            if (i) buf.append(", ");
+            buf.append(*ids[i]);
+        }
+        buf.append(" } ");
+        logln(buf + numIDs);
+        // we own the array; the caller owns the contained strings (yuck)
+        uprv_free(ids);
+    }
+    numIDs = -1;
+    ids = TimeZone::createAvailableIDs("US", numIDs);
+    if (ids == 0 || numIDs < 1) {
+      errln("FAIL: createAvailableIDs(US) ids=%d, numIDs=%d", ids, numIDs);
+    } else {
+        UnicodeString buf("TimeZone::createAvailableIDs(US) = { ");
+        for(i=0; i<numIDs; ++i) {
+            if (i) buf.append(", ");
+            buf.append(*ids[i]);
+        }
+        buf.append(" } ");
+        logln(buf + numIDs);
+        // we own the array; the caller owns the contained strings (yuck)
+        uprv_free(ids);
+    }
+#endif
+
     UnicodeString str;
     UnicodeString *buf = new UnicodeString("TimeZone::createEnumeration() = { ");
     int32_t s_length;
     StringEnumeration* s = TimeZone::createEnumeration();
     s_length = s->count(ec);
-    int32_t i;
     for (i = 0; i < s_length;++i) {
         if (i > 0) *buf += ", ";
-        *buf += *s->snext(ec);
+        if ((i & 1) == 0) {
+            *buf += *s->snext(ec);
+        } else {
+            *buf += UnicodeString(s->next(NULL, ec), "");
+        }
+
+        if((i % 5) == 4) {
+            // replace s with a clone of itself
+            StringEnumeration *s2 = s->clone();
+            if(s2 == NULL || s_length != s2->count(ec)) {
+                errln("TimezoneEnumeration.clone() failed");
+            } else {
+                delete s;
+                s = s2;
+            }
+        }
     }
     *buf += " };";
     logln(*buf);
@@ -327,16 +435,31 @@
     delete s;
 
     buf->truncate(0);
-    *buf += "TimeZone::createEnumeration(GMT+02:00) = { ";
+    *buf += "TimeZone::createEnumeration(GMT+01:00) = { ";
 
-    s = TimeZone::createEnumeration(+ 2 * 60 * 60 * 1000);
+    s = TimeZone::createEnumeration(1 * U_MILLIS_PER_HOUR);
     s_length = s->count(ec);
     for (i = 0; i < s_length;++i) {
         if (i > 0) *buf += ", ";
         *buf += *s->snext(ec);
     }
+    delete s;
     *buf += " };";
     logln(*buf);
+
+
+    buf->truncate(0);
+    *buf += "TimeZone::createEnumeration(US) = { ";
+
+    s = TimeZone::createEnumeration("US");
+    s_length = s->count(ec);
+    for (i = 0; i < s_length;++i) {
+        if (i > 0) *buf += ", ";
+        *buf += *s->snext(ec);
+    }
+    *buf += " };";
+    logln(*buf);
+
     TimeZone *tz = TimeZone::createTimeZone("PST");
     if (tz != 0) logln("getTimeZone(PST) = " + tz->getID(str));
     else errln("FAIL: getTimeZone(PST) = null");
@@ -361,6 +484,10 @@
 
 
 /**
+ * NOTE: As of ICU 2.8, this test confirms that the "tz.alias"
+ * file, used to build ICU alias zones, is working.  It also
+ * looks at some genuine Olson compatibility IDs. [aliu]
+ *
  * This test is problematic. It should really just confirm that
  * the list of compatibility zone IDs exist and are somewhat
  * meaningful (that is, they aren't all aliases of GMT). It goes a
@@ -449,10 +576,10 @@
         {"AST", -540, TRUE},
         {"PST", -480, TRUE},
         {"PNT", -420, FALSE},
-        {"MST", -420, TRUE},
+        {"MST", -420, FALSE}, // updated Aug 2003 aliu
         {"CST", -360, TRUE},
         {"IET", -300, FALSE},
-        {"EST", -300, TRUE},
+        {"EST", -300, FALSE}, // updated Aug 2003 aliu
         {"PRT", -240, FALSE},
         {"CNT", -210, TRUE},
         {"AGT", -180, FALSE}, // updated 26 Sep 2000 aliu
@@ -468,13 +595,13 @@
         {"EAT", 180, FALSE},
         {"MET", 60, TRUE}, // updated 12/3/99 aliu
         {"NET", 240, TRUE}, // updated 12/3/99 aliu
-        {"PLT", 300, TRUE}, // updated 12/3/02 aliu; Pakistan using DST as of 2002
+        {"PLT", 300, FALSE}, // updated Aug 2003 aliu
         {"IST", 330, FALSE},
         {"BST", 360, FALSE},
         {"VST", 420, FALSE},
-        {"CTT", 480, TRUE}, // updated 12/3/99 aliu
+        {"CTT", 480, FALSE}, // updated Aug 2003 aliu
         {"JST", 540, FALSE},
-        {"ACT", 570, TRUE}, // updated 12/3/99 aliu
+        {"ACT", 570, FALSE}, // updated Aug 2003 aliu
         {"AET", 600, TRUE},
         {"SST", 660, FALSE},
         // "NST", 720, FALSE,
@@ -526,7 +653,7 @@
 
     const char* compatibilityMap[] = {
         // This list is copied from tz.alias.  If tz.alias
-        // changes, this list must be updated.  Current as of 1/31/01
+        // changes, this list must be updated.  Current as of Aug 2003
         "ACT", "Australia/Darwin",
         "AET", "Australia/Sydney",
         "AGT", "America/Buenos_Aires",
@@ -541,14 +668,14 @@
         "EAT", "Africa/Addis_Ababa",
         "ECT", "Europe/Paris",
         // EET Europe/Istanbul # EET is a standard UNIX zone
-        "EST", "America/New_York",
+        // "EST", "America/New_York", # EST is an Olson alias now (2003)
         "HST", "Pacific/Honolulu",
         "IET", "America/Indianapolis",
         "IST", "Asia/Calcutta",
         "JST", "Asia/Tokyo",
         // MET Asia/Tehran # MET is a standard UNIX zone
         "MIT", "Pacific/Apia",
-        "MST", "America/Denver",
+        // "MST", "America/Denver", # MST is an Olson alias now (2003)
         "NET", "Asia/Yerevan",
         "NST", "Pacific/Auckland",
         "PLT", "Asia/Karachi",
@@ -649,8 +776,8 @@
         // ID        Expected offset in minutes
         //"GMT",       kUnparseable,   Isn't custom. Can't test it here. [returns normal GMT]
         {"GMT-YOUR.AD.HERE", kUnparseable},
-        {"GMT0",      kUnparseable},
-        {"GMT+0",     (0)},
+        // {"GMT0",      kUnparseable}, // ICU 2.8: An Olson zone ID
+        // {"GMT+0",     (0)}, // ICU 2.8: An Olson zone ID
         {"GMT+1",     (60)},
         {"GMT-0030",  (-30)},
         {"GMT+15:99", (15*60+99)},
@@ -795,7 +922,12 @@
     zone2->setStartRule(UCAL_JANUARY, 1, 0, 0, status);
     zone2->setEndRule(UCAL_DECEMBER, 31, 0, 0, status);
 
-    UnicodeString inDaylight = (zone2->inDaylightTime(UDate(0), status)? UnicodeString("TRUE"):UnicodeString("FALSE"));
+    UnicodeString inDaylight;
+    if (zone2->inDaylightTime(UDate(0), status)) {
+        inDaylight = UnicodeString("TRUE");
+    } else {
+        inDaylight = UnicodeString("FALSE");
+    }
     logln(UnicodeString("Modified PST inDaylightTime->") + inDaylight );
     if(U_FAILURE(status))
     {
@@ -1080,6 +1212,80 @@
 	delete s1;
 	delete s2;
     delete s;
+}
+
+void TimeZoneTest::TestHistorical() {
+    const int32_t H = U_MILLIS_PER_HOUR;
+    struct {
+        const char* id;
+        int32_t time; // epoch seconds
+        int32_t offset; // total offset (millis)
+    } DATA[] = {
+        // Add transition points (before/after) as desired to test historical
+        // behavior.
+        {"America/Los_Angeles", 638963999, -8*H}, // Sun Apr 01 01:59:59 GMT-08:00 1990
+        {"America/Los_Angeles", 638964000, -7*H}, // Sun Apr 01 03:00:00 GMT-07:00 1990
+        {"America/Los_Angeles", 657104399, -7*H}, // Sun Oct 28 01:59:59 GMT-07:00 1990
+        {"America/Los_Angeles", 657104400, -8*H}, // Sun Oct 28 01:00:00 GMT-08:00 1990
+        {"America/Goose_Bay", -116445601, -4*H}, // Sun Apr 24 01:59:59 GMT-04:00 1966
+        {"America/Goose_Bay", -116445600, -3*H}, // Sun Apr 24 03:00:00 GMT-03:00 1966
+        {"America/Goose_Bay", -100119601, -3*H}, // Sun Oct 30 01:59:59 GMT-03:00 1966
+        {"America/Goose_Bay", -100119600, -4*H}, // Sun Oct 30 01:00:00 GMT-04:00 1966
+        {"America/Goose_Bay", -84391201, -4*H}, // Sun Apr 30 01:59:59 GMT-04:00 1967
+        {"America/Goose_Bay", -84391200, -3*H}, // Sun Apr 30 03:00:00 GMT-03:00 1967
+        {"America/Goose_Bay", -68670001, -3*H}, // Sun Oct 29 01:59:59 GMT-03:00 1967
+        {"America/Goose_Bay", -68670000, -4*H}, // Sun Oct 29 01:00:00 GMT-04:00 1967
+        {0, 0, 0}
+    };
+    
+    for (int32_t i=0; DATA[i].id!=0; ++i) {
+        const char* id = DATA[i].id;
+        TimeZone *tz = TimeZone::createTimeZone(id);
+        UnicodeString s;
+        if (tz == 0) {
+            errln("FAIL: Cannot create %s", id);
+        } else if (tz->getID(s) != UnicodeString(id)) {
+            errln((UnicodeString)"FAIL: createTimeZone(" + id + ") => " + s);
+        } else {
+            UErrorCode ec = U_ZERO_ERROR;
+            int32_t raw, dst;
+            UDate when = (double) DATA[i].time * U_MILLIS_PER_SECOND;
+            tz->getOffset(when, FALSE, raw, dst, ec);
+            if (U_FAILURE(ec)) {
+                errln("FAIL: getOffset");
+            } else if ((raw+dst) != DATA[i].offset) {
+                errln((UnicodeString)"FAIL: " + DATA[i].id + ".getOffset(" +
+                      //when + " = " +
+                      dateToString(when) + ") => " +
+                      raw + ", " + dst);
+            } else {
+                logln((UnicodeString)"Ok: " + DATA[i].id + ".getOffset(" +
+                      //when + " = " +
+                      dateToString(when) + ") => " +
+                      raw + ", " + dst);
+            }
+        }
+        delete tz;
+    }
+}
+
+void TimeZoneTest::TestEquivalentIDs() {
+    int32_t n = TimeZone::countEquivalentIDs("PST");
+    if (n < 2) {
+        errln((UnicodeString)"FAIL: countEquivalentIDs(PST) = " + n);
+    } else {
+        UBool sawLA = FALSE;
+        for (int32_t i=0; i<n; ++i) {
+            UnicodeString id = TimeZone::getEquivalentID("PST", i);
+            logln((UnicodeString)"" + i + " : " + id);
+            if (id == UnicodeString("America/Los_Angeles")) {
+                sawLA = TRUE;
+            }
+        }
+        if (!sawLA) {
+            errln("FAIL: America/Los_Angeles should be in the list");
+        }
+    }
 }
 
 #endif /* #if !UCONFIG_NO_FORMATTING */

Index: tztest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/tztest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tztest.h	10 Sep 2003 02:42:49 -0000	1.3
+++ tztest.h	6 Apr 2004 10:09:46 -0000	1.4
@@ -1,7 +1,7 @@
 
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
  
@@ -46,11 +46,16 @@
      * Test the setStartRule/setEndRule API calls.
      */
     virtual void TestRuleAPI(void);
+ 
+    void findTransition(const TimeZone& tz,
+                        UDate min, UDate max);
 
-    /**
+   /**
      * subtest used by TestRuleAPI
      **/
-    void testUsingBinarySearch(SimpleTimeZone* tz, UDate min, UDate max, UDate expectedBoundary);
+    void testUsingBinarySearch(const TimeZone& tz,
+                               UDate min, UDate max,
+                               UDate expectedBoundary);
 
 
     /**
@@ -73,6 +78,10 @@
     void TestAlternateRules(void);
 
     void TestCountries(void);
+
+    void TestHistorical(void);
+
+    void TestEquivalentIDs(void);
 
     static const UDate INTERVAL;
 

Index: ucaconf.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/ucaconf.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ucaconf.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ ucaconf.cpp	6 Apr 2004 10:09:46 -0000	1.2
@@ -15,6 +15,10 @@
 #if !UCONFIG_NO_COLLATION
 
 #include "ucaconf.h"
+#include "unicode/ustring.h"
+#include "cstring.h"
+#include "uparse.h"
+
 UCAConformanceTest::UCAConformanceTest() :
 rbUCA(NULL),
 testFile(NULL),

Index: ucaconf.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/ucaconf.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ucaconf.h	10 Sep 2003 02:42:49 -0000	1.1
+++ ucaconf.h	6 Apr 2004 10:09:46 -0000	1.2
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 2002, International Business Machines Corporation and
+ * Copyright (c) 2002-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -18,10 +18,7 @@
 #if !UCONFIG_NO_COLLATION
 
 #include "unicode/tblcoll.h"
-#include "unicode/ustring.h"
 #include "tscoll.h"
-#include "uparse.h"
-#include "cstring.h"
 
 #include <stdio.h>
 

Index: ufltlgts.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/ufltlgts.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ufltlgts.cpp	10 Sep 2003 02:42:49 -0000	1.3
+++ ufltlgts.cpp	6 Apr 2004 10:09:46 -0000	1.4
@@ -1,6 +1,6 @@
 /***************************************************************************
 *
-*   Copyright (C) 2000-2002, International Business Machines
+*   Copyright (C) 2000-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ***************************************************************************************************************************************************
@@ -10,7 +10,7 @@
 
 #include "unicode/utypes.h"
 
-#if !UCONFIG_NO_TRANSLITERATION
+#if !UCONFIG_NO_TRANSLITERATION && defined(U_USE_UNICODE_FILTER_LOGIC_OBSOLETE_2_8)
 
 #include "unicode/translit.h"
 #include "unicode/unifilt.h"

Index: uobjtest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/uobjtest.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- uobjtest.cpp	10 Sep 2003 02:42:49 -0000	1.1
+++ uobjtest.cpp	6 Apr 2004 10:09:46 -0000	1.2
@@ -5,7 +5,9 @@
  ********************************************************************/
 
 #include "uobjtest.h"
+#include "cmemory.h" // UAlignedMemory
 #include <string.h>
+#include <stdio.h>
 
 /**
  * 
@@ -31,7 +33,7 @@
 #define TESTCLASSID_TRANSLIT(c, t) { delete testClass(Transliterator::createInstance(UnicodeString(t), UTRANS_FORWARD,parseError,status), #c, "Transliterator: " #t, c ::getStaticClassID()); if(U_FAILURE(status)) { errln(UnicodeString(#c " - Transliterator: " #t " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
 #define TESTCLASSID_CTOR(c, x) { delete testClass(new c x, #c, "new " #c #x, c ::getStaticClassID()); if(U_FAILURE(status)) { errln(UnicodeString(#c " - new " #x " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
 #define TESTCLASSID_DEFAULT(c) delete testClass(new c, #c, "new " #c , c::getStaticClassID())
-#define TESTCLASSID_ABSTRACT(c) testClass(NULL, #c, NULL, c::getStaticClassID())
+//#define TESTCLASSID_ABSTRACT(c) testClass(NULL, #c, NULL, c::getStaticClassID())
 
 #define MAX_CLASS_ID 200
 
@@ -150,6 +152,7 @@
 #include "unesctrn.h"
 #include "uni2name.h"
 #include "uvector.h"
+#include "islamcal.h"
 
 // External Things
 #include "unicode/brkiter.h"
@@ -226,7 +229,7 @@
 #if !UCONFIG_NO_FORMATTING
     /* TESTCLASSID_FACTORY(NFSubstitution,  NFSubstitution::makeSubstitution(8, */
     /* TESTCLASSID_DEFAULT(DigitList);  UMemory but not UObject*/
-    TESTCLASSID_ABSTRACT(NumberFormat);
+    //TESTCLASSID_ABSTRACT(NumberFormat);
     TESTCLASSID_CTOR(DateFormatSymbols, (status));
     TESTCLASSID_CTOR(DecimalFormatSymbols, (status));
 #if UOBJTEST_TEST_INTERNALS
@@ -235,6 +238,7 @@
     TESTCLASSID_DEFAULT(FieldPosition);
     TESTCLASSID_DEFAULT(Formattable);
     TESTCLASSID_CTOR(GregorianCalendar, (status));
+    TESTCLASSID_CTOR(IslamicCalendar, (Locale::getUS(), status));
 #endif
 
 #if !UCONFIG_NO_BREAK_ITERATION
@@ -295,13 +299,13 @@
     //TESTCLASSID_DEFAULT(TempSearch);
     //TESTCLASSID_DEFAULT(TestMultipleKeyStringFactory);
     //TESTCLASSID_DEFAULT(TestReplaceable);
-#if !UCONFIG_NO_FORMATTING
-    TESTCLASSID_ABSTRACT(TimeZone);
-#endif
+//#if !UCONFIG_NO_FORMATTING
+    //TESTCLASSID_ABSTRACT(TimeZone);
+//#endif
 
 #if !UCONFIG_NO_TRANSLITERATION
     TESTCLASSID_FACTORY(TitlecaseTransliterator,  Transliterator::createInstance(UnicodeString("Any-Title"), UTRANS_FORWARD, parseError, status));
-    TESTCLASSID_ABSTRACT(Transliterator);
+    //TESTCLASSID_ABSTRACT(Transliterator);
 
 #if UOBJTEST_TEST_INTERNALS
     TESTCLASSID_CTOR(StringMatcher, (UnicodeString("x"), 0,0,0,TransliterationRuleData(status)));
@@ -311,8 +315,8 @@
     
     TESTCLASSID_DEFAULT(UnicodeString);
     TESTCLASSID_CTOR(UnicodeSet, (0, 1));
-    TESTCLASSID_ABSTRACT(UnicodeFilter);
-    TESTCLASSID_ABSTRACT(UnicodeFunctor);
+    //TESTCLASSID_ABSTRACT(UnicodeFilter);
+    //TESTCLASSID_ABSTRACT(UnicodeFunctor);
     TESTCLASSID_CTOR(UnicodeSetIterator,(UnicodeSet(0,1)));
     TESTCLASSID_CTOR(UStack, (status));
     TESTCLASSID_CTOR(UVector, (status));
@@ -340,6 +344,59 @@
 #endif
 }
 
+void UObjectTest::testUMemory() {
+    // additional tests for code coverage
+#if U_OVERRIDE_CXX_ALLOCATION && U_HAVE_PLACEMENT_NEW
+    UAlignedMemory stackMemory[sizeof(UnicodeString)/sizeof(UAlignedMemory)+1];
+    UnicodeString *p;
+    enum { len=20 };
+
+    p=new(stackMemory) UnicodeString(len, (UChar32)0x20ac, len);
+    if((void *)p!=(void *)stackMemory) {
+        errln("placement new did not place the object at the expected address");
+    }
+    if(p->length()!=len || p->charAt(0)!=0x20ac || p->charAt(len-1)!=0x20ac) {
+        errln("constructor used with placement new did not work right");
+    }
+
+    /*
+     * It is not possible to simply say
+     *     delete(p, stackMemory);
+     * which results in a call to the normal, non-placement delete operator.
+     *
+     * Via a search on google.com for "c++ placement delete" I found
+     * http://cpptips.hyperformix.com/cpptips/placement_del3
+     * which says:
+     *
+     * TITLE: using placement delete
+     *
+     * (Newsgroups: comp.std.c++, 27 Aug 97)
+     *
+     * ISJ: isj@image.dk
+     *
+     * > I do not completely understand how placement works on operator delete.
+     * > ...
+     * There is no delete-expression which will invoke a placement
+     * form of operator delete. You can still call the function
+     * explicitly. Example:
+     * ...
+     *     // destroy object and delete space manually
+     *     p->~T();
+     *     operator delete(p, 12);
+     *
+     * ... so that's what I am doing here.
+     * markus 20031216
+     */
+    // destroy object and delete space manually
+    p->~UnicodeString(); 
+    UnicodeString::operator delete(p, stackMemory); 
+#endif
+
+    // try to call the compiler-generated UMemory::operator=(class UMemory const &)
+    UMemory m, n;
+    m=n;
+}
+
 /* --------------- */
 
 #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break;
@@ -350,6 +407,7 @@
     switch (index) {
 
     CASE(0, testIDs);
+    CASE(1, testUMemory);
 
     default: name = ""; break; //needed to end loop
     }

Index: uobjtest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/uobjtest.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- uobjtest.h	10 Sep 2003 02:42:49 -0000	1.1
+++ uobjtest.h	6 Apr 2004 10:09:46 -0000	1.2
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 2002, International Business Machines Corporation and
+ * Copyright (c) 2002-2003, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -19,6 +19,7 @@
  private:
     // tests
     void testIDs();
+    void testUMemory();
     
     //helper
     

Index: usettest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/usettest.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- usettest.cpp	10 Sep 2003 02:42:49 -0000	1.5
+++ usettest.cpp	6 Apr 2004 10:09:46 -0000	1.6
@@ -15,6 +15,9 @@
 #include "unicode/uchar.h"
 #include "unicode/usetiter.h"
 #include "unicode/ustring.h"
+#include "unicode/parsepos.h"
+#include "unicode/symtable.h"
+#include "hash.h"
 
 UnicodeString operator+(const UnicodeString& left, const UnicodeSet& set) {
     UnicodeString pat;
@@ -54,6 +57,8 @@
         CASE(15,TestCloseOver);
         CASE(16,TestEscapePattern);
         CASE(17,TestInvalidCodePoint);
+        CASE(18,TestSymbolTable);
+        CASE(19,TestSurrogate);
         default: name = ""; break;
     }
 }
@@ -482,7 +487,8 @@
 
     logln((UnicodeString)"a [3-10]: " + a);
     logln((UnicodeString)"b [7-15]: " + b);
-    c = a; c.addAll(b);
+    c = a;
+    c.addAll(b);
     UnicodeSet exp((UChar32)3,(UChar32)15);
     if (c == exp) {
         logln((UnicodeString)"c.set(a).add(b): " + c);
@@ -504,7 +510,8 @@
     } else {
         errln((UnicodeString)"FAIL: c.complement() = " + c + ", expect " + exp);
     }
-    c = a; c.complementAll(b);
+    c = a;
+    c.complementAll(b);
     exp.set((UChar32)3,(UChar32)6);
     exp.add((UChar32)11,(UChar32) 15);
     if (c == exp) {
@@ -661,7 +668,7 @@
         s->applyPattern("[a-z {\\{l} {r\\}}]", ec);
         if (U_FAILURE(ec)) break;
         const char* exp3[] = {"{l", "r}", NOT, "xy", NULL};
-        expectToPattern(*s, "[a-z{\\{l}{r\\}}]", exp3);
+        expectToPattern(*s, "[a-z{r\\}}{\\{l}]", exp3);
 
         s->add("[]");
         const char* exp4[] = {"{l", "r}", "[]", NOT, "xy", NULL};
@@ -670,7 +677,7 @@
         s->applyPattern("[a-z {\\u4E01\\u4E02}{\\n\\r}]", ec);
         if (U_FAILURE(ec)) break;
         const char* exp5[] = {"\\u4E01\\u4E02", "\n\r", NULL};
-        expectToPattern(*s, "[a-z{\\u4E01\\u4E02}{\\n\\r}]", exp5);
+        expectToPattern(*s, "[a-z{\\u000A\\u000D}{\\u4E01\\u4E02}]", exp5);
 
         // j2189
         s->clear();
@@ -810,7 +817,35 @@
 
         "[^b-]", // trailing '-' is literal
         "ac",
-        "-b"
+        "-b",
+
+        "[a-b-]", // trailing '-' is literal
+        "ab-",
+        "c=",
+        
+        "[[a-q]&[p-z]-]", // trailing '-' is literal
+        "pq-",
+        "or=",
+
+        "[\\s|\\)|:|$|\\>]", // from regex tests
+        "s|):$>",
+        "abc",
+
+        "[\\uDC00cd]", // JB#2906: isolated trail at start
+        "cd\\uDC00",
+        "ab\\uD800\\U00010000",
+        
+        "[ab\\uD800]", // JB#2906: isolated trail at start
+        "ab\\uD800",
+        "cd\\uDC00\\U00010000",
+        
+        "[ab\\uD800cd]", // JB#2906: isolated lead in middle
+        "abcd\\uD800",
+        "ef\\uDC00\\U00010000",
+        
+        "[ab\\uDC00cd]", // JB#2906: isolated trail in middle
+        "abcd\\uDC00",
+        "ef\\uD800\\U00010000"
     };
 
     static const int32_t DATA_LEN = sizeof(DATA)/sizeof(DATA[0]);
@@ -920,13 +955,13 @@
     }
 
     // Test the pattern API
-    s.applyPattern("[abc]", USET_CASE_INSENSITIVE, ec);
+    s.applyPattern("[abc]", USET_CASE_INSENSITIVE, NULL, ec);
     if (U_FAILURE(ec)) {
         errln("FAIL: applyPattern failed");
     } else {
         expectContainment(s, "abcABC", "defDEF");
     }
-    UnicodeSet v("[^abc]", USET_CASE_INSENSITIVE, ec);
+    UnicodeSet v("[^abc]", USET_CASE_INSENSITIVE, NULL, ec);
     if (U_FAILURE(ec)) {
         errln("FAIL: constructor failed");
     } else {
@@ -936,13 +971,12 @@
 
 void UnicodeSetTest::TestEscapePattern() {
     const char pattern[] =
-        "[\\uFEFF \\uFFF9-\\uFFFC \\U0001D173-\\U0001D17A \\U000F0000-\\U000FFFFD ]";
+        "[\\uFEFF \\u200A-\\u200E \\U0001D173-\\U0001D17A \\U000F0000-\\U000FFFFD ]";
     const char exp[] =
-        "[\\uFEFF\\uFFF9-\\uFFFC\\U0001D173-\\U0001D17A\\U000F0000-\\U000FFFFD]";
+        "[\\u200A-\\u200E\\uFEFF\\U0001D173-\\U0001D17A\\U000F0000-\\U000FFFFD]";
     // We test this with two passes; in the second pass we
-    // pre-unescape the pattern.  Since U+FEFF and several other code
-    // points are rule whitespace, this fails -- which is what we
-    // expect.
+    // pre-unescape the pattern.  Since U+200E is rule whitespace,
+    // this fails -- which is what we expect.
     for (int32_t pass=1; pass<=2; ++pass) {
         UErrorCode ec = U_ZERO_ERROR;
         UnicodeString pat(pattern);
@@ -1042,7 +1076,7 @@
         b = set.containsNone(start, end);
         b = set.containsSome(start, end);
 
-        int32_t index = set.indexOf(start);
+        /*int32_t index = set.indexOf(start);*/
         
         set.clear();
         set.add(start);
@@ -1116,6 +1150,156 @@
         } else {
             errln((UnicodeString)"FAIL: [\\u0000-\\U0010FFFF].indexOf(" + c +
                   ") = " + index);
+        }
+    }
+}
+
+// Used by TestSymbolTable
+class TokenSymbolTable : public SymbolTable {
+public:
+    Hashtable contents;
+
+    TokenSymbolTable(UErrorCode& ec) : contents(FALSE, ec) {
+        contents.setValueDeleter(uhash_deleteUnicodeString);
+    }
+
+    ~TokenSymbolTable() {}
+
+    /**
+     * (Non-SymbolTable API) Add the given variable and value to
+     * the table.  Variable should NOT contain leading '$'.
+     */
+    void add(const UnicodeString& var, const UnicodeString& value,
+             UErrorCode& ec) {
+        if (U_SUCCESS(ec)) {
+            contents.put(var, new UnicodeString(value), ec);
+        }
+    }
+
+    /**
+     * SymbolTable API
+     */
+    virtual const UnicodeString* lookup(const UnicodeString& s) const {
+        return (const UnicodeString*) contents.get(s);
+    }
+
+    /**
+     * SymbolTable API
+     */
+    virtual const UnicodeFunctor* lookupMatcher(UChar32 /*ch*/) const {
+        return NULL;
+    }
+
+    /**
+     * SymbolTable API
+     */
+    virtual UnicodeString parseReference(const UnicodeString& text,
+                                         ParsePosition& pos, int32_t limit) const {
+        int32_t start = pos.getIndex();
+        int32_t i = start;
+        UnicodeString result;
+        while (i < limit) {
+            UChar c = text.charAt(i);
+            if ((i==start && !u_isIDStart(c)) || !u_isIDPart(c)) {
+                break;
+            }
+            ++i;
+        }
+        if (i == start) { // No valid name chars
+            return result; // Indicate failure with empty string
+        }
+        pos.setIndex(i);
+        text.extractBetween(start, i, result);
+        return result;
+    }
+};
+
+void UnicodeSetTest::TestSymbolTable() {
+    // Multiple test cases can be set up here.  Each test case
+    // is terminated by null:
+    // var, value, var, value,..., input pat., exp. output pat., null
+    const char* DATA[] = {
+        "us", "a-z", "[0-1$us]", "[0-1a-z]", NULL,
+        "us", "[a-z]", "[0-1$us]", "[0-1[a-z]]", NULL,
+        "us", "\\[a\\-z\\]", "[0-1$us]", "[-01\\[\\]az]", NULL,
+        NULL
+    };
+
+    for (int32_t i=0; DATA[i]!=NULL; ++i) {
+        UErrorCode ec = U_ZERO_ERROR;
+        TokenSymbolTable sym(ec);
+        if (U_FAILURE(ec)) {
+            errln("FAIL: couldn't construct TokenSymbolTable");
+            continue;
+        }
+
+        // Set up variables
+        while (DATA[i+2] != NULL) {
+            sym.add(DATA[i], DATA[i+1], ec);
+            if (U_FAILURE(ec)) {
+                errln("FAIL: couldn't add to TokenSymbolTable");
+                continue;
+            }
+            i += 2;
+        }
+
+        // Input pattern and expected output pattern
+        UnicodeString inpat = DATA[i], exppat = DATA[i+1];
+        i += 2;
+
+        ParsePosition pos(0);
+        UnicodeSet us(inpat, pos, USET_IGNORE_SPACE, &sym, ec);
+        if (U_FAILURE(ec)) {
+            errln("FAIL: couldn't construct UnicodeSet");
+            continue;
+        }
+
+        // results
+        if (pos.getIndex() != inpat.length()) {
+            errln((UnicodeString)"Failed to read to end of string \""
+                  + inpat + "\": read to "
+                  + pos.getIndex() + ", length is "
+                  + inpat.length());
+        }
+
+        UnicodeSet us2(exppat, ec);
+        if (U_FAILURE(ec)) {
+            errln("FAIL: couldn't construct expected UnicodeSet");
+            continue;
+        }
+        
+        UnicodeString a, b;
+        if (us != us2) {
+            errln((UnicodeString)"Failed, got " + us.toPattern(a, TRUE) +
+                  ", expected " + us2.toPattern(b, TRUE));
+        } else {
+            logln((UnicodeString)"Ok, got " + us.toPattern(a, TRUE));
+        }
+    }
+}
+
+void UnicodeSetTest::TestSurrogate() {
+    const char* DATA[] = {
+        // These should all behave identically
+        "[abc\\uD800\\uDC00]",
+        // "[abc\uD800\uDC00]", // Can't do this on C -- only Java
+        "[abc\\U00010000]",
+        0
+    };
+    for (int i=0; DATA[i] != 0; ++i) {
+        UErrorCode ec = U_ZERO_ERROR;
+        logln((UnicodeString)"Test pattern " + i + " :" + DATA[i]);
+        UnicodeSet set(DATA[i], ec);
+        if (U_FAILURE(ec)) {
+            errln("FAIL: UnicodeSet constructor");
+            continue;
+        }
+        expectContainment(set,
+                          CharsToUnicodeString("abc\\U00010000"),
+                          CharsToUnicodeString("\\uD800;\\uDC00")); // split apart surrogate-pair
+        if (set.size() != 4) {
+            errln((UnicodeString)"FAIL: " + DATA[i] + ".size() == " + 
+                  set.size() + ", expected 4");
         }
     }
 }

Index: usettest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/usettest.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- usettest.h	10 Sep 2003 02:42:49 -0000	1.5
+++ usettest.h	6 Apr 2004 10:09:46 -0000	1.6
@@ -70,6 +70,10 @@
 
     void TestInvalidCodePoint(void);
 
+    void TestSymbolTable(void);
+
+    void TestSurrogate();
+
 private:
 
     UBool toPatternAux(UChar32 start, UChar32 end);

Index: ustrtest.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/ustrtest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ustrtest.cpp	10 Sep 2003 02:42:49 -0000	1.4
+++ ustrtest.cpp	6 Apr 2004 10:09:47 -0000	1.5
@@ -24,17 +24,15 @@
 
 #endif
 
-#define LENGTHOF(array) (sizeof(array)/sizeof((array)[0]))
+#define LENGTHOF(array) (int32_t)((sizeof(array)/sizeof((array)[0])))
+
+UnicodeStringTest::~UnicodeStringTest() {}
 
 void UnicodeStringTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char *par)
 {
     if (exec) logln("TestSuite UnicodeStringTest: ");
     switch (index) {
-        case 0: name = "TestBasicManipulation"; if (exec) TestBasicManipulation(); break;
-        case 1: name = "TestCompare"; if (exec) TestCompare(); break;
-        case 2: name = "TestExtract"; if (exec) TestExtract(); break;
-        case 3: name = "TestRemoveReplace"; if (exec) TestRemoveReplace(); break;
-        case 4:
+        case 0:
             name = "StringCaseTest";
             if (exec) {
                 logln("StringCaseTest---"); logln("");
@@ -42,6 +40,10 @@
                 callTest(test, par);
             }
             break;
+        case 1: name = "TestBasicManipulation"; if (exec) TestBasicManipulation(); break;
+        case 2: name = "TestCompare"; if (exec) TestCompare(); break;
+        case 3: name = "TestExtract"; if (exec) TestExtract(); break;
+        case 4: name = "TestRemoveReplace"; if (exec) TestRemoveReplace(); break;
         case 5: name = "TestSearching"; if (exec) TestSearching(); break;
         case 6: name = "TestSpacePadding"; if (exec) TestSpacePadding(); break;
         case 7: name = "TestPrefixAndSuffix"; if (exec) TestPrefixAndSuffix(); break;
@@ -52,6 +54,7 @@
         case 12: name = "TestStackAllocation"; if (exec) TestStackAllocation(); break;
         case 13: name = "TestUnescape"; if (exec) TestUnescape(); break;
         case 14: name = "TestCountChar32"; if (exec) TestCountChar32(); break;
+        case 15: name = "TestStringEnumeration"; if (exec) TestStringEnumeration(); break;
 
         default: name = ""; break; //needed to end loop
     }
@@ -169,6 +172,57 @@
 			errln("UnicodeString::setTo(const UnicodeString&, int32_t) failed");
 		}
 	}
+
+    {
+        // op+ is new in ICU 2.8
+        UnicodeString s=UnicodeString("abc", "")+UnicodeString("def", "")+UnicodeString("ghi", "");
+        if(s!=UnicodeString("abcdefghi", "")) {
+            errln("operator+(UniStr, UniStr) failed");
+        }
+    }
+
+    {
+        // tests for Jitterbug 2360
+        // verify that APIs with source pointer + length accept length == -1
+        // mostly test only where modified, only few functions did not already do this
+        if(UnicodeString("abc", -1, "")!=UnicodeString("abc", "")) {
+            errln("UnicodeString(codepageData, dataLength, codepage) does not work with dataLength==-1");
+        }
+
+        UChar buffer[10]={ 0x61, 0x62, 0x20ac, 0xd900, 0xdc05, 0,   0x62, 0xffff, 0xdbff, 0xdfff };
+        UnicodeString s, t(buffer, -1, LENGTHOF(buffer));
+
+        if(s.setTo(buffer, -1, LENGTHOF(buffer)).length()!=u_strlen(buffer)) {
+            errln("UnicodeString.setTo(buffer, length, capacity) does not work with length==-1");
+        }
+        if(t.length()!=u_strlen(buffer)) {
+            errln("UnicodeString(buffer, length, capacity) does not work with length==-1");
+        }
+
+        if(0!=s.caseCompare(buffer, -1, U_FOLD_CASE_DEFAULT)) {
+            errln("UnicodeString.caseCompare(const UChar *, length, options) does not work with length==-1");
+        }
+
+        buffer[u_strlen(buffer)]=0xe4;
+        UnicodeString u(buffer, -1, LENGTHOF(buffer));
+        if(s.setTo(buffer, -1, LENGTHOF(buffer)).length()!=LENGTHOF(buffer)) {
+            errln("UnicodeString.setTo(buffer without NUL, length, capacity) does not work with length==-1");
+        }
+        if(u.length()!=LENGTHOF(buffer)) {
+            errln("UnicodeString(buffer without NUL, length, capacity) does not work with length==-1");
+        }
+
+        static const char cs[]={ 0x61, (char)0xe4, (char)0x85, 0 };
+        UConverter *cnv;
+        UErrorCode errorCode=U_ZERO_ERROR;
+
+        cnv=ucnv_open("ISO-8859-1", &errorCode);
+        UnicodeString v(cs, -1, cnv, errorCode);
+        ucnv_close(cnv);
+        if(v!=UnicodeString("a\\xe4\\x85").unescape()) {
+            errln("UnicodeString(const char *, length, cnv, errorCode) does not work with length==-1");
+        }
+    }
 }
 
 void
@@ -1466,5 +1520,99 @@
     test2.remove();
     if(test1>=test2 || !(test2>test1) || test1.compare(test2)>=0 || !(test2.compare(test1)>0)) {
         errln("bogus<empty failed");
+    }
+}
+
+// StringEnumeration ------------------------------------------------------- ***
+// most of StringEnumeration is tested elsewhere
+// this test improves code coverage
+
+static const char *const
+testEnumStrings[]={
+    "a",
+    "b",
+    "c",
+    "this is a long string which helps us test some buffer limits",
+    "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
+};
+
+class TestEnumeration : public StringEnumeration {
+public:
+    TestEnumeration() : i(0) {}
+
+    virtual int32_t count(UErrorCode& /*status*/) const {
+        return LENGTHOF(testEnumStrings);
+    }
+
+    virtual const UnicodeString *snext(UErrorCode &status) {
+        if(U_SUCCESS(status) && i<LENGTHOF(testEnumStrings)) {
+            unistr=UnicodeString(testEnumStrings[i++], "");
+            return &unistr;
+        }
+
+        return NULL;
+    }
+
+    virtual void reset(UErrorCode& /*status*/) {
+        i=0;
+    }
+
+    static inline UClassID getStaticClassID() {
+        return (UClassID)&fgClassID;
+    }
+    virtual UClassID getDynamicClassID() const {
+        return getStaticClassID();
+    }
+
+private:
+    static const char fgClassID;
+
+    int32_t i, length;
+};
+
+const char TestEnumeration::fgClassID=0;
+
+void
+UnicodeStringTest::TestStringEnumeration() {
+    UnicodeString s;
+    TestEnumeration ten;
+    int32_t i, length;
+    UErrorCode status;
+
+    const UChar *pu;
+    const char *pc;
+
+    // test the next() default implementation and ensureCharsCapacity()
+    for(i=0; i<LENGTHOF(testEnumStrings); ++i) {
+        status=U_ZERO_ERROR;
+        pc=ten.next(&length, status);
+        s=UnicodeString(testEnumStrings[i], "");
+        if(U_FAILURE(status) || pc==NULL || length!=s.length() || UnicodeString(pc, length, "")!=s) {
+            errln("StringEnumeration.next(%d) failed", i);
+        }
+    }
+    status=U_ZERO_ERROR;
+    if(ten.next(&length, status)!=NULL) {
+        errln("StringEnumeration.next(done)!=NULL");
+    }
+
+    // test the unext() default implementation
+    ten.reset(status);
+    for(i=0; i<LENGTHOF(testEnumStrings); ++i) {
+        status=U_ZERO_ERROR;
+        pu=ten.unext(&length, status);
+        s=UnicodeString(testEnumStrings[i], "");
+        if(U_FAILURE(status) || pu==NULL || length!=s.length() || UnicodeString(TRUE, pu, length)!=s) {
+            errln("StringEnumeration.unext(%d) failed", i);
+        }
+    }
+    status=U_ZERO_ERROR;
+    if(ten.unext(&length, status)!=NULL) {
+        errln("StringEnumeration.unext(done)!=NULL");
+    }
+
+    // test that the default clone() implementation works, and returns NULL
+    if(ten.clone()!=NULL) {
+        errln("StringEnumeration.clone()!=NULL");
     }
 }

Index: ustrtest.h
===================================================================
RCS file: /cvs/core/icu-sword/source/test/intltest/ustrtest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ustrtest.h	10 Sep 2003 02:42:49 -0000	1.3
+++ ustrtest.h	6 Apr 2004 10:09:47 -0000	1.4
@@ -15,7 +15,7 @@
 class UnicodeStringTest: public IntlTest {
 public:
     UnicodeStringTest() {}
-    virtual ~UnicodeStringTest() {}
+    virtual ~UnicodeStringTest();
     
     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
 
@@ -71,12 +71,13 @@
     void _testUnicodeStringHasMoreChar32Than(const UnicodeString &s, int32_t start, int32_t length, int32_t number);
     void TestCountChar32(void);
     void TestBogus();
+    void TestStringEnumeration();
 };
 
 class StringCaseTest: public IntlTest {
 public:
     StringCaseTest() {}
-    virtual ~StringCaseTest() {}
+    virtual ~StringCaseTest();
     
     void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0);
 

--- tsmutex.cpp DELETED ---

--- tsmutex.h DELETED ---