SimpleTest:assertWithinMargin() and assertOutsideMargin()

ztyx - November 16, 2008 - 11:08
Project:Drupal
Version:7.x-dev
Component:simpletest.module
Category:feature request
Priority:normal
Assigned:boombatower
Status:needs work
Issue tags:Needs tests
Description

The original SimpleTest package contains the functions assertWithinMargin() and assertOutsideMargin(). Both of these are very handy when you are working with floating point numbers that cannot be compared for equality (because of numerical errors).

I am attaching a patch that adds these two functions to the DrupalTestCase.

Also, can these be easily merged into Drupal 7?

AttachmentSize
drupal_web_test_case.margin-tests.patch2.68 KB
Testbed results
drupal_web_test_case.margin-tests.patchfailedFailed: Failed to apply patch. Detailed results

#1

ztyx - November 16, 2008 - 11:16

Oh, I meant DrupalWebTestCase of course...

#2

boombatower - November 16, 2008 - 19:35
Project:SimpleTest» Drupal
Version:6.x-2.5» 7.x-dev
Component:Code» simpletest.module
Status:active» needs review

This should be done in D7 and then backported.

#3

System Message - November 16, 2008 - 19:55
Status:needs review» needs work

The last submitted patch failed testing.

#4

lilou - November 17, 2008 - 13:12

#5

System Message - November 17, 2008 - 21:30
Status:needs review» needs work

The last submitted patch failed testing.

#6

lilou - November 17, 2008 - 21:51
Status:needs work» needs review

Reroll from root directory.

AttachmentSize
issue-334950-6.patch 2.73 KB
Testbed results
issue-334950-6.patchfailedFailed: Failed to install HEAD. Detailed results

#7

catch - November 20, 2008 - 22:07

Are there existing use cases for these in core? Would be nice to use them if possible.

#8

catch - January 22, 2009 - 00:38
Status:needs review» needs work

I think we should have some basic tests for these in simpletest.test

#9

Dave Reid - January 22, 2009 - 03:04

#10

boombatower - April 28, 2009 - 03:36
Title:assertWithinMargin() and assertOutsideMargin()» SimpleTest:assertWithinMargin() and assertOutsideMargin()
Assigned to:Anonymous» boombatower
Status:needs work» needs review
  • More detailed default messages.
  • Changed _assert() to assert().
  • Added test as requested.

In the future I will work on a cleaner/scalable way to test all the DrupalWebTestCase assertions.

AttachmentSize
334950-assert-margin.patch 5.12 KB
Testbed results
334950-assert-margin.patchfailedFailed: Failed to run tests. Detailed results

#11

catch - May 8, 2009 - 16:24
Status:needs review» reviewed & tested by the community

Looks good.

#12

Dries - May 8, 2009 - 21:47

I agree that it would be good to have some use cases in core. Can't think of any.

#13

System Message - June 13, 2009 - 20:55
Status:reviewed & tested by the community» needs work

The last submitted patch failed testing.

#14

lilou - June 14, 2009 - 19:31
Status:needs work» reviewed & tested by the community

Reroll from HEAD.

Back to previous status.

AttachmentSize
issue-334950.patch 5.38 KB
Testbed results
issue-334950.patchfailedFailed: Failed to install HEAD. Detailed results

#15

System Message - June 30, 2009 - 10:15
Status:reviewed & tested by the community» needs work

The last submitted patch failed testing.

#16

boombatower - July 7, 2009 - 04:12
Status:needs work» needs review

teh bot?

#17

arianek - July 30, 2009 - 23:15

applied patch to D7 HEAD:
Hunk #1 succeeded at 336 (offset 40 lines).

re-rolled for bot.

AttachmentSize
issue-334950.patch 5.31 KB
Testbed results
issue-334950.patchfailedFailed: 12050 passes, 0 fails, 2 exceptions Detailed results

#18

System Message - August 9, 2009 - 01:27
Status:needs review» needs work

The last submitted patch failed testing.

 
 

Drupal is a registered trademark of Dries Buytaert.