summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2020-02-18 15:14:39 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2020-02-18 15:14:39 +0000
commit7b7d222ce502b9412f6faef230a2437cc669d742 (patch)
tree5bbce4e40f772b86db9ffdfbf83b536a66af1f11 /document
parent3a31bbacf009d3b260ad134304a94a007fff743b (diff)
Add non-commutative operator tests to C++ implementation
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/documentselectparsertest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp
index c1e5fbecd14..6d446f6f1d7 100644
--- a/document/src/tests/documentselectparsertest.cpp
+++ b/document/src/tests/documentselectparsertest.cpp
@@ -551,6 +551,22 @@ TEST_F(DocumentSelectParserTest, operators_0)
PARSE("30 = 30", *_doc[0], True);
}
+TEST_F(DocumentSelectParserTest, using_non_commutative_comparison_operator_with_field_value_is_well_defined) {
+ auto doc = createDoc("testdoctype1", "id:foo:testdoctype1::bar", 24, 0.0, "foo", "bar", 0);
+ // Document's `headerval` field has value of 24.
+ PARSE("25 <= testdoctype1.headerval", *doc, False);
+ PARSE("24 <= testdoctype1.headerval", *doc, True);
+ PARSE("25 > testdoctype1.headerval", *doc, True);
+ PARSE("24 > testdoctype1.headerval", *doc, False);
+ PARSE("24 >= testdoctype1.headerval", *doc, True);
+
+ PARSE("testdoctype1.headerval <= 23", *doc, False);
+ PARSE("testdoctype1.headerval <= 24", *doc, True);
+ PARSE("testdoctype1.headerval > 23", *doc, True);
+ PARSE("testdoctype1.headerval > 24", *doc, False);
+ PARSE("testdoctype1.headerval >= 24", *doc, True);
+}
+
TEST_F(DocumentSelectParserTest, regex_matching_does_not_bind_anchors_to_newlines) {
createDocs();