Exemplo n.º 1
0
int
main( int argc, char *argv[] )
{

    bind_transmitter_resp_t a;
    bind_transmitter_resp_t b;
    tlv_t tlv;

    memset(&a, 0, sizeof(bind_transmitter_resp_t));
    memset(&b, 0, sizeof(bind_transmitter_resp_t));
    memset(&tlv, 0, sizeof(tlv_t));

    /* Init PDU ***********************************************************/
    b.command_length   = 0;
    b.command_id       = BIND_TRANSMITTER_RESP;
    b.command_status   = ESME_ROK;
    b.sequence_number  = 1;
    snprintf( b.system_id, sizeof(b.system_id), "%s", "system_id");

    tlv.tag = TLVID_sc_interface_version;
    tlv.length = sizeof(uint8_t);
    tlv.value.val16 = 0x34;
    build_tlv( &(b.tlv), &tlv );

    doTest(BIND_TRANSMITTER_RESP, &a, &b);
    destroy_tlv( b.tlv );
    destroy_tlv( a.tlv );
    return( 0 );
};
Exemplo n.º 2
0
int main(int argc, char** argv)
{
     int messSize, compIters, innerIters, testIters, reportRank;

     MPI_Init(&argc, &argv);

     if ( argc != 4 )
     {
          int rank;

          MPI_Comm_rank(MPI_COMM_WORLD, &rank);

          if ( rank == 0 )
               printf("\n  %s [# of comp iterations] [inner iterations] [total samples]\n\n", argv[0]);
          MPI_Finalize();
          exit(-1);
     }

     messSize    = 4;             /* number of doubles in Allreduce message */
     reportRank  = 0;             /* Rank printing output                   */
     compIters   = atoi(argv[1]); /* Number of computation iterations       */
     innerIters  = atoi(argv[2]); /* Number of inner loop iterations        */
     testIters   = atoi(argv[3]); /* Number of total sample iterations      */

     doTest(messSize, reportRank, compIters, innerIters, testIters);

     MPI_Finalize();

     exit(0);
}
Exemplo n.º 3
0
int
main( int argc, char *argv[] )
{

    bind_transmitter_t a;
    bind_transmitter_t b;

    memset(&a, 0, sizeof(bind_transmitter_t));
    memset(&b, 0, sizeof(bind_transmitter_t));

    /* Init PDU ***********************************************************/
    b.command_length   = 0;
    b.command_id       = BIND_TRANSMITTER;
    b.command_status   = ESME_ROK;
    b.sequence_number  = 1;
    snprintf( b.system_id, sizeof(b.system_id), "%s", "system_id");
    snprintf( b.password, sizeof(b.password), "%s", "pass");
    snprintf( b.system_type, sizeof(b.system_type), "%s", "syst");
    b.interface_version = 0x34;
    b.addr_ton          = 2;
    b.addr_npi          = 1;
    snprintf( b.address_range, sizeof(b.address_range), "%s", "address_range");

    doTest(BIND_TRANSMITTER, &a, &b);
    return( 0 );
};
Exemplo n.º 4
0
void genericOrderingTestWithResult(UCollator *coll, const char * const s[], uint32_t size, UCollationResult result) {
  UChar t1[2048] = {0};
  UChar t2[2048] = {0};
  UCollationElements *iter;
  UErrorCode status = U_ZERO_ERROR;

  uint32_t i = 0, j = 0;
  log_verbose("testing sequence:\n");
  for(i = 0; i < size; i++) {
    log_verbose("%s\n", s[i]);
  }

  iter = ucol_openElements(coll, t1, u_strlen(t1), &status);
  if (U_FAILURE(status)) {
    log_err("Creation of iterator failed\n");
  }
  for(i = 0; i < size-1; i++) {
    for(j = i+1; j < size; j++) {
      u_unescape(s[i], t1, 2048);
      u_unescape(s[j], t2, 2048);
      doTest(coll, t1, t2, result);
      /* synwee : added collation element iterator test */
      ucol_setText(iter, t1, u_strlen(t1), &status);
      backAndForth(iter);
      ucol_setText(iter, t2, u_strlen(t2), &status);
      backAndForth(iter);
    }
  }
  ucol_closeElements(iter);
}
Exemplo n.º 5
0
void TransliteratorAPITest::TestTransliterate3(){
    UnicodeString rs="This is the replaceable String";
    UnicodeString Data[] = {
        "0",  "0",  "This is the replaceable String",
        "2",  "3",  UnicodeString("Th\\u0069s is the replaceable String", ""),
        "21", "23", UnicodeString("Th\\u0069s is the repl\\u0061\\u0063eable String", ""),
        "14", "17", UnicodeString("Th\\u0069s is t\\u0068\\u0065\\u0020repl\\u0061\\u0063eable String", ""),
    };
    int start, limit;
    UnicodeString message;
    UParseError parseError;
    UErrorCode status = U_ZERO_ERROR;
    Transliterator *t=Transliterator::createInstance("Any-Hex", UTRANS_FORWARD, parseError, status);
    if(U_FAILURE(status)) {
      errln("Error creating transliterator %s", u_errorName(status));
      delete t;
      return;
    }

    if(t == 0)
        errln("FAIL : construction");
    for(uint32_t i=0; i<UPRV_LENGTHOF(Data); i=i+3){
        start=getInt(Data[i+0]);
        limit=getInt(Data[i+1]);
        t->transliterate(rs, start, limit);
        message=t->getID() + ".transliterate(ReplaceableString, start, limit):("+start+","+limit+"):";
        doTest(message, rs, Data[i+2]); 
    }
    delete t;
}
void SpriteMainScene::doAutoTest()
{
    isStating = false;
    statCount = 0;
    totalStatTime = 0.0f;
    minFrameRate = -1.0f;
    maxFrameRate = -1.0f;

    // recreate a SubTest object
    this->removeChild(_subTest->getTheParentNode());
    CC_SAFE_DELETE(_subTest);
    _subTest = new (std::nothrow) SubTest;
    _subTest->initWithSubTest(_subtestNumber, this);
    
    // create sprites & update the label
    _quantityNodes = autoTestSpriteCounts[autoTestIndex];
    for( int i = 0; i < _quantityNodes; i++)
    {
        auto sprite = _subTest->createSpriteWithTag(i);
        doTest(sprite);
    }
    updateNodes();
    updateTitle();

    schedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::beginStat), DELAY_TIME);
    schedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::endStat), DELAY_TIME + STAT_TIME);
}
Exemplo n.º 7
0
static void TestExtra()
{
    int32_t i, j;
    int32_t len;
    UCollator *myCollation;
    UErrorCode status = U_ZERO_ERROR;
    static const char str[]="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ";
    UChar rules[sizeof(str)];
    len = strlen(str);
    u_uastrcpy(rules, str);

    myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status);
    if(U_FAILURE(status)){
        log_err_status(status, "ERROR: in creation of rule based collator :%s\n", myErrorName(status));
        return;
    }
    ucol_setStrength(myCollation, UCOL_TERTIARY);
    for (i = 0; i < COUNT_TEST_CASES-1 ; i++)
    {
        for (j = i + 1; j < COUNT_TEST_CASES; j += 1)
        {
        
            doTest(myCollation, testCases[i], testCases[j], UCOL_LESS);
        }
    }
    ucol_close(myCollation);
    myCollation = 0;
}
Exemplo n.º 8
0
void CollationFrenchTest::TestSecondary(/* char* par */)
{
    //test acute and grave ordering
    int32_t i = 0;
    int32_t j;
    Collator::EComparisonResult expected;
    UErrorCode status = U_ZERO_ERROR;
    //myCollation->setAttribute(UCOL_FRENCH_COLLATION, UCOL_ON, status);
    myCollation->setStrength(Collator::SECONDARY);
    if (U_FAILURE(status))
        errln("Error setting attribute in French collator");
    else
    {
        const int32_t testAcuteSize = UPRV_LENGTHOF(testAcute);
        for (i = 0; i < testAcuteSize; i++)
        {
            for (j = 0; j < testAcuteSize; j++)
            {
                if (i <  j)
                    expected = Collator::LESS;
                else if (i == j)
                    expected = Collator::EQUAL;
                else // (i >  j)
                    expected = Collator::GREATER;
                doTest(myCollation, testAcute[i], testAcute[j], expected );
            }
        }
    }
}
Exemplo n.º 9
0
int main(int argc, const char **argv) { 
  SescConf = new SConfig(argc, argv);

  GProcessor gproc;
  //lsq = new LSQFull(&gproc,0);
  lsq = new LSQFull(0);I(0);

  timeval startTime;
  gettimeofday(&startTime,0);

  doTest();

  timeval endTime;
  gettimeofday(&endTime,0);
  double msecs = ( endTime.tv_sec - startTime.tv_sec ) * 1000
    + ( endTime.tv_usec - startTime.tv_usec ) / 1000;

  long double res = instTotal/1000;
  res /= msecs;
  MSG("------------------");
  MSG ( "LSQ MIPS = %g secs = %g insts = %lld", (double) res, msecs/1000,(long long) instTotal );
  MSG("------------------");

  return 0;
}
Exemplo n.º 10
0
static void TestPrimary( )
{
    int32_t len,i;
    UCollator *myCollation;
    UErrorCode status=U_ZERO_ERROR;
    static const char str[]="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ";   
    UChar rules[sizeof(str)];
    len = strlen(str);
    u_uastrcpy(rules, str);

    myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status);
    if(U_FAILURE(status)){
        log_err_status(status, "ERROR: in creation of rule based collator :%s\n", myErrorName(status));
        return;
    }
    ucol_setStrength(myCollation, UCOL_PRIMARY);
    
    for (i = 17; i < 26 ; i++)
    {
        
        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
    }
    ucol_close(myCollation);
    myCollation = 0;
}
Exemplo n.º 11
0
static void TestSecondary()
{
    int32_t i,j, testAcuteSize;
    UCollationResult expected=UCOL_EQUAL;
    UErrorCode status = U_ZERO_ERROR;
    myCollation = ucol_open("fr_FR", &status);
    if(U_FAILURE(status)){
        log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
        return;
    }
    ucol_setAttribute(myCollation, UCOL_STRENGTH, UCOL_SECONDARY, &status);
    if(U_FAILURE(status)){
        log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
        return;
    }
    log_verbose("Testing French Collation with Secondary strength\n");
    /*test acute and grave ordering (compare to french collation)*/
    testAcuteSize = sizeof(testAcute) / sizeof(testAcute[0]);
    for (i = 0; i < testAcuteSize; i++)
    {
        for (j = 0; j < testAcuteSize; j++)
        {
            if (i <  j) expected = UCOL_LESS;
            if (i == j) expected = UCOL_EQUAL;
            if (i >  j) expected = UCOL_GREATER;
            doTest(myCollation, testAcute[i], testAcute[j], expected );
        }
    }
    ucol_close(myCollation);
}
Exemplo n.º 12
0
int main()
{
    std::mt19937 randomEngine;
    std::vector<TreeNode> vecNodes;
    std::vector<TreeNode*> vecNodePtrs;
    std::vector<int> vecVisitNode;
    std::vector<int> vecVisitNodeCmp;
    std::vector<int> vecVisitSubtree;
    std::vector<int> vecVisitSubtreeCmp;

    for (int i = 0; i < 100000; ++i)
    {
        TreeNode *pRoot = generateRandomBinaryTree(randomEngine,
                                                   &vecNodes,
                                                   &vecNodePtrs);

        bool passed = doTest(pRoot,
                             &vecVisitNode,
                             &vecVisitNodeCmp,
                             &vecVisitSubtree,
                             &vecVisitSubtreeCmp);

        if (!passed)
        {
            std::printf("Test failed!\n");
            break;
        }
    }

    return 0;
}
Exemplo n.º 13
0
static void selfTest(uint8_t *src[3], int stride[3], int w, int h){
    enum PixelFormat srcFormat, dstFormat;
    int srcW, srcH, dstW, dstH;
    int flags;

    for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) {
        for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) {
            printf("%s -> %s\n",
                   sws_format_name(srcFormat),
                   sws_format_name(dstFormat));
            fflush(stdout);

            srcW= w;
            srcH= h;
            for (dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){
                for (dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){
                    for (flags=1; flags<33; flags*=2) {
                        int res;

                        res = doTest(src, stride, w, h, srcFormat, dstFormat,
                                     srcW, srcH, dstW, dstH, flags);
                        if (res < 0) {
                            dstW = 4 * w / 3;
                            dstH = 4 * h / 3;
                            flags = 33;
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 14
0
int
main( int argc, char *argv[] )
{

    cancel_sm_t a;
    cancel_sm_t b;

    memset(&a, 0, sizeof(cancel_sm_t));
    memset(&b, 0, sizeof(cancel_sm_t));

    /* Init PDU ***********************************************************/
    b.command_length   = 0;
    b.command_id       = CANCEL_SM;
    b.command_status   = ESME_ROK;
    b.sequence_number  = 1;
    snprintf((char*)b.service_type, sizeof(b.service_type), "%s", "CMT");
    snprintf((char*)b.message_id, sizeof(b.message_id), "%s", "0302830192");
    b.source_addr_ton  = 2;
    b.source_addr_npi  = 1;
    snprintf((char*)b.source_addr, sizeof(b.source_addr), "%s", "0900001111");
    b.dest_addr_ton    = 2;
    b.dest_addr_npi    = 1;
    snprintf((char*)b.destination_addr, sizeof(b.source_addr), "%s", "0900001111");

    doTest(CANCEL_SM, &a, &b);
    return( 0 );
};
Exemplo n.º 15
0
void CollationTurkishTest::TestTertiary(/* char* par */)
{
    int32_t i = 0;
    myCollation->setStrength(Collator::TERTIARY);
    for (i = 0; i < 8 ; i++) {
        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
    }
}
Exemplo n.º 16
0
void CollationDanishTest::TestPrimary(/* char* par */)
{
    int32_t i;
    myCollation->setStrength(Collator::PRIMARY);
    for (i = 5; i < 8; i++) {
        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
    }
}
Exemplo n.º 17
0
UserDefaultTest::UserDefaultTest()
{
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	CCLabelTTF* label = CCLabelTTF::labelWithString("CCUserDefault test see log", "Arial", 28);
	addChild(label, 0);
	label->setPosition( ccp(s.width/2, s.height-50) );

	doTest();
}
Exemplo n.º 18
0
int
main( int argc, char *argv[] )
{

    deliver_sm_t a;
    deliver_sm_t b;
    tlv_t tlv;

    memset(&a, 0, sizeof(deliver_sm_t));
    memset(&b, 0, sizeof(deliver_sm_t));
    memset(&tlv, 0, sizeof(tlv_t));

    /* Init PDU ***********************************************************/
    b.command_length   = 0;
    b.command_id       = DELIVER_SM;
    b.command_status   = ESME_ROK;
    b.sequence_number  = 1;
    snprintf((char*)b.service_type, SERVICE_TYPE_LENGTH, "%s", "CMT");
    b.source_addr_ton  = 2;
    b.source_addr_npi  = 1;
    snprintf((char*)b.source_addr, ADDRESS_LENGTH, "%s", "0900001111");
    b.dest_addr_ton    = 2;
    b.dest_addr_npi    = 1;
    snprintf((char*)b.destination_addr, ADDRESS_LENGTH, "%s", "0900001111");
    b.esm_class        = 0;
    b.protocol_id      = 0;
    b.priority_flag    = 0;
    memset(b.schedule_delivery_time, 0, sizeof(b.schedule_delivery_time));
    memset(b.validity_period, 0, sizeof(b.validity_period));
    b.registered_delivery = 0;
    b.replace_if_present_flag =0;
    b.data_coding         = 0;
    b.sm_default_msg_id   = 0;
    b.sm_length           = strlen(TEXTO);
    memcpy(b.short_message, TEXTO, b.sm_length);

    tlv.tag = TLVID_user_message_reference;
    tlv.length = sizeof(uint16_t);
    tlv.value.val16 = 0x0024;
    build_tlv( &(b.tlv), &tlv );

    tlv.tag = TLVID_message_payload;
    tlv.length = strlen(TEXTO);
    memcpy(tlv.value.octet, TEXTO, tlv.length);
    build_tlv( &(b.tlv), &tlv );

    tlv.tag = 0x1501;

    tlv.length = strlen(TEXTO);
    memcpy(tlv.value.octet, TEXTO, tlv.length);
    build_tlv( &(b.tlv), &tlv );

    doTest(DELIVER_SM, &a, &b);
    destroy_tlv( b.tlv );
    destroy_tlv( a.tlv );
    return( 0 );
};
int main()
{
    doTest({ 3, 9, 20, 0, 0, 15, 7 },
           {
               { 15, 7 },
               { 9, 20 },
               { 3 },
           });

    doTest({ 1, 2, 3, 4, 5, 6, 7 },
           {
               { 4, 5, 6, 7 },
               { 2, 3 },
               { 1 },
           });

    return 0;
}
UserDefaultTest::UserDefaultTest()
{
    auto s = Director::getInstance()->getWinSize();
    auto label = LabelTTF::create("CCUserDefault test see log", "Arial", 28);
    addChild(label, 0);
    label->setPosition( Point(s.width/2, s.height-50) );

    doTest();
}
Exemplo n.º 21
0
// Verify that our LoadoutZone team tracking is working
TEST(LoadoutTest, TestLevelHasLoadoutZoneForTeam) 
{
   // Base case
   {
      Vector<S32> teamLoadoutZoneCount({ 3,2,0 });
      S32 neutralLoadoutZoneCount(0);
      S32 hostileLoadoutZoneCount(0);
      Vector<S32> results({ true, true, false });

      doTest(teamLoadoutZoneCount, neutralLoadoutZoneCount, hostileLoadoutZoneCount, results);
   }

   // Make sure neutral zones work
   {
      Vector<S32> teamLoadoutZoneCount({ 0,1,0 });
      S32 neutralLoadoutZoneCount(1);
      S32 hostileLoadoutZoneCount(0);
      Vector<S32> results({ true, true, true });     

      doTest(teamLoadoutZoneCount, neutralLoadoutZoneCount, hostileLoadoutZoneCount, results);
   }

   // And hostile ones don't
   {
      Vector<S32> teamLoadoutZoneCount({ 0,9,0,1 });
      S32 neutralLoadoutZoneCount(0);
      S32 hostileLoadoutZoneCount(2);
      Vector<S32> results({ false, true, false, true });

      doTest(teamLoadoutZoneCount, neutralLoadoutZoneCount, hostileLoadoutZoneCount, results);
   }

   // And neutral + hostile work as expected
   {
      Vector<S32> teamLoadoutZoneCount({ 3,2,0,0,0,1 });
      S32 neutralLoadoutZoneCount(1);
      S32 hostileLoadoutZoneCount(1);
      Vector<S32> results({ true, true, true, true, true, true });
         
      doTest(teamLoadoutZoneCount, neutralLoadoutZoneCount, hostileLoadoutZoneCount, results);
   }
}
Exemplo n.º 22
0
static void TestTertiary( )
{
    int32_t testMoreSize;
    UCollationResult expected=UCOL_EQUAL;
    int32_t i,j;
    UErrorCode status = U_ZERO_ERROR;
    myCollation = ucol_open("en_US", &status);
    if(U_FAILURE(status)){
        log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
        return;
    }
    log_verbose("Testing English Collation with Tertiary strength\n");

    ucol_setStrength(myCollation, UCOL_TERTIARY);
    for (i = 0; i < 38 ; i++)
    {
        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
    }
  

    j = 0;
   for (i = 0; i < 10; i++)
    {
        for (j = i+1; j < 10; j++)
        {
            doTest(myCollation, testBugs[i], testBugs[j], UCOL_LESS);
        }
   }
    /*test more interesting cases */
    testMoreSize = UPRV_LENGTHOF(testMore);
    for (i = 0; i < testMoreSize; i++)
    {
        for (j = 0; j < testMoreSize; j++)
        {
            if (i <  j) expected = UCOL_LESS;
            if (i == j) expected = UCOL_EQUAL;
            if (i >  j) expected = UCOL_GREATER;
            doTest(myCollation, testMore[i], testMore[j], expected );
        }
    }
    ucol_close(myCollation);
}
Exemplo n.º 23
0
rtems_task Init(
  rtems_task_argument ignored
)
{
  puts( "\n\n*** TEST " TEST_NAME " ***" );
  puts( "Testing " TEST_SEMAPHORE_TYPE " semaphore flush" );
  doTest();
  puts( "*** END OF TEST " TEST_NAME " ***" );

  rtems_test_exit(0);
}
task main() {
  displayCenteredTextLine(0, "Mindsensors");
  displayCenteredBigTextLine(1, "PFMate");
  displayCenteredTextLine(3, "Test 1");
  sleep(2000);

  // Run through each channel for testing.
  for (short channel = 1; channel < 5; channel++) {
    doTest(channel);
  }
}
Exemplo n.º 25
0
task main() {
  nxtDisplayCenteredTextLine(0, "Mindsensors");
  nxtDisplayCenteredBigTextLine(1, "PFMate");
  nxtDisplayCenteredTextLine(3, "Test 1");
  wait1Msec(2000);

  // Run through each channel for testing.
  for (int channel = 1; channel < 5; channel++) {
    doTest(channel);
  }
}
Exemplo n.º 26
0
int TestACLsInfer::execute()
{
	bool lSuccess = true;	
	if (MVTApp::startStore())
	{
		MVTRand::getString(mClassStr, 5, 10, false, true);
		doTest() ;		
		MVTApp::stopStore();
	}
	else { TVERIFY(!"Unable to start store"); }
	return lSuccess?0:1;
}
Exemplo n.º 27
0
void CollationFrenchTest::TestExtra(/* char* par */)
{
    int32_t i, j;
    myCollation->setStrength(Collator::TERTIARY);
    for (i = 0; i < 9 ; i++)
    {
        for (j = i + 1; j < 10; j += 1)
        {
            doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS);
        }
    }
}
Exemplo n.º 28
0
static void
TestJitterbug1098(){
    UChar rule[1000];
    UCollator* c1 = NULL;
    UErrorCode status = U_ZERO_ERROR;
    UParseError parseError;
    char preContext[200]={0};
    char postContext[200]={0};
    int i=0;
    const char* rules[] = {
         "&''<\\\\",
         "&\\'<\\\\",
         "&\\\"<'\\'",
         "&'\"'<\\'",
         '\0'

    };
    const UCollationResult results1098[] = {
        UCOL_LESS,
        UCOL_LESS, 
        UCOL_LESS,
        UCOL_LESS,
    };
    const UChar input[][2]= {
        {0x0027,0x005c},
        {0x0027,0x005c},
        {0x0022,0x005c},
        {0x0022,0x0027},
    };
    UChar X[2] ={0};
    UChar Y[2] ={0};
    u_memset(parseError.preContext,0x0000,U_PARSE_CONTEXT_LEN);      
    u_memset(parseError.postContext,0x0000,U_PARSE_CONTEXT_LEN);
    for(;rules[i]!=0;i++){
        u_uastrcpy(rule, rules[i]);
        c1 = ucol_openRules(rule, u_strlen(rule), UCOL_OFF, UCOL_DEFAULT_STRENGTH, &parseError, &status);
        if(U_FAILURE(status)){
            log_err("Could not parse the rules syntax. Error: %s ", u_errorName(status));

            if (status == U_PARSE_ERROR) {
                u_UCharsToChars(parseError.preContext,preContext,20);
                u_UCharsToChars(parseError.postContext,postContext,20);
                log_verbose("\n\tPre-Context: %s \n\tPost-Context:%s \n",preContext,postContext);
            }

            return;
        }
        X[0] = input[i][0];
        Y[0] = input[i][1];
        doTest(c1,X,Y,results1098[i]);
        ucol_close(c1);
    }
}
Exemplo n.º 29
0
void TransliteratorAPITest::TestGetDisplayName() {
    UnicodeString dispNames[]= { 
         //ID, displayName
        //"CurlyQuotes-StraightQuotes" ,"CurlyQuotes to StraightQuotes",
          "Any-Hex"                ,"Any to Hex Escape",
          "Halfwidth-Fullwidth"        ,"Halfwidth to Fullwidth" ,
          //"Latin-Arabic"               ,"Latin to Arabic"      ,
          "Latin-Devanagari"           ,"Latin to Devanagari"  ,
          "Greek-Latin"                ,"Greek to Latin"       ,
          //"Arabic-Latin"               ,"Arabic to Latin"      ,
          "Hex-Any"                ,"Hex Escape to Any",
          "Cyrillic-Latin"             ,"Cyrillic to Latin"    ,
          "Latin-Greek"                ,"Latin to Greek"       ,
          "Latin-Katakana"                 ,"Latin to Katakana"        ,
          //"Latin-Hebrew"               ,"Latin to Hebrew"      ,
          "Katakana-Latin"                 ,"Katakana to Latin"        
      };
    UnicodeString name="";
    Transliterator* t;
    UnicodeString message;
    UErrorCode status = U_ZERO_ERROR;
    UParseError parseError;

#if UCONFIG_NO_FORMATTING
    logln("Skipping, UCONFIG_NO_FORMATTING is set\n");
    return;
#else

    for (uint32_t i=0; i<sizeof(dispNames)/sizeof(dispNames[0]); i=i+2 ) {
        t = Transliterator::createInstance(dispNames[i+0], UTRANS_FORWARD, parseError, status);
        if(t==0){
             dataerrln("FAIL: construction: " + dispNames[i+0] + " - " + u_errorName(status));
             status = U_ZERO_ERROR;
             continue;
        }
        t->getDisplayName(t->getID(), name);
        message="Display name for ID:" + t->getID();
      //  doTest(message, name, dispNames[i+1]); //!!! This will obviously fail for any locale other than english and its children!!!
        name=""; 
        t->getDisplayName(t->getID(), Locale::getUS(), name);
        message.remove();
        message.append("Display name for on english locale ID:");
        message.append(t->getID());
    // message="Display name for on english locale ID:" + t->getID();
        doTest(message, name, dispNames[i+1]);
        name="";

        delete t;
    }
#endif

}
int main()
{
    doTest("", true);
    doTest("[]{}()", true);
    doTest("[{}()]", true);
    doTest("[", false);
    doTest("]", false);
    doTest("[()", false);
    doTest("[{}()]]", false);
    return 0;
}