E9 operator_equal

- Fixed broken logic in operator_equal.
- Fixed typos in op_and.t unit test.
- Fixed descriptions in op_or.t.
This commit is contained in:
Paul Beckingham 2011-08-21 18:38:04 -04:00
parent e0ecb7a2d8
commit 7a778ba317
3 changed files with 26 additions and 33 deletions

View file

@ -457,25 +457,24 @@ void E9::operator_equal (
result._value = "false";
result._type = Arg::type_bool;
// 'project' and 'recur' attributes are matched leftmost.
if (left._raw == "project" || left._raw == "recur")
// 'project' is matched leftmost.
if (left._raw == "project")
{
coerce (left, Arg::type_string);
coerce (right, Arg::type_string);
if (right._value.length () <= left._value.length () &&
compare (right._value,
left._value.substr (0, right._value.length ()),
int right_len = right._value.length ();
if (compare (right._value,
(right_len < left._value.length ()
? left._value.substr (0, right_len)
: left._value),
case_sensitive))
{
result._raw = "true";
result._value = "true";
}
}
// Dates. Note that missing data causes processing to transfer to the generic
// string comparison below.
else if ((left._type == Arg::type_date ||
right._type == Arg::type_date) &&
right._type == Arg::type_date) &&
left._value != "" &&
right._value != "")
{
@ -493,12 +492,6 @@ void E9::operator_equal (
result._value = compare (left._value, right._value, case_sensitive)
? "true"
: "false";
if (left._value == right._value)
{
result._value = "true";
result._type = Arg::type_bool;
}
}
// std::cout << "# " << left << " <operator_equal> " << right << " --> " << result << "\n";