Commit 9bcf907c authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Add support for floats

parent efc4154b
......@@ -30,16 +30,30 @@ logexpect l1 -d 1 -g vxid -q "ReqProtocol ne 'HTTP/1.0'" {
expect * = End
} -run
# Test '==' operator
# Test '==' operator on integers
logexpect l1 -d 1 -g vxid -q "RespStatus == 200" {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
# Test '!=' operator
# Test '==' operator on floats
logexpect l1 -d 1 -g vxid -q "RespStatus == 200." {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
# Test '!=' operator on integers
logexpect l1 -d 1 -g vxid -q "RespStatus != 503" {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
# Test '!=' operator on floats
logexpect l1 -d 1 -g vxid -q "RespStatus != 503." {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
......@@ -60,6 +60,7 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
int reclen;
const char *recdata;
long long recint;
double recfloat;
char *endptr;
AN(vex);
......@@ -86,6 +87,12 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
break;
/* Can't parse - no match */
return (0);
case VEX_FLOAT:
recfloat = strtod(recdata, &endptr);
if (*endptr == '\0' || isspace(*endptr))
break;
/* Can't parse - no match */
return (0);
default:
INCOMPL();
}
......@@ -100,8 +107,12 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
if (val->val_int == recint)
return (1);
return (0);
case VEX_FLOAT:
if (val->val_float == recfloat)
return (1);
return (0);
default:
INCOMPL();
WRONG("Wrong value type");
}
case T_NEQ: /* != */
switch (val->type) {
......@@ -109,8 +120,12 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
if (val->val_int != recint)
return (1);
return (0);
case VEX_FLOAT:
if (val->val_float != recfloat)
return (1);
return (0);
default:
INCOMPL();
WRONG("Wrong value type");
}
case T_SEQ: /* eq */
assert(val->type == VEX_STRING);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment