Ticket #5927: 5408-LocaleKitTests.patch

File 5408-LocaleKitTests.patch, 4.7 KB (added by mmadia, 14 years ago)
  • src/tests/kits/locale/catalogTestAddOn.cpp

     
    1 /* 
     1/*
    22** Copyright 2003, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
    33** Distributed under the terms of the OpenBeOS License.
    44*/
     
    2222#define catName catSig".catalog"
    2323
    2424
    25 void 
     25void
    2626CatalogTestAddOn::Run() {
    2727    printf("addon...");
    2828    status_t res;
     
    8686}
    8787
    8888
    89 void 
     89void
    9090CatalogTestAddOn::Check() {
    9191    status_t res;
    9292    printf("addon-check...");
     
    9595    size_t hashVal = CatKey::HashFun(s.String());
    9696    // ok, we now try to re-load the catalog that has just been written:
    9797    //
    98     // actually, the following code can be seen as an example of what an 
     98    // actually, the following code can be seen as an example of what an
    9999    // add_on needs in order to translate strings:
    100100    BCatalog cat;
    101101    res = get_add_on_catalog(&cat, catSig);
     
    114114    assert(sig == catSig);
    115115
    116116    // now check strings:
    117     s = TR_ID(hashVal);
     117    s = B_TRANSLATE_ID(hashVal);
    118118    assert(s == "Schnur_id_A");
    119     s = TR_ALL("string", "programming", "");
     119    s = B_TRANSLATE_ALL("string", "programming", "");
    120120    assert(s == "String_A");
    121     s = TR_ALL("string", "programming", "Deutsches Fachbuch");
     121    s = B_TRANSLATE_ALL("string", "programming", "Deutsches Fachbuch");
    122122    assert(s == "Textpuffer_A");
    123     s = TR_CMT("string", "Deutsches Fachbuch");
     123    s = B_TRANSLATE_COMMENT("string", "Deutsches Fachbuch");
    124124    assert(s == "Leine_A");
    125125    // the following string should be found in the embedded catalog only:
    126     s = TR_ALL("string", "base", "");
     126    s = B_TRANSLATE_ALL("string", "base", "");
    127127    assert(s == "string_A");
    128128    // the following id should be found in the embedded catalog only:
    129     s = TR_ID(32);
     129    s = B_TRANSLATE_ID(32);
    130130    assert(s == "hashed string_A");
    131131    // the following id doesn't exist anywhere (hopefully):
    132     s = TR_ID(-1);
     132    s = B_TRANSLATE_ID(-1);
    133133    assert(s == "");
    134     // the following string exists twice, in the embedded as well as in the 
     134    // the following string exists twice, in the embedded as well as in the
    135135    // external catalog. So we should get the external translation (as it should
    136136    // override the embedded one):
    137     s = TR("string");
     137    s = B_TRANSLATE("string");
    138138    assert(s == "Schnur_A");
    139139
    140140    // check access to app-catalog from inside add-on:
  • src/tests/kits/locale/catalogTest.cpp

     
    124124    assert(res == B_OK);
    125125
    126126    // now check strings:
    127     s = TR_ID(hashVal);
     127    s = B_TRANSLATE_ID(hashVal);
    128128    assert(s == "Schnur_id");
    129     s = TR_ALL("string", "programming", "");
     129    s = B_TRANSLATE_ALL("string", "programming", "");
    130130    assert(s == "String");
    131     s = TR_ALL("string", "programming", "Deutsches Fachbuch");
     131    s = B_TRANSLATE_ALL("string", "programming", "Deutsches Fachbuch");
    132132    assert(s == "Textpuffer");
    133     s = TR_CMT("string", "Deutsches Fachbuch");
     133    s = B_TRANSLATE_COMMENT("string", "Deutsches Fachbuch");
    134134    assert(s == "Leine");
    135135    // the following string should be found in the embedded catalog only:
    136     s = TR_ALL("string", "base", NULL);
     136    s = B_TRANSLATE_ALL("string", "base", NULL);
    137137    assert(s == "string");
    138138    // the following id should be found in the embedded catalog only:
    139     s = TR_ID(32);
     139    s = B_TRANSLATE_ID(32);
    140140    assert(s == "hashed string");
    141141    // the following id doesn't exist anywhere (hopefully):
    142     s = TR_ID(-1);
     142    s = B_TRANSLATE_ID(-1);
    143143    assert(s == "");
    144144    // the following string exists twice, in the embedded as well as in the
    145145    // external catalog. So we should get the external translation (as it should
    146146    // override the embedded one):
    147     s = TR("string");
     147    s = B_TRANSLATE("string");
    148148    assert(s == "Schnur");
    149149
    150150    // now check if trying to access same catalog by specifying its data works:
  • src/tests/kits/locale/catalogSpeed.cpp

     
    9595    watch.Reset();
    9696    watch.Resume();
    9797    for (uint32 i = 0; i < kNumStrings; i++) {
    98         translated = TR(strs[i].String());
     98        translated = B_TRANSLATE(strs[i].String());
    9999    }
    100100    watch.Suspend();
    101101    printf("\tlooked up %lu strings in       %9Ld usecs\n",
     
    161161    watch.Reset();
    162162    watch.Resume();
    163163    for (uint32 i = 0; i < kNumStrings; i++) {
    164         translated = TR_ID(i);
     164        translated = B_TRANSLATE_ID(i);
    165165    }
    166166    watch.Suspend();
    167167    printf("\tlooked up %lu strings in       %9Ld usecs\n",