From 2bcf15aba80657ed49b9f17dcefcb3ffc9d6c251 Mon Sep 17 00:00:00 2001
From: Koen Wermer <koenwermer@gmail.com>
Date: Sun, 19 Feb 2017 17:07:56 +0100
Subject: [PATCH] false positives test

---
 .../Mutants/2D_to_1D_no_counter.java                 |  2 +-
 Folds.hs                                             |  2 +-
 Main.hs                                              | 12 +++++++-----
 .../true_returnValue != null_true_False_False_1      | 11 +++++++++++
 ...Value_returnValueVar == returnValue_False_False_1 | 11 +++++++++++
 ..._true_returnValueVar == returnValue_False_False_1 |  9 +++++++++
 Settings.hs                                          |  2 +-
 7 files changed, 41 insertions(+), 8 deletions(-)
 create mode 100644 Results/False Positives/true_returnValue != null_true_False_False_1
 create mode 100644 Results/False Positives/true_returnValueVar == returnValue_returnValueVar == returnValue_False_False_1
 create mode 100644 Results/False Positives/true_true_returnValueVar == returnValue_False_False_1

diff --git a/Equivalent mutations/Mutants/2D_to_1D_no_counter.java b/Equivalent mutations/Mutants/2D_to_1D_no_counter.java
index ee1bf4b..2834891 100644
--- a/Equivalent mutations/Mutants/2D_to_1D_no_counter.java	
+++ b/Equivalent mutations/Mutants/2D_to_1D_no_counter.java	
@@ -42,7 +42,7 @@ class twodmatrix
         {
             for (int j3 = 0; j3 < this.n; j3++)
             {
-                this.b[i*n+j] = this.a[i3][j3];
+                this.b[i3*this.n+j3] = this.a[i3][j3];
             }
         }
     }
diff --git a/Folds.hs b/Folds.hs
index d9002bf..13238df 100644
--- a/Folds.hs
+++ b/Folds.hs
@@ -58,7 +58,7 @@ foldStmt :: StmtAlgebra r -> Stmt -> r
 foldStmt (fStmtBlock, fIfThen, fIfThenElse, fWhile, fBasicFor, fEnhancedFor, fEmpty, fExpStmt, fAssert, fSwitch, fDo, fBreak, fContinue, fReturn, fSynchronized, fThrow, fTry, fLabeled) s = fold s where
     fold s = case s of
                   StmtBlock b -> fStmtBlock b
-                  IfThen e stmt -> fIfThen e (fold stmt)	
+                  IfThen e stmt -> fIfThen e (fold stmt)
                   IfThenElse e stmt1 stmt2 -> fIfThenElse e (fold stmt1) (fold stmt2)
                   While e stmt -> fWhile e (fold stmt)
                   BasicFor init e incr stmt -> fBasicFor init e incr (fold stmt)
diff --git a/Main.hs b/Main.hs
index 7ca126b..d3bf36f 100644
--- a/Main.hs
+++ b/Main.hs
@@ -109,7 +109,7 @@ compareWlps results env decls s (path, s') = do
     return (if sum errorsFound > 0 then 1 else 0)
         where 
         compareMethod (ident, e) = case lookup ident s' of
-                                    Nothing -> putStrLn ("The method \'" ++ show ident ++ "\' is missing in one of the mutations.") >> return 0 -- print a warning and return 0 errors found
+                                    Nothing -> putStrLn ("The method \'" ++ prettyPrint ident ++ "\' is missing in mutation " ++ path) >> return 0 -- print a warning and return 0 errors found
                                     Just e' -> if unsafeIsTrue (extendEnv env decls ident) decls (e `imp` e') then return 0 else printAndAppend results (path ++ " " ++ prettyPrint ident) >> return 1 -- print a message and return 1 error found
 
 -- Gets the right post-condition given the type of a method
@@ -151,11 +151,13 @@ testFalsePositives = do
     n1 <- testFalsePositives' results "BST.java" ["BST_no_parent.java"]
     n2 <- testFalsePositives' results "Fibonacci.java" ["Fibonacci_no_extra_prints.java"]
     n3 <- testFalsePositives' results "Stack.java" ["Stack_bool_is_result.java", "Stack_constructor_duplication.java", "Stack_useless_property.java"]
