Skip to content
Snippets Groups Projects
Commit d1c3d904 authored by Ashwaq Abdullah M Alsaqer's avatar Ashwaq Abdullah M Alsaqer
Browse files

Non-equivalent Mutants

parent 6fc2e076
Branches
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -3,6 +3,8 @@ package swen90006.machine;
import java.util.Arrays;
import java.util.List;
import javax.activity.InvalidActivityException;
public class Machine
{
/** arithmetic instructions each take three registers as arguments with the
......@@ -58,12 +60,12 @@ public class Machine
private void do_add(int dest, int src1, int src2)
{
regs[dest] = regs[src1] + regs[src2];
regs[dest] = regs[src1] - regs[src2]; // Arthimetic Operator Replacement
}
private void do_sub(int dest, int src1, int src2)
{
regs[dest] = regs[src1] - regs[src2];
regs[dest] = regs[src1] + regs[src2]; // Arthimetic Operator Replacement
}
private void do_mult(int dest, int src1, int src2)
......
......@@ -109,7 +109,7 @@ public class Machine
if (s.length() < 2){
throw new InvalidInstructionException();
}
if (s.charAt(0) != 'r'){
if (!(s.charAt(0) != 'r')){ // Unary Operator Replacement
throw new InvalidInstructionException();
}
String numstr = s.substring(1);
......
......@@ -140,7 +140,7 @@ public class Machine
private void validate_reg(int reg)
throws InvalidInstructionException
{
if (reg < 0 || reg > MAX_REG) {
if (reg < 0 && reg > MAX_REG) { // Conditional Operator Replacement
throw new InvalidInstructionException();
}
}
......
......@@ -298,6 +298,6 @@ public class Machine
* get the number of instructions successfully executed by the VM so far
*/
public int getCount(){
return count;
return count++; // Unary Operator
}
}
......@@ -255,9 +255,13 @@ public class Machine
int rb = parseReg(toks[3]);
do_store(ra,offs,rb);
} else if (toks[0].equals(INSTRUCTION_MOVE)){
if (toks.length != 3){
throw new InvalidInstructionException();
}
Bomb(); // Bomb statement Replacement
int rd = parseReg(toks[1]);
int offs = parseOffset(toks[2]);
do_move(rd,offs);
......@@ -300,4 +304,8 @@ public class Machine
public int getCount(){
return count;
}
public void Bomb() throws InvalidInstructionException{
throw new InvalidActivityException();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment