Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • tmiller/SWEN90006-A1-2018
  • cbalasuriya/SWEN90006-A1-2018
  • zhangyuny/SWEN90006-A1-2018
  • zhaor4/SWEN90006-A1-2018
  • nelsonc1/SWEN90006-A1-2018
  • jiamingz3/SWEN90006-A1-2018
  • cvidler/SWEN90006-A1-2018
  • 923841/SWEN90006-A1-2018
  • hzhu5/SWEN90006-A1-2018
  • zhuoyaof/SWEN90006-A1-2018
  • haoyangc/SWEN90006-A1-2018
  • austinl/SWEN90006-A1-2018
  • gxuan/SWEN90006-A1-2018
  • zlang/SWEN90006-A1-2018
  • junhany/SWEN90006-A1-2018
  • shibaoz/SWEN90006-A1-2018
  • arwinders/SWEN90006-A1-2018
  • jiankunc/SWEN90006-A1-2018
  • xujiaz/SWEN90006-A1-2018
  • xiaomingz/SWEN90006-A1-2018
  • xixiangw/SWEN90006-A1-2018
  • yunchengw/SWEN90006-A1-2018
  • abdulk/SWEN90006-A1-2018
  • yangz7/SWEN90006-A1-2018
  • linyuanz/SWEN90006-A1-2018
  • zhaolind/SWEN90006-A1-2018
  • jingjiahuil/SWEN90006-A1-2018
  • hongyic3/SWEN90006-A1-2018
  • zhouw4/SWEN90006-A1-2018
  • emilylm/SWEN90006-A1-2018
  • jingez1/SWEN90006-A1-2018
  • minzhex/SWEN90006-A1-2018
32 results
Select Git revision
Show changes
Commits on Source (6)
//Remove increment for pc for blank line,
// killed by EC #1 test due to incorrect pc. Takes advantage of the
//assumption that not all students will be asserting correct pc on every test
//case, and this is perhaps even less likely on blank lines
package swen90006.machine;
import java.util.Arrays;
......@@ -188,7 +193,10 @@ public class Machine
/* check for blank lines */
if (inst.equals("")){
pc = pc + 1;
pc = pc;
//Remove increment for pc, killed by EC #1 test. Takes advantage of the
//assumption that not all students will be asserting correct pc on every test
//case, and this is perhaps even less likely on blank lines
count++;
continue;
}
......
// this mutant edits a branch deep in the program, which takes advantage
//of the fact that this branch will be reached by less test cases than
//others. killed by BVA test case @ EC17
package swen90006.machine;
import java.util.Arrays;
......@@ -276,7 +280,10 @@ public class Machine
int ra = parseReg(toks[1]);
int offs = parseOffset(toks[2]);
if (regs[ra] == 0){
pc = pc + offs;
pc = pc + offs + 1;
// this mutant edits a branch deep in the program, which takes advantage
//of the fact that this branch will be reached by less test cases than
//others. killed by BVA test case @ EC17
}else{
pc = pc + 1;
}
......
//change max offset, taking advantage of the fact that the assignment
//specification changed to exclude address 35536. killed by BVA
//test EC6
package swen90006.machine;
import java.util.Arrays;
......@@ -148,7 +151,10 @@ public class Machine
private void validate_offset(int offset)
throws InvalidInstructionException
{
if (offset < -MAX_ADDR || offset > MAX_ADDR) {
if (offset < -MAX_ADDR || offset > MAX_ADDR+1) {
//change max offset, taking advantage of the fact that the assignment
//specification changed to exclude address 35536. killed by BVA
//test EC6
throw new InvalidInstructionException();
}
}
......
//abs value of register value in ADD:
//may not be caught if test cases don't include
//negative values for ADD insturction.
package swen90006.machine;
import java.util.Arrays;
......@@ -58,7 +61,11 @@ public class Machine
private void do_add(int dest, int src1, int src2)
{
regs[dest] = regs[src1] + regs[src2];
regs[dest] = regs[src1] + abs(regs[src2]);
//abs value of register value in ADD:
//may not be caught if test cases don't include
//negative values for ADD insturction.
}
private void do_sub(int dest, int src1, int src2)
......@@ -77,6 +84,7 @@ public class Machine
/* no op */
}else{
regs[dest] = regs[src1] / regs[src2];
}
}
......@@ -168,9 +176,10 @@ public class Machine
int instructionsExecuted = 0;
int pc = 0;
final int progLength = instructions.size();
final int progLength = instructions.size()-1;
while(true){
if (pc < 0 || pc >= progLength){
/* will cause NoReturnValueException to be thrown
* but that is not a bug and and indeed is what the
* VM is supposed to do if the pc becomes negative,
......
//change assigned memory value. can be caught if mem value
//is loaded after being stored, and then returned.
package swen90006.machine;
import java.util.Arrays;
......@@ -96,7 +98,9 @@ public class Machine
}else if(regs[a] + offs < 0){
/* no op */
}else{
memory[regs[a] + offs] = regs[b];
memory[regs[a] + offs+1] = regs[b];
//change assigned memory value. can be caught if mem value
//is loaded after being stored, and then returned.
}
}
......