// @bug 4114077 // // Collation with decomposition off doesn't work for Europe // void CollationRegressionTest::Test4114077(/* char* par */) { // Ensure that we get the same results with decomposition off // as we do with it on.... UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::TERTIARY); static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x00C0, 0}, {0x3d, 0}, {0x41, 0x0300, 0}, // Should be equivalent {0x70, 0x00ea, 0x63, 0x68, 0x65, 0}, {0x3e, 0}, {0x70, 0x00e9, 0x63, 0x68, 0x00e9, 0}, {0x0204, 0}, {0x3d, 0}, {0x45, 0x030F, 0}, {0x01fa, 0}, {0x3d, 0}, {0x41, 0x030a, 0x0301, 0}, // a-ring-acute -> a-ring, acute // -> a, ring, acute {0x41, 0x0300, 0x0316, 0}, {0x3c, 0}, {0x41, 0x0316, 0x0300, 0} // No reordering --> unequal }; c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status); compareArray(*c, test1, ARRAY_LENGTH(test1)); static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x41, 0x0300, 0x0316, 0}, {0x3d, 0}, {0x41, 0x0316, 0x0300, 0} // Reordering --> equal }; c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); compareArray(*c, test2, ARRAY_LENGTH(test2)); delete c; }
void Player::checkGesture(int hand[3]){ if(compareArray(hand, _hulk) && _userID == 200){ copyArray(_hulk, _gesture, 6); _charging = true; _chargingTimeMax = 1.0*_hulk[4]; _chargingAtkValue = 0; } else if(compareArray(hand, _spiderman) && _userID == 200){ copyArray(_spiderman, _gesture, 6); _charging = true; _chargingTimeMax = 1.0*_spiderman[4]; _chargingAtkValue = 0; } else if(compareArray(hand, _ironman) && _userID == 200){ copyArray(_ironman, _gesture, 6); _charging = true; _chargingTimeMax = 1.0*_ironman[4]; _chargingAtkValue = 0; } else if(compareArray(hand, _defence) && _userID == 100){ copyArray(_defence, _gesture, 6); _charging = true; _chargingTimeMax = 1.0*_defence[4]; _defValue = 0; } //otherwise set the gesture to none else{ copyArray(_none, _gesture, 6); //if you're at the maximum charge and have opened your palm to indicate sending the attack if(_charging){ _atkValue = _chargingAtkValue; _chargingTime = 0; _chargingTimeMax = 0; _charging = false; } } //if we're charging an attack or defence if(_charging){ //If you're at maximum charge but haven't sent the attack or the defense is at max charge //don't do anything if(_chargingTime >= _chargingTimeMax){ } else{ //if we're defending if(_gesture[0] == _defence[0] && _gesture[1] == _defence[1] && _gesture[2] == _defence[2]){ //defense scaled depending how long it's been charing. _defValue = (1.0*_gesture[3])*(_chargingTime/_chargingTimeMax); } //if we're attacking else{ _chargingAtkValue = (1.0*_gesture[3])*(_chargingTime/_chargingTimeMax); } //Increment charging time _chargingTime ++; } } }
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", // after UCA 4.1, the two lines below are not equal anymore do not have equal sign "\\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"}; // After UCA 4.1 Thai are normal so won't break a contraction 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"); } }
//----Compares two Experiences----// float compareTo(experience &experience1, experience &experience2) { //first test char firstTest = compareArray(experience1.localView,experience2.localView); if(!firstTest) { return 0; } //2nd test vector3D thisPose; vector3D otherPose; memcpy(thisPose, experience1.poseCellsPose, 6); memcpy(otherPose, experience2.poseCellsPose, 6); char thetaAbsDist = abs(thisPose.theta - otherPose.theta); if(thetaAbsDist > maxAssociationRadiusTheta) { return 0; } //3rd test float maxXYDistSquared = maxAssociationRadiusXY * maxAssociationRadiusXY; int xyDistSquared = ((otherPose.x - thisPose.x) * (otherPose.x - thisPose.x)) + ((otherPose.y - thisPose.y) * (otherPose.y - thisPose.y)); if(xyDistSquared > maxXYDistSquared) { return 0; } //otherwise is a measure of comparison from 0 to 1 comprised of a 0.5 contribution from theta and xy respectively return (2 - (sqrt(xyDistSquared) / maxAssociationRadiusXY) - (thetaAbsDist / maxAssociationRadiusTheta)) * 0.5; }
// @bug 4092260 // // Mu/micro conflict // Micro symbol and greek lowercase letter Mu should sort identically // void CollationRegressionTest::Test4092260(/* char* par */) { UErrorCode status = U_ZERO_ERROR; Locale el("el", ""); Collator *c = NULL; c = Collator::createInstance(el, status); if (c == NULL || U_FAILURE(status)) { errln("Failed to create collator for el locale."); delete c; return; } // These now have tertiary differences in UCA c->setAttribute(UCOL_STRENGTH, UCOL_SECONDARY, status); static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x00B5, 0}, {0x3d, 0}, {0x03BC, 0} }; compareArray(*c, tests, UPRV_LENGTHOF(tests)); delete c; }
// @bug 4095316 // void CollationRegressionTest::Test4095316(/* char* par */) { UErrorCode status = U_ZERO_ERROR; Locale el_GR("el", "GR"); Collator *c = Collator::createInstance(el_GR, status); if (c == NULL || U_FAILURE(status)) { errln("Failed to create collator for el_GR locale"); delete c; return; } // These now have tertiary differences in UCA //c->setStrength(Collator::TERTIARY); c->setAttribute(UCOL_STRENGTH, UCOL_SECONDARY, status); static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x03D4, 0}, {0x3d, 0}, {0x03AB, 0} }; compareArray(*c, tests, ARRAY_LENGTH(tests)); delete c; }
void checkArrayStatus() { if (isLoadingStartArray) { if ((compareArray(startbit, startbits, 4)) == 1) { isLoadingStartArray = 0; isLoadingAddressArray = 1; return; } } if (isLoadingAddressArray) { if (arraySizeCounter == sizeof(addressbit)) { isLoadingAddressArray = 0; isLoadingCmdArray = 1; arraySizeCounter = 0; return; } } if(isLoadingCmdArray) { if (arraySizeCounter == sizeof(cmdbit)) { isLoadingCmdArray = 0; arraySizeCounter = 0; checkSendMessage(); } } }
// @bug 4087241 // // string comparison errors in Scandinavian collators // void CollationRegressionTest::Test4087241(/* char* par */) { UErrorCode status = U_ZERO_ERROR; Locale da_DK("da", "DK"); RuleBasedCollator *c = NULL; c = (RuleBasedCollator *) Collator::createInstance(da_DK, status); if (c == NULL || U_FAILURE(status)) { errln("Failed to create collator for da_DK locale"); delete c; return; } c->setStrength(Collator::SECONDARY); static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x7a, 0}, {0x3c, 0}, {0x00E6, 0}, // z < ae {0x61, 0x0308, 0}, {0x3c, 0}, {0x61, 0x030A, 0}, // a-umlaut < a-ring {0x59, 0}, {0x3c, 0}, {0x75, 0x0308, 0}, // Y < u-umlaut }; compareArray(*c, tests, ARRAY_LENGTH(tests)); delete c; }
int isLLPalindrome(node_llg* head) { node_llg* ptr = head; int* store = malloc(sizeof(int)*1); if(store == NULL) return 0; int count = 0; int max = 1; while(ptr!=NULL) { if(count == max) { max*=2; if((store = realloc(store, sizeof(int)*max)) == NULL) return 0; } store[count++] = ptr->value; ptr = ptr->next; } int isPal = compareArray(store, count); free(store); return isPal; }
// @bug 4062418 // // Secondary/Tertiary comparison incorrect in French Secondary // void CollationRegressionTest::Test4062418(/* char* par */) { UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = NULL; c = (RuleBasedCollator *) Collator::createInstance(Locale::getCanadaFrench(), status); if (c == NULL || U_FAILURE(status)) { errln("Failed to create collator for Locale::getCanadaFrench()"); delete c; return; } c->setStrength(Collator::SECONDARY); /* String[] tests = { "p\u00eache", "<", "p\u00e9ch\u00e9", // Comparing accents from end, p\u00e9ch\u00e9 is greater }; */ static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x70, 0x00EA, 0x63, 0x68, 0x65, 0}, {0x3c, 0}, {0x70, 0x00E9, 0x63, 0x68, 0x00E9, 0} }; compareArray(*c, tests, ARRAY_LENGTH(tests)); delete c; }
// @bug 4132736 // // sort order of french words with multiple accents has errors // void CollationRegressionTest::Test4132736(/* char* par */) { UErrorCode status = U_ZERO_ERROR; Collator *c = NULL; c = Collator::createInstance(Locale::getCanadaFrench(), status); c->setStrength(Collator::TERTIARY); if (c == NULL || U_FAILURE(status)) { errln("Failed to create a collator for Locale::getCanadaFrench()"); delete c; return; } static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x65, 0x0300, 0x65, 0x0301, 0}, {0x3c, 0}, {0x65, 0x0301, 0x65, 0x0300, 0}, {0x65, 0x0300, 0x0301, 0}, {0x3c, 0}, {0x65, 0x0301, 0x0300, 0} }; compareArray(*c, test1, ARRAY_LENGTH(test1)); delete c; }
void testWrite() { m_sink->write(m_bytes, 6); m_sink->close(); LocalDataFileSource* src = new LocalDataFileSource(m_path); CPPUNIT_ASSERT_EQUAL(6, (int) src->getFileSize()); CPPUNIT_ASSERT(compareArray(src->getFileBytes(),m_bytes, 6)); delete src; }
// @bug 4133509 // // The sorting using java.text.CollationKey is not in the exact order // void CollationRegressionTest::Test4133509(/* char* par */) { static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0}, {0x3c, 0}, {0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0}, {0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0}, {0x3c, 0}, {0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0}, {0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0}, {0x3c, 0}, {0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0} }; compareArray(*en_us, test1, ARRAY_LENGTH(test1)); }
// @bug 4087243 // // CollationKey takes ignorable strings into account when it shouldn't // void CollationRegressionTest::Test4087243(/* char* par */) { RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::TERTIARY); static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x31, 0x32, 0x33, 0}, {0x3d, 0}, {0x31, 0x32, 0x33, 0x0001, 0} // 1 2 3 = 1 2 3 ctrl-A }; compareArray(*c, tests, ARRAY_LENGTH(tests)); delete c; }
// @bug 4103436 // // Collator::compare not handling spaces properly // void CollationRegressionTest::Test4103436(/* char* par */) { RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::TERTIARY); static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x66, 0x69, 0x6c, 0x65, 0}, {0x3c, 0}, {0x66, 0x69, 0x6c, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0}, {0x66, 0x69, 0x6c, 0x65, 0}, {0x3c, 0}, {0x66, 0x69, 0x6c, 0x65, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0} }; compareArray(*c, tests, ARRAY_LENGTH(tests)); delete c; }
/** * Odd corner conditions taken from "How to Sort Thai Without Rewriting Sort", * by Doug Cooper, http://seasrc.th.net/paper/thaisort.zip */ void CollationThaiTest::TestCornerCases(void) { const char* TESTS[] = { // Shorter words precede longer "\\u0e01", "<", "\\u0e01\\u0e01", // Tone marks are considered after letters (i.e. are primary ignorable) "\\u0e01\\u0e32", "<", "\\u0e01\\u0e49\\u0e32", // ditto for other over-marks "\\u0e01\\u0e32", "<", "\\u0e01\\u0e32\\u0e4c", // commonly used mark-in-context order. // In effect, marks are sorted after each syllable. "\\u0e01\\u0e32\\u0e01\\u0e49\\u0e32", "<", "\\u0e01\\u0e48\\u0e32\\u0e01\\u0e49\\u0e32", // Hyphens and other punctuation follow whitespace but come before letters "\\u0e01\\u0e32", "=", "\\u0e01\\u0e32-", "\\u0e01\\u0e32-", "<", "\\u0e01\\u0e32\\u0e01\\u0e32", // Doubler follows an indentical word without the doubler "\\u0e01\\u0e32", "=", "\\u0e01\\u0e32\\u0e46", "\\u0e01\\u0e32\\u0e46", "<", "\\u0e01\\u0e32\\u0e01\\u0e32", // \\u0e45 after either \\u0e24 or \\u0e26 is treated as a single // combining character, similar to "c < ch" in traditional spanish. // TODO: beef up this case "\\u0e24\\u0e29\\u0e35", "<", "\\u0e24\\u0e45\\u0e29\\u0e35", "\\u0e26\\u0e29\\u0e35", "<", "\\u0e26\\u0e45\\u0e29\\u0e35", // Vowels reorder, should compare \\u0e2d and \\u0e34 "\\u0e40\\u0e01\\u0e2d", "<", "\\u0e40\\u0e01\\u0e34", // Tones are compared after the rest of the word (e.g. primary ignorable) "\\u0e01\\u0e32\\u0e01\\u0e48\\u0e32", "<", "\\u0e01\\u0e49\\u0e32\\u0e01\\u0e32", // Periods are ignored entirely "\\u0e01.\\u0e01.", "<", "\\u0e01\\u0e32", }; const int32_t TESTS_length = (int32_t)(sizeof(TESTS)/sizeof(TESTS[0])); if (coll == 0) { errln("Error: could not construct Thai collator"); return; } compareArray(*coll, TESTS, TESTS_length); }
// @bug 4054736 // // Full Decomposition mode not implemented // void CollationRegressionTest::Test4054736(/* char* par */) { UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::SECONDARY); c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0xFB4F, 0}, {0x3d, 0}, {0x05D0, 0x05DC} // Alef-Lamed vs. Alef, Lamed }; compareArray(*c, tests, ARRAY_LENGTH(tests)); delete c; }
// @bug 4066696 // // French secondary collation checking at the end of compare iteration fails // void CollationRegressionTest::Test4066696(/* char* par */) { UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = NULL; c = (RuleBasedCollator *)Collator::createInstance(Locale::getCanadaFrench(), status); if (c == NULL || U_FAILURE(status)) { errln("Failure creating collator for Locale::getCanadaFrench()"); delete c; return; } c->setStrength(Collator::SECONDARY); /* String[] tests = { "\u00e0", "<", "\u01fa", // a-grave < A-ring-acute }; should be: String[] tests = { "\u00e0", ">", "\u01fa", // a-grave < A-ring-acute }; */ static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x00E0, 0}, {0x3e, 0}, {0x01FA, 0} }; compareArray(*c, tests, ARRAY_LENGTH(tests)); delete c; }
// @bug 4114076 // // Collation not Unicode conformant with Hangul syllables // void CollationRegressionTest::Test4114076(/* char* par */) { UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::TERTIARY); // // With Canonical decomposition, Hangul syllables should get decomposed // into Jamo, but Jamo characters should not be decomposed into // conjoining Jamo // static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0xd4db, 0}, {0x3d, 0}, {0x1111, 0x1171, 0x11b6, 0} }; c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); compareArray(*c, test1, ARRAY_LENGTH(test1)); // From UTR #15: // *In earlier versions of Unicode, jamo characters like ksf // had compatibility mappings to kf + sf. These mappings were // removed in Unicode 2.1.9 to ensure that Hangul syllables are maintained.) // That is, the following test is obsolete as of 2.1.9 //obsolete- // With Full decomposition, it should go all the way down to //obsolete- // conjoining Jamo characters. //obsolete- // //obsolete- static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] = //obsolete- { //obsolete- {0xd4db, 0}, {0x3d, 0}, {0x1111, 0x116e, 0x1175, 0x11af, 0x11c2, 0} //obsolete- }; //obsolete- //obsolete- c->setDecomposition(Normalizer::DECOMP_COMPAT); //obsolete- compareArray(*c, test2, ARRAY_LENGTH(test2)); delete c; }
// @bug 4054734 // // Collator::IDENTICAL documented but not implemented // void CollationRegressionTest::Test4054734(/* char* par */) { /* Here's the original Java: String[] decomp = { "\u0001", "<", "\u0002", "\u0001", "=", "\u0001", "A\u0001", ">", "~\u0002", // Ensure A and ~ are not compared bitwise "\u00C0", "=", "A\u0300" // Decomp should make these equal }; String[] nodecomp = { "\u00C0", ">", "A\u0300" // A-grave vs. A combining-grave }; */ static const UChar decomp[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x0001, 0}, {0x3c, 0}, {0x0002, 0}, {0x0001, 0}, {0x3d, 0}, {0x0001, 0}, {0x41, 0x0001, 0}, {0x3e, 0}, {0x7e, 0x0002, 0}, {0x00c0, 0}, {0x3d, 0}, {0x41, 0x0300, 0} }; UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::IDENTICAL); c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); compareArray(*c, decomp, ARRAY_LENGTH(decomp)); delete c; }
void CollationThaiTest::TestReordering(void) { // Until UCA 4.1, the collation code swapped Thai/Lao prevowels with the following consonants, // resulting in consonant+prevowel == prevowel+consonant. // From UCA 5.0 on, there are order-reversing contractions for prevowel+consonant. // From UCA 5.0 until UCA 6.1, there was a tertiary difference between // consonant+prevowel and prevowel+consonant. // In UCA 6.2, they compare equal again. // The test was modified to using a collator with strength=secondary, // ignoring possible tertiary differences. const char *tests[] = { "\\u0E41c\\u0301", "=", "\\u0E41\\u0107", // composition "\\u0E41\\U0001D7CE", "<", "\\u0E41\\U0001D7CF", // supplementaries "\\u0E41\\U0001D15F", "=", "\\u0E41\\U0001D158\\U0001D165", // supplementary composition decomps to supplementary "\\u0E41\\U0002F802", "=", "\\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\\U0001D000", "<", "abc\\u0E41\\U0001D001", // supplementaries "abc\\u0E41\\U0001D15F", "=", "abc\\u0E41\\U0001D158\\U0001D165", // supplementary composition decomps to supplementary "abc\\u0E41\\U0002F802", "=", "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\\U0001D000abc", "<", "\\u0E41\\U0001D001abc", // supplementaries "\\u0E41\\U0001D15Fabc", "=", "\\u0E41\\U0001D158\\U0001D165abc", // supplementary composition decomps to supplementary "\\u0E41\\U0002F802abc", "=", "\\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\\U0001D000abc", "<", "abc\\u0E41\\U0001D001abc", // supplementaries "abc\\u0E41\\U0001D15Fabc", "=", "abc\\u0E41\\U0001D158\\U0001D165abc", // supplementary composition decomps to supplementary "abc\\u0E41\\U0002F802abc", "=", "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", }; LocalPointer<Collator> coll2(coll->clone()); UErrorCode status = U_ZERO_ERROR; coll2->setAttribute(UCOL_STRENGTH, UCOL_SECONDARY, status); if(U_FAILURE(status)) { errln("Unable to set the Thai collator clone to secondary strength"); return; } compareArray(*coll2, tests, sizeof(tests)/sizeof(tests[0])); const char *rule = "& c < ab"; const char *testcontraction[] = { "\\u0E41ab", ">", "\\u0E41c"}; // After UCA 4.1 Thai are normal so won't break a contraction UnicodeString rules; parseChars(rules, rule); LocalPointer<RuleBasedCollator> rcoll(new RuleBasedCollator(rules, status)); if(U_SUCCESS(status)) { compareArray(*rcoll, testcontraction, 3); } else { errln("Couldn't instantiate collator from rules"); } }
int main() { //Obtaining the path of main.c *getcwd(directoryPath,300); strcpy(rootPath,directoryPath); //Setting the initial directories rootDirectory = opendir(directoryPath); currentDirectory = rootDirectory; int c = 1; char d ='\0'; char l[250]; Word Words[30]; printf("[TuriShell]"); while(c!=0) { int i=0; int j=0; while((l[0]=getchar())!='\n') { if(l[0]!=' ') { Words[j].c[i]=l[0]; i++; } else { j++; i=0; } } /*if(l[0]=='\377') { printf("LOOOL"); }*/ if(compareArray(&Words[0].c,&"cd",2)==1) { if(Words[1].c[0]=='\000') { currentDirectory = rootDirectory; strcpy(directoryPath,rootPath); puts(directoryPath); } else { cdFunction(&Words[1].c); } } if(compareArray(&Words[0].c,&"ls",2)==1) { lsFunction(); } if(compareArray(&Words[0].c,&"clear",5)==1) { system("clear"); } if(compareArray(&Words[0].c,&"exit",4)==1) { return 0; } if(Words[0].c[0]=='.'&&Words[0].c[1]=='/') { executeProgram(&Words[0].c[1]); } if(l[0]=='\n') { printf("[TuriShell]"); } else { printf("Comando no reconocido"); printf("[TuriShell]"); } //reset the commands array int b =0; for(;b<30;b++) { int p=0; for(;p<250;p++) { Words[b].c[p]='\000'; } } } return 0; }
// @bug 4060154 // // MergeCollation::fixEntry broken for "& H < \u0131, \u0130, i, I" // void CollationRegressionTest::Test4060154(/* char* par */) { UErrorCode status = U_ZERO_ERROR; UnicodeString rules; rules += "&f < g, G < h, H < i, I < j, J"; rules += " & H < "; rules += (UChar)0x0131; rules += ", "; rules += (UChar)0x0130; rules += ", i, I"; RuleBasedCollator *c = NULL; c = new RuleBasedCollator(rules, status); if (c == NULL || U_FAILURE(status)) { errln("failure building collator."); delete c; return; } c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); /* String[] tertiary = { "A", "<", "B", "H", "<", "\u0131", "H", "<", "I", "\u0131", "<", "\u0130", "\u0130", "<", "i", "\u0130", ">", "H", }; */ static const UChar tertiary[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x41, 0}, {0x3c, 0}, {0x42, 0}, {0x48, 0}, {0x3c, 0}, {0x0131, 0}, {0x48, 0}, {0x3c, 0}, {0x49, 0}, {0x0131, 0}, {0x3c, 0}, {0x0130, 0}, {0x0130, 0}, {0x3c, 0}, {0x69, 0}, {0x0130, 0}, {0x3e, 0}, {0x48, 0} }; c->setStrength(Collator::TERTIARY); compareArray(*c, tertiary, ARRAY_LENGTH(tertiary)); /* String[] secondary = { "H", "<", "I", "\u0131", "=", "\u0130", }; */ static const UChar secondary[][CollationRegressionTest::MAX_TOKEN_LEN] = { {0x48, 0}, {0x3c, 0}, {0x49, 0}, {0x0131, 0}, {0x3d, 0}, {0x0130, 0} }; c->setStrength(Collator::PRIMARY); compareArray(*c, secondary, ARRAY_LENGTH(secondary)); delete c; }
void checkSendMessage() { if ((compareArray(addressbit, myAddressbit, 8) == 1) || (compareArray(addressbit, publicAddressbit, 8) == 1)) runCommand(); resetListening(); }