@Test
    public void testOperators() throws ParseException {
        List<DocumentPut> documents = createDocs();

        // Check that comparison operators work.
        assertEquals(Result.TRUE, evaluate("", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("30 < 10", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("10 < 30", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("30 < 10", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("10 < 30", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("30 <= 10", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("10 <= 30", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 <= 30", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("10 >= 30", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 >= 10", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 >= 30", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("10 > 30", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 > 10", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("30 == 10", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 == 30", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 != 10", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("30 != 30", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"foo\" != \"bar\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("\"foo\" != \"foo\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("'foo' == \"bar\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("'foo' == \"foo\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("\"bar\" = \"a\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"bar\" = \"*a*\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("\"bar\" = \"\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"\" = \"\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("\"bar\" =~ \"^a$\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"bar\" =~ \"a\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"bar\" =~ \"\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"\" =~ \"\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("30 = 10", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 = 30", documents.get(0)));

        // Mix of types should within numbers, but otherwise not match
        assertEquals(Result.FALSE, evaluate("30 < 10.2", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("10.2 < 30", documents.get(0)));
        assertEquals(Result.INVALID, evaluate("30 < \"foo\"", documents.get(0)));
        assertEquals(Result.INVALID, evaluate("30 > \"foo\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("30 != \"foo\"", documents.get(0)));
        assertEquals(Result.INVALID, evaluate("14.2 <= \"foo\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("null == null", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("null = null", documents.get(0))); // Glob operator falls back to == comparison
        assertEquals(Result.FALSE, evaluate("null != null", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("\"bar\" == null", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("null == \"bar\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("14.3 == null", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("null = 0", documents.get(0)));

        // Boolean literals in comparisons
        assertEquals(Result.TRUE, evaluate("true = true", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("true == true", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("true == false", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("false == false", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("true == 1", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("true == 0", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("false == 1", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("false == 0", documents.get(0)));

        // Field values
        assertEquals(Result.TRUE, evaluate("test.hint = 24", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.hint = 24", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.hint = 13", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.hint = 13", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.hfloat = 2.0", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.hfloat = 1.0", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.hfloat = 4.1", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.hfloat > 4.09 and test.hfloat < 4.11", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.content = \"bar\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.content = \"bar\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.content = \"foo\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.content = \"foo\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.hstring == test.content", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.hstring == test.content", documents.get(2)));
        assertEquals(Result.TRUE, evaluate("test.hint + 1 > 13", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.content = \"&\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.content = \"&\"", documents.get(7)));
        // Case where field is not present (i.e. null) is defined for (in)equality comparisons, but
        // not for other relations.
        DocumentPut doc1234 = documents.get(6);
        assertEquals(Result.TRUE, evaluate("test.hint != 1234", doc1234));
        assertEquals(Result.FALSE, evaluate("test.hint == 1234", doc1234));
        assertEquals(Result.INVALID, evaluate("test.hint < 1234", doc1234));
        // Propagation of Invalid through logical operators should match C++ implementation
        assertEquals(Result.FALSE, evaluate("test.hint < 1234 and false", doc1234));
        assertEquals(Result.INVALID, evaluate("test.hint < 1234 and true", doc1234));
        assertEquals(Result.TRUE, evaluate("test.hint < 1234 or true", doc1234));
        assertEquals(Result.INVALID, evaluate("test.hint < 1234 or false", doc1234));
        // Must be possible to predicate a sub-expression on the presence of a field without
        // propagating up an Invalid value from the comparison.
        assertEquals(Result.FALSE, evaluate("test.hint and test.hint < 1234", doc1234));
        assertEquals(Result.FALSE, evaluate("test.hint != null and test.hint < 1234", doc1234));

        // Document types.
        assertEquals(Result.TRUE, evaluate("test", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("nonexisting", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("nonexisting.reallynonexisting", documents.get(0)));
        assertEquals(Result.INVALID, evaluate("nonexisting.reallynonexisting > 13", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("true.foo", documents.get(0)));

        // Field existence
        assertEquals(Result.TRUE, evaluate("test.hint", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.hstring", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.hint", doc1234));
        assertEquals(Result.FALSE, evaluate("test.hstring", doc1234));
        assertEquals(Result.TRUE, evaluate("not test.hint", doc1234));
        assertEquals(Result.TRUE, evaluate("not test.hstring", doc1234));

        assertEquals(Result.TRUE, evaluate("test.hint != null", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("null != test.hint", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.hint == null", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("null == test.hint", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("null == test.hint", doc1234));
        assertEquals(Result.TRUE, evaluate("test.hint == null", doc1234));
        assertEquals(Result.FALSE, evaluate("test.hint != null", doc1234));
        assertEquals(Result.FALSE, evaluate("null != test.hint", doc1234));

        assertEquals(Result.TRUE, evaluate("test.hint or true", doc1234));
        assertEquals(Result.TRUE, evaluate("not test.hint and true", doc1234));
        assertEquals(Result.FALSE, evaluate("not test.hint and false", doc1234));

        // Id values.
        assertEquals(Result.TRUE, evaluate("id == \"id:myspace:test::anything\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate(" iD==  \"id:myspace:test::anything\"  ", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("id == \"id:myspa:test::nything\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("Id.scHeme == \"xyz\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("id.scheme == \"id\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("id.type == \"test\"", documents.get(4)));
        assertEquals(Result.FALSE, evaluate("id.type == \"wrong\"", documents.get(4)));
        assertEquals(Result.TRUE, evaluate("Id.namespaCe == \"myspace\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("id.NaMespace == \"pace\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("id.specific == \"anything\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("id.user=1234", documents.get(2)));
        assertEquals(Result.TRUE, evaluate("id.user=2345", documents.get(4)));
        assertEquals(Result.TRUE, evaluate("id.group=\"mygroup\"", documents.get(5)));

        assertError("id.user == 1234", documents.get(0), "User identifier is null.");
        assertError("id.group == 1234", documents.get(3), "Group identifier is null.");
        assertError("id.group == \"yahoo\"", documents.get(3), "Group identifier is null.");

        // Branch operators.
        assertEquals(Result.FALSE, evaluate("true and false", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("true and true", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("true or false", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("false or false", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("false and true or true and true", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("false or true and true or false", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("not false", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("not true", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("true and not false or false", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("((243 < 300) and (\"FOO\".lowercase() == \"foo\"))", documents.get(0)));

        // Invalid branching. test.content = 1 is invalid.
        assertEquals(Result.FALSE, evaluate("test.content = 1 and true", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.content = 1 or true", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.content = 1 and false", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.content = 1 or false", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("true and test.content = 1", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("true or test.content = 1", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("false and test.content = 1", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("false or test.content = 1", documents.get(0)));

        // Functions.
        assertEquals(Result.FALSE, evaluate("test.hstring.lowercase() == \"Yet\"", documents.get(3)));
        assertEquals(Result.TRUE, evaluate("test.hstring.lowercase() == \"yet\"", documents.get(3)));
        assertEquals(Result.FALSE, evaluate("test.hfloat.lowercase() == \"yet\"", documents.get(3)));
        assertEquals(Result.TRUE, evaluate("\"bar\".hash() == -270124981", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"bar\".hash().abs() == 270124981", documents.get(0)));
        assertError("null.hash() == 22460089", documents.get(0), "Can not invoke 'hash()' on 'null' because that term evaluated to null");
        assertEquals(Result.FALSE, evaluate("(0.234).hash() == 123", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("(0.234).lowercase() == 123", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("\"foo\".hash() == 123", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("(234).hash() == 123", documents.get(0)));
        // Arithmetics
        assertEquals(Result.TRUE, evaluate("id.specific.hash() = 596580044", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("id.specific.hash() % 10 = 4", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("id.specific.hash() % 10 = 2", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("\"foo\" + \"bar\" = \"foobar\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("\"foo\" + 4 = 25", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("34.0 % 4 = 4", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("-6 % 10 = -6", documents.get(0)));

        // Test now(). Assumes that now() is never 0
        assertEquals(Result.FALSE, evaluate("0 > now()", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("0 < now()", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("0 < now() - 10", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("now() - 20 < now() - 10", documents.get(0)));
        long secondsNow = System.currentTimeMillis() / 1000;
        assertEquals(Result.TRUE, evaluate("now() - " + secondsNow + " < 2", documents.get(0)));

        // Structs and arrays
        // Commented out tests work in C++.. Don't want to start altering
        // java code before talking to Simon.. Leaving it as is, as the
        // needed functionality of testing for existance already works.
        assertEquals(Result.FALSE, evaluate("test.mystruct", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.mystruct", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mystruct", documents.get(2)));
        assertEquals(Result.TRUE, evaluate("test.mystruct == test.mystruct", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.mystruct == test.mystruct", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mystruct != test.mystruct", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.mystruct != test.mystruct", documents.get(1)));
        assertEquals(Result.INVALID, evaluate("test.mystruct < test.mystruct", documents.get(0)));
        //assertEquals(Result.FALSE, evaluate("test.mystruct < test.mystruct", documents.get(1)));
        //assertEquals(Result.INVALID, evaluate("test.mystruct < 5", documents.get(1)));
        //assertEquals(Result.INVALID, evaluate("test.mystruct == \"foo\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarray", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.structarray", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarray", documents.get(2)));
        assertEquals(Result.TRUE, evaluate("test.structarray == test.structarray", documents.get(0)));
        //assertEquals(Result.INVALID, evaluate("test.structarray < test.structarray", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.structarray == test.structarray", documents.get(1)));
        //assertEquals(Result.FALSE, evaluate("test.structarray < test.structarray", documents.get(1)));

        assertEquals(Result.FALSE, evaluate("test.structarray.key == 15", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.structarray[4].key == 15", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.structarray", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.structarray.key == 15", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.structarray[1].key == 16", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.structarray[1].key = 16", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarray.value == \"structval1\"", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.structarray[4].value == \"structval1\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.structarray.value == \"structval1\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.structarray[0].value == \"structval1\"", documents.get(1)));
        // Globbing of array-of-struct fields
        assertEquals(Result.FALSE, evaluate("test.structarray.key = 15", documents.get(0))); // Fallback
        assertEquals(Result.FALSE, evaluate("test.structarray.key = 15", documents.get(2))); // Fallback
        assertEquals(Result.TRUE, evaluate("test.structarray.key = 15", documents.get(1))); // Fallback
        assertEquals(Result.FALSE, evaluate("test.structarray.value = \"structval2\"", documents.get(2)));
        assertEquals(Result.TRUE, evaluate("test.structarray.value = \"*ctval*\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.structarray[1].value = \"structval2\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarray[1].value = \"batman\"", documents.get(1)));
        // Regexp of array-of-struct fields
        assertEquals(Result.TRUE, evaluate("test.structarray.value =~ \"structval[1-9]\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarray.value =~ \"structval[a-z]\"", documents.get(1)));
        // Globbing/regexp of struct fields
        assertEquals(Result.FALSE, evaluate("test.mystruct.value = \"struc?val\"", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.mystruct.value = \"struc?val\"", documents.get(1)));
        assertEquals(Result.INVALID, evaluate("test.mystruct.value =~ \"struct.*\"", documents.get(0))); // Invalid since lhs is null
        assertEquals(Result.TRUE, evaluate("test.mystruct.value =~ \"struct.*\"", documents.get(1)));

        assertEquals(Result.FALSE, evaluate("test.intarray < 5", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.intarray < 5", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.intarray > 80", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.intarray > 80", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.intarray >= 84", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.intarray <= 3", documents.get(1)));

        // Interesting property ...
        assertEquals(Result.TRUE, evaluate("test.intarray == 84", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.intarray != 84", documents.get(0)));

        assertEquals(Result.TRUE, evaluate("test.structarray[$x].key == 15 AND test.structarray[$x].value == \"structval1\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarray[$x].key == 15 AND test.structarray[$x].value == \"structval2\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.structarray[$x].key == 15 AND test.structarray[$y].value == \"structval2\"", documents.get(1)));

        assertEquals(Result.FALSE, evaluate("test.mymap", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("test.mymap", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.mymap{3}", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap{9}", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.mymap{3} == \"a\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap{3} == \"b\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap{9} == \"b\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap == \"a\"", documents.get(1))); // Keys only
        assertEquals(Result.TRUE, evaluate("test.mymap{3} = \"a\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap{3} = \"b\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.mymap{3} =~ \"a\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap{3} =~ \"b\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.mymap.value = \"a\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap.value = \"d\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.mymap.value =~ \"a\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap.value =~ \"d\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.mymap == 3", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.mymap == 4", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.mymap = 3", documents.get(1))); // Fallback to ==
        assertEquals(Result.FALSE, evaluate("test.mymap = 4", documents.get(1))); // Fallback to ==

        assertEquals(Result.TRUE, evaluate("test.structarrmap{$x}[$y].key == 15 AND test.structarrmap{$x}[$y].value == \"structval1\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.structarrmap.value[$y].key == 15 AND test.structarrmap.value[$y].value == \"structval1\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarrmap{$x}[$y].key == 15 AND test.structarrmap{$x}[$y].value == \"structval2\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarrmap.value[$y].key == 15 AND test.structarrmap.value[$y].value == \"structval2\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarrmap{$x}[$y].key == 15 AND test.structarrmap{$y}[$x].value == \"structval2\"", documents.get(1)));

        assertEquals(Result.TRUE, evaluate("test.stringweightedset", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.stringweightedset{val1}", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.stringweightedset{val1} == 1", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.stringweightedset{val1} == 2", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.stringweightedset == \"val1\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.stringweightedset = \"val*\"", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.stringweightedset =~ \"val[0-9]\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.stringweightedset == \"val5\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.stringweightedset = \"val5\"", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.stringweightedset =~ \"val5\"", documents.get(1)));

        assertEquals(Result.TRUE, evaluate("test.structarrmap{$x}.key == 15 AND test.stringweightedset{$x}", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.structarrmap{$x}.key == 17 AND test.stringweightedset{$x}", documents.get(1)));
    }
@author Simon Thoresen Hult
@author bratseth
document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java