Bugs: Browse | Submit New | Admin

[#15695] Bogus Mutation Error Report

Date:
2007-11-17 06:09
Priority:
3
Submitted By:
Austin Ziegler (austin)
Assigned To:
Kevin Clark (kevinclark)
Category:
heckle
State:
Open
Summary:
Bogus Mutation Error Report

Detailed description
Heckle reports a bogus mutation failure report.

The following mutations didn't cause test failures:

--- original
+++ mutation
 def adjust_brightness(percent)
   percent = (percent / 100.0)
   percent = (percent + 1.0)
   percent = [percent, 2.0].min
-  percent = [0.0, percent].max
+  percent = [-50.0, percent].max
   hsl = to_hsl
   hsl.l *= percent
   hsl.to_rgb
 end

On the challenged line, because of Array#max, -50.0 will never be able to cause a problem. This isn't to say that the
code can't be cleaned up here, but it's still a bogus report.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2012-06-04 21:03
Sender: Ryan Davis

Believe it or not, we've moved to github! If you think this issue
is still relevant, please re-file it under our project on github
(
https://github.com/seattlerb/$projectname ) and provide a link 
back to this ticket (if there is any comment stream). If not, 
please close this ticket.
Date: 2008-07-15 04:02
Sender: Austin Ziegler

There's already an assertion to that effect in the test code:

test_rgb.rb:      assert_equal("#6600ff",
Color::RGB::Blue.adjust_hue(10).html)
test_rgb.rb:      assert_equal("#0066ff",
Color::RGB::Blue.adjust_hue(-10).html)

This bug report is about the mutations report where a mutation
is made and
reported as a problem that has no chance of failing (the code
in question
constrains the input to the range 0.0 to 2.0).
Date: 2008-07-14 05:39
Sender: Andrew Grimm

Couldn't you write a unit test where adjust_brightness was sent
a value of less than zero (say -20), and ensure it gave the same
result as if you passed zero to adjust_brightness?

If it's not worthwhile testing for such a scenario, is it worthwhile
having production code to handle such a scenario?
Date: 2007-11-17 06:14
Sender: Austin Ziegler

Still bogus with modified code:

The following mutations didn't cause test failures:

--- original
+++ mutation
 def adjust_hue(percent)
   percent = (percent / 100.0)
   percent = (percent + 1.0)
-  percent = [0.0, [percent, 2.0].min].max
+  percent = [-36.0, [percent, 2.0].min].max
   hsl = to_hsl
   hsl.h *= percent
   hsl.to_rgb
 end

--- original
+++ mutation
 def adjust_hue(percent)
   percent = (percent / 100.0)
   percent = (percent + 1.0)
-  percent = [0.0, [percent, 2.0].min].max
+  percent = [0.0, [percent, 89.0].min].max
   hsl = to_hsl
   hsl.h *= percent
   hsl.to_rgb
 end

None of the mutations will ever have a snowball's chance of causing
a
problem.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item