-    n4 <- testFalsePositives' results "MinsMaxs.java" ["MinsMaxs_R1.java", "MinsMaxs_R2.java", "MinsMaxs_R3.java"]
-    n5 <- testFalsePositives' results "Normalizer.java" ["Normalizer_R1.java", "Normalizer_R2.java", "Normalizer_R3.java", "Normalizer_R4.java"]
-    n6 <- testFalsePositives' results "Vector.java" ["Vector_R1.java", "Vector_R2.java", "Vector_R3.java"]
+    n4 <- testFalsePositives' results "2D_to_1D.java" ["2D_to_1D_no_counter.java", "2D_to_1D_no_1D.java"]
+    n5 <- testFalsePositives' results "Vectors01Generator.java" ["Vectors01Generator_no_for.java", "Vectors01Generator_print_string.java"]
+    n6 <- testFalsePositives' results "MinsMaxs.java" ["MinsMaxs_R1.java", "MinsMaxs_R2.java", "MinsMaxs_R3.java"]
+    n7 <- testFalsePositives' results "Normalizer.java" ["Normalizer_R1.java", "Normalizer_R2.java", "Normalizer_R3.java", "Normalizer_R4.java"]
+    n8 <- testFalsePositives' results "Vector.java" ["Vector_R1.java", "Vector_R2.java", "Vector_R3.java"]
     
-    printAndAppend results ("Total number of false positives: " ++ show (n1 + n2 + n3 + n4 + n5 + n6))
+    printAndAppend results ("Total number of false positives: " ++ show (n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8))
     where
     testFalsePositives' :: FilePath -> FilePath -> [FilePath] -> IO Int
     testFalsePositives' results source mutations = testFalsePositives'' results (joinPath ["Equivalent mutations", source]) (map (\mutant -> joinPath ["Equivalent mutations", "Mutants", mutant]) mutations)
diff --git a/Results/False Positives/true_returnValue != null_true_False_False_1 b/Results/False Positives/true_returnValue != null_true_False_False_1
new file mode 100644
index 0000000..09c9e42
--- /dev/null
+++ b/Results/False Positives/true_returnValue != null_true_False_False_1	
@@ -0,0 +1,11 @@
+False positives test
+postCondVoid: true
+postCondRefType: returnValue != null
+postCondPrimType: true
+ignoreLibMethods: False
+ignoreMainMethod: False
+nrOfUnroll: 1
+False positives found in:
+Equivalent mutations\Mutants\Vector_R2.java combine
+Equivalent mutations\Mutants\Vector_R3.java combine
+Total number of false positives: 2
\ No newline at end of file
diff --git a/Results/False Positives/true_returnValueVar == returnValue_returnValueVar == returnValue_False_False_1 b/Results/False Positives/true_returnValueVar == returnValue_returnValueVar == returnValue_False_False_1
new file mode 100644
index 0000000..e0ae894
--- /dev/null
+++ b/Results/False Positives/true_returnValueVar == returnValue_returnValueVar == returnValue_False_False_1	
@@ -0,0 +1,11 @@
+False positives test
+postCondVoid: true
+postCondRefType: returnValueVar == returnValue
+postCondPrimType: returnValueVar == returnValue
+ignoreLibMethods: False
+ignoreMainMethod: False
+nrOfUnroll: 1
+False positives found in:
+Equivalent mutations\Mutants\Vector_R2.java combine
+Equivalent mutations\Mutants\Vector_R3.java combine
+Total number of false positives: 2
\ No newline at end of file
diff --git a/Results/False Positives/true_true_returnValueVar == returnValue_False_False_1 b/Results/False Positives/true_true_returnValueVar == returnValue_False_False_1
new file mode 100644
index 0000000..f14240e
--- /dev/null
+++ b/Results/False Positives/true_true_returnValueVar == returnValue_False_False_1	
@@ -0,0 +1,9 @@
+False positives test
+postCondVoid: true
+postCondRefType: true
+postCondPrimType: returnValueVar == returnValue
+ignoreLibMethods: False
+ignoreMainMethod: False
+nrOfUnroll: 1
+False positives found in:
+Total number of false positives: 0
\ No newline at end of file
diff --git a/Settings.hs b/Settings.hs
index 2264333..351ed5d 100644
--- a/Settings.hs
+++ b/Settings.hs
@@ -7,7 +7,7 @@ testFile = "Vector"
 
 -- The post condition may depend on the type of the method we are looking at
 postCondVoid = "true"
-postCondRefType = heur1
+postCondRefType = heur2
 postCondPrimType = heur2
 
 -- When ignoreLibMethods is true, library calls will simply be ignored. When false, we consider library methods but make no assumptions about them (so the WLP will be true)
-- 
GitLab