Recall the following two definitions from textbook slides: Strongly Killing Muta
ID: 3837992 • Letter: R
Question
Recall the following two definitions from textbook slides: Strongly Killing Mutants: Given a mutant m belongs to M for a program P and a test t, t is said to strongly kill m if and only if the output of t on P is different from the output of t on m Weakly Killing Mutants: Given a mutant m belongs to M that modifies a location l in a program P, and a test t, t is said to weakly kill m if and only if the state of the execution of P on t is different from the state of the execution of m immediately on t after l Consider the following mutant TriangPartial2 of the TriangPartial method from question 3 in which a variable occurrence (of tri_out) is replaced with a constant value (i.e., 3) at line 12: Static int Triangpartial2 (int x, int y, int z) { int tri_out; if {xExplanation / Answer
You have not provided the code for function TrianglePartia(int x, int y, int z), I am assuming that it is similar to TrianglePartial2 with only change at line 12 as tri_out = tri_out+3; If this is not the case do comment with the correct code of TrianglePartial.
(a) The input x=1 , y=2, z=2 will strongly kill the mutant TrianglePartial2, as it outputs 6 if we run on TrianglePartial2 and outputs 5 when run on TrianglePartial.
(b) There is no input that weakly kills TrianglePartial2. Here is why ? For weakly kiling we need to have a change in execution state immeadiately after mutated statement. So
condition 1 :We need to provide input that comes to the mutated statement, so as per code the input x,y,z have to be positive integers > 0
Now for changing the execution state after mutated statement, In TrianglePartial2 the flow is determined to skip if statement and just return tri_out, as the value of tri_out will be 6. So to have change in execution state in TrianglePartial the input has to go inside the if (tri_out==0) after the mutated statement tri_out=tri_out+3;. For this the tri_out should become 0, so at mutated statement tri_out should be -3, but this is cannot happen with any input as tri_out is initialized to 0 and in each statement some positive integer is added to it.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.