Skip to content
Snippets Groups Projects
Commit c677bd31 authored by Ewen Smith's avatar Ewen Smith
Browse files

Added conditions fo give incorrect vars with instructions

parent 482837bb
Branches
No related tags found
No related merge requests found
......@@ -202,12 +202,12 @@ public class Fuzzer {
if (instructionStack.size() >= MAX_STACK) {
instructionStack.clear();
}
System.out.println("stack: " + Arrays.toString(instructionStack.toArray()));
for (List<Instruction> list: pathwayProb.keySet()) {
String key = list.toString();
String value = pathwayProb.get(list).toString();
System.out.println("map: " + key + " " + value);
}
//System.out.println("stack: " + Arrays.toString(instructionStack.toArray()));
//for (List<Instruction> list: pathwayProb.keySet()) {
// String key = list.toString();
// String value = pathwayProb.get(list).toString();
// System.out.println("map: " + key + " " + value);
//}
}
......@@ -283,8 +283,10 @@ public class Fuzzer {
name = " " + ((Integer) randomRange(VAR_MIN, VAR_MAX)).toString();
} else {
// If incorrect, increase the range to outside +- int31_t
if (randomRange(0,100)<50){
name = " " + ((Long) (randomRange(-1,1)*((long) VAR_MAX + (long) randomRange(0, VAR_MAX)))).toString();
}
}
break;
case LOAD:
case REM:
......@@ -304,22 +306,30 @@ public class Fuzzer {
}
break;
case STORE:
// If not correct, make up a name not in the list
// If correct, make up a name not in the list
if (correct || vars.size() == 0){
// Make up a name
name = generateName(longVarNames);
vars.add(name);
}
// If no variables, return empty string
// Otherwise get name from exiting, or no name
else {
if (randomRange(0,100)<50) {
name = vars.get(randomRange(0, vars.size() - 1));
}
}
name = " " + name;
break;
case SAVE:
if (correct){
name = " " + generateName(false) + ".txt";
} else {
if (randomRange(0,100)<50) {
name = " " + generateName(longVarNames) + ".txt";
}
}
break;
case PLUS:
case SUB:
......@@ -345,7 +355,11 @@ public class Fuzzer {
int length;
if (longVarName){
if (randomRange(0,100)<50){
length = 0;
} else {
length = VAR_NAME_LENGTH_MAX + 100;
}
} else {
// Randomise the length of the string
length = rand.nextInt(VAR_NAME_LENGTH_MAX);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment