diff --git a/Equivalent mutations/Mutants/2D_to_1D_no_counter.java b/Equivalent mutations/Mutants/2D_to_1D_no_counter.java index ee1bf4b0220ee8835557dedca4f9bffe1822e95f..2834891fbf5ac27ce8489169432cfb4272d7b594 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 d9002bfe0daacd5da8115fa2e475698a3915ca07..13238df2c7f45d10119a0daac90713f55febbcee 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 7ca126bec08bbed53db61869808de6979f223319..d3bf36fb7a3f078d89a1f0b3741fac27ae1a4671 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 0000000000000000000000000000000000000000..09c9e4283ecb6b19cc732908b90d71948ccbab74 --- /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 0000000000000000000000000000000000000000..e0ae894ca47d54c982102e7b6b832e01307c55b5 --- /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 0000000000000000000000000000000000000000..f14240ea3fec94e69913c908c6c4fc6498137062 --- /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 2264333bc02cd2889b0e1b0e8602116cfa98180b..351ed5df8c3d3b9724d6d1b0334115e52206bb43 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)