Syntax Coverage and JUnit Part 1 A) Consider the following line of code:if (x 12)) Write threevalidmutants of this ground string (based on the rules of the Java/C# language), followed by...

Syntax Coverage and JUnit

Part 1


A) Consider the following line of code:if (x <> 12))


Write threevalidmutants of this ground string (based on the rules of the Java/C# language), followed by threeinvalidmutants.

You must use a different mutant operator for each mutant you create – list the abbreviation for the operator used next to each line (for example, write “ROR” if you used a Relational Operator Replacement).


B) Consider the following grammar rules:

ROOT ::=SUB1 SUB2 | SUB2 SUB1 | SUB1 | SUB2SUB1 ::="1" | "3" | "5" | "7" | "9"

SUB2 ::="K" | "S" | "U" | "P"


1) How many uniquenonterminalsymbols are in this grammar?


2) How many uniqueterminalsymbols are in this grammar?


3) Provide an example of avalidstring in this grammar, followed by an example of aninvalidstring.


Part 2


A) A sample Java/C# file with one static function,Power.java/Power.cshas been included. Develop and write outsixmutant lines from the provided code. You should use the operators defined in Section 9.2 of your textbook to create the mutant lines of code.


B) Implement tests in JUnit/NUnit that seek to reveal if the mutant lines you defined in (A) exist.


Example: If there’s an original code line “sum = a + b”, and you develop a mutant “sum = a–b”, you should write a test case that verifies the function doesnotoperate like the mutant line of code is in it.





May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here