Skip to content

Commit

Permalink
Fix some test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zzrcxb authored Nov 15, 2017
2 parents f56e995 + 46403bc commit ab1745d
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ Below we list these programs and the conditions to trigger each bomb.
| | toy_eh_cp_cp.cpp | data propagation via exception handling (expected stdin: 0) |
| | div0_eh_cp.cpp | raise an exceptions when divided by 0 (expected stdin: 0) |
| | file_eh_cp.cpp | raise an exception when a file doesn't exist|
| Symbolic Memory | stackarray_sm_l1.c | if stdin points to an array element (expected stdin: 7) |
| Symbolic Memory | stackarray_sm_l1.c | if stdin points to an array element (expected stdin: 4) |
| | malloc_sm_l1.c | allocate memory with malloc (expected stdin: 7)|
| | realloc_sm_l1.c | allocate memory with realloc (expected stdin: 7)|
| | vector_sm_l1.cpp | with std::vector (expected stdin: 7)|
| | list_sm_l1.cpp | with std::list (expected stdin: 7)|
| | stackarray_sm_l2.c | two arrays (expected stdin: 7) |
| | stackarray_sm_l2.c | two arrays (expected stdin: 2) |
| | heapoutofbound_sm_l2.c | if array index equals array size (expected stdin: 6)|
| | stackoutofbound_sm_l2.c | if array index equal array size (expected stdin: 10)|
| Parallel Program | 2thread_pp_l1.c | two-thread program (expected stdin: 7) |
Expand All @@ -51,7 +51,7 @@ Below we list these programs and the conditions to trigger each bomb.
| | float2_fp_l1.c | expected stdin: 7 |
| | float3_fp_l2.c | expected stdin: 0.1 |
| | float4_fp_l2.c | expected stdin: -0.1 |
| | float5_fp_l2.c | expected stdin: 0.00001 |
| | float5_fp_l2.c | expected stdin: 0.41421 |
| Symbolic Jump | jmp_sj_l1.c | jump to an address related to stdin (expected stdin: 37)|
| | arrayjmp_sj_l2.c | a more complex case with an array (expected stdin: 11,23...)|
| | vectorjmp_sj_l2.c | a more complex case with an vector (expected stdin: 5...)|
Expand Down
2 changes: 1 addition & 1 deletion src/floating_point/float1_fp_l1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdlib.h>
#include "a_tester.h"

int logic_bomb(float symvar) {
int logic_bomb(int symvar) {
printf("symvar = %f\n", symvar);
float a = symvar/70.0;
float b = 0.1;
Expand Down
2 changes: 1 addition & 1 deletion src/floating_point/float2_fp_l1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdlib.h>
#include "a_tester.h"

int logic_bomb(float symvar) {
int logic_bomb(int symvar) {
float x = symvar + 0.0000005;
if(x != 7){
float x = symvar + 1;
Expand Down
1 change: 0 additions & 1 deletion src/floating_point/float5_fp_l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ int logic_bomb(float symvar) {
if (x > 0.1)
x -= x;
else
x += x;
printf("x = %f\n", x);
if(x != 0.02){
x = x + 7.98;
Expand Down
2 changes: 1 addition & 1 deletion src/symbolic_memory/malloc_sm_l1.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int logic_bomb(int i) {
for (k=0; k<10; k++){
array[k] = k;
}
if(array[i] == 7){
if(array[i%10] == 7){
return BOMB_ENDING;
}
return NORMAL_ENDING;
Expand Down
2 changes: 1 addition & 1 deletion src/symbolic_memory/realloc_sm_l1.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ int logic_bomb(int i) {
for (k=5; k<10; k++){
array[k] = k;
}
if(array[i] == 7){
if(array[i%10] == 7){
return BOMB_ENDING;
}
return NORMAL_ENDING;
Expand Down
6 changes: 3 additions & 3 deletions src/symbolic_memory/stackarray_sm_l1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include"utils.h"
#include "a_tester.h"

int logic_bomb(int i) {
int logic_bomb(int symvar) {
int ary[] ={1,2,3,4,5};
if(ary[i] == 5){
if(ary[symvar%5] == 5){
return BOMB_ENDING;
}
else
return NORMAL_ENDING;
return NORMAL_ENDING;
}
2 changes: 1 addition & 1 deletion src/symbolic_memory/stackarray_sm_l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int logic_bomb(int i) {
int l1_ary[] ={1,2,3,4,5};
int l2_ary[] ={6,7,8,9,10};

int x = i;
int x = i%5;
if(l2_ary[l1_ary[x]] == 9){
return BOMB_ENDING;
}
Expand Down
2 changes: 1 addition & 1 deletion src_cpp/symbolic_memory/list_sm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int logic_bomb(int symvar) {
mylist.push_back(i);
}
list<int>::iterator it = mylist.begin();
advance(it, symvar);
advance(it, symvar%10);
if(*it == 7)
return BOMB_ENDING;
else
Expand Down
2 changes: 1 addition & 1 deletion src_cpp/symbolic_memory/vector_sm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int logic_bomb(int symvar) {
for (int i=0; i<10; i++){
myvector.push_back(i);
}
if(myvector.at(symvar) == 7)
if(myvector.at(symvar%10) == 7)
return BOMB_ENDING;
else
return NORMAL_ENDING;
Expand Down

0 comments on commit ab1745d

Please sign in to comment.