Commit dc1059da authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a rudimentary number comparison feature, to avoid failures like:

	---- c1   11.6 EXPECT resp.http.ageB (11.867) >= "8.000" failed
parent 2685b989
......@@ -36,9 +36,9 @@ client c1 {
expect resp.bodylen == 40
expect resp.http.fooA == 19.000
expect resp.http.fooB == 10.000
expect resp.http.foo <= 8.000
expect resp.http.foo .LE. 8.000
expect resp.http.ageA == 4.000
expect resp.http.ageB >= 6.000
expect resp.http.ageB .GE. 6.000
delay 2
txreq
......@@ -46,7 +46,7 @@ client c1 {
expect resp.bodylen == 40
expect resp.http.fooA == 19.000
expect resp.http.fooB == 10.000
expect resp.http.foo <= 6.000
expect resp.http.foo .LE. 6.000
expect resp.http.ageA == 4.000
expect resp.http.ageB >= 8.000
expect resp.http.ageB .GE. 8.000
} -run
......@@ -279,6 +279,14 @@ cmd_http_expect(CMD_ARGS)
retval = strcmp(lhs, rhs) >= 0;
} else if (!strcmp(cmp, ">")) {
retval = strcmp(lhs, rhs) > 0;
} else if (!strcmp(cmp, ".LT.")) {
retval = strtod(lhs, NULL) < strtod(rhs, NULL);
} else if (!strcmp(cmp, ".GT.")) {
retval = strtod(lhs, NULL) > strtod(rhs, NULL);
} else if (!strcmp(cmp, ".LE.")) {
retval = strtod(lhs, NULL) <= strtod(rhs, NULL);
} else if (!strcmp(cmp, ".GE.")) {
retval = strtod(lhs, NULL) >= strtod(rhs, NULL);
}
if (retval == -1)
......
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