Closed
Bug 937678
Opened 12 years ago
Closed 12 years ago
Add isfuzzy to mochitest framework
Categories
(Testing :: Mochitest, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla28
People
(Reporter: bas.schouten, Assigned: bas.schouten)
References
Details
Attachments
(1 file, 1 obsolete file)
|
1.62 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
It would be useful to be able to do a fuzzy comparison using the mochitest framework, this would floating point comparisons to be done with an epsilon more easily.
| Assignee | ||
Comment 1•12 years ago
|
||
Attachment #830887 -
Flags: review?(jmaher)
Comment 2•12 years ago
|
||
Comment on attachment 830887 [details] [diff] [review]
Add an isfuzzy comparison function to mochitest
Review of attachment 830887 [details] [diff] [review]:
-----------------------------------------------------------------
simple!
::: testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ +246,5 @@
> };
>
> +SimpleTest.isfuzzy = function (a, b, epsilon, name) {
> + var pass = (a > b - epsilon) && (a < b + epsilon);
> + var diag = pass ? "" : "got " + repr(a) + ", expected " + repr(b) + " epsilon: " + repr(epsilon)
could we add a +- to the epsilon text?
Attachment #830887 -
Flags: review?(jmaher) → review+
| Assignee | ||
Comment 3•12 years ago
|
||
Addressed review comment and added the required global. Carrying r+.
Attachment #830887 -
Attachment is obsolete: true
Attachment #831156 -
Flags: review+
Comment 4•12 years ago
|
||
Comment 5•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
You need to log in
before you can comment on or make changes to this bug.
Description
•