]> granicus.if.org Git - icu/commitdiff
ICU-9959 test that RBC forbids rules with a before-reset followed by a stronger relation
authorMarkus Scherer <markus.icu@gmail.com>
Fri, 28 Feb 2014 20:15:58 +0000 (20:15 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Fri, 28 Feb 2014 20:15:58 +0000 (20:15 +0000)
X-SVN-Rev: 35263

icu4c/source/test/intltest/regcoll.cpp
icu4c/source/test/intltest/regcoll.h

index 1f732aea8077f9e0644da66f55bdf0d3bf9b72e4..0cc127e704a81ee38a0d16906e2f912e0f7a6777 100644 (file)
@@ -1317,6 +1317,24 @@ void CollationRegressionTest::TestTrailingComment() {
     assertTrue("b<a", coll.compare(b, a) < 0);
 }
 
+void CollationRegressionTest::TestBeforeWithTooStrongAfter() {
+    // ICU ticket #9959:
+    // Forbid rules with a before-reset followed by a stronger relation.
+    IcuTestErrorCode errorCode(*this, "TestBeforeWithTooStrongAfter");
+    RuleBasedCollator before2(UNICODE_STRING_SIMPLE("&[before 2]x<<q<p"), errorCode);
+    if(errorCode.isSuccess()) {
+        errln("should forbid before-2-reset followed by primary relation");
+    } else {
+        errorCode.reset();
+    }
+    RuleBasedCollator before3(UNICODE_STRING_SIMPLE("&[before 3]x<<<q<<s<p"), errorCode);
+    if(errorCode.isSuccess()) {
+        errln("should forbid before-3-reset followed by primary or secondary relation");
+    } else {
+        errorCode.reset();
+    }
+}
+
 void CollationRegressionTest::compareArray(Collator &c,
                                            const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN],
                                            int32_t testCount)
@@ -1455,6 +1473,7 @@ void CollationRegressionTest::runIndexedTest(int32_t index, UBool exec, const ch
     TESTCASE_AUTO(TestT7189);
     TESTCASE_AUTO(TestCaseFirstCompression);
     TESTCASE_AUTO(TestTrailingComment);
+    TESTCASE_AUTO(TestBeforeWithTooStrongAfter);
     TESTCASE_AUTO_END;
 }
 
index 91b2a90dcbb2ef3dbc264a27926841585448d586..510707126b397216166b3178a09f2b259bd6327b 100644 (file)
@@ -239,6 +239,7 @@ public:
     void TestCaseFirstCompression();
 
     void TestTrailingComment();
+    void TestBeforeWithTooStrongAfter();
 
 private:
     //------------------------------------------------------------------------