diff options
author | Josh Micich <josh@apache.org> | 2009-01-27 19:02:13 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2009-01-27 19:02:13 +0000 |
commit | 7aa965d079344d296edb339a77bbf2f9a6ce1fb8 (patch) | |
tree | da9761fe1efc4fa4e200b9d512994617c84da83c /src/testcases | |
parent | ed4b7878bb7ea5552f9a53feef7664fcd6a2ba91 (diff) | |
download | poi-7aa965d079344d296edb339a77bbf2f9a6ce1fb8.tar.gz poi-7aa965d079344d296edb339a77bbf2f9a6ce1fb8.zip |
Fix for bug 46613 - evaluator should perform case insensitive string comparisons
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@738188 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/record/formula/eval/TestEqualEval.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/formula/eval/TestEqualEval.java b/src/testcases/org/apache/poi/hssf/record/formula/eval/TestEqualEval.java index d1b1db0d16..92f603923c 100644 --- a/src/testcases/org/apache/poi/hssf/record/formula/eval/TestEqualEval.java +++ b/src/testcases/org/apache/poi/hssf/record/formula/eval/TestEqualEval.java @@ -23,7 +23,7 @@ import junit.framework.TestCase; import org.apache.poi.hssf.record.formula.functions.EvalFactory;
/**
- * Test for unary plus operator evaluator.
+ * Test for {@link EqualEval}
*
* @author Josh Micich
*/
@@ -66,4 +66,29 @@ public final class TestEqualEval extends TestCase { }
assertTrue(be.getBooleanValue());
}
+
+ /**
+ * Test for bug 46613 (observable at svn r737248)
+ */
+ public void testStringInsensitive_bug46613() {
+ if (!evalStringCmp("abc", "aBc", EqualEval.instance)) {
+ throw new AssertionFailedError("Identified bug 46613");
+ }
+ assertTrue(evalStringCmp("abc", "aBc", EqualEval.instance));
+ assertTrue(evalStringCmp("ABC", "azz", LessThanEval.instance));
+ assertTrue(evalStringCmp("abc", "AZZ", LessThanEval.instance));
+ assertTrue(evalStringCmp("ABC", "aaa", GreaterThanEval.instance));
+ assertTrue(evalStringCmp("abc", "AAA", GreaterThanEval.instance));
+ }
+
+ private static boolean evalStringCmp(String a, String b, OperationEval cmpOp) {
+ Eval[] args = {
+ new StringEval(a),
+ new StringEval(b),
+ };
+ Eval result = cmpOp.evaluate(args, 10, (short)20);
+ assertEquals(BoolEval.class, result.getClass());
+ BoolEval be = (BoolEval) result;
+ return be.getBooleanValue();
+ }
}
|