diff --git a/Equivalent mutations/Mutants/Stack_bool_is_result.java b/Equivalent mutations/Mutants/Stack_bool_is_result.java index d40fff2bc3d95e74f98e8919b98dc2fb03827979..89a8d19819fef786d742b73d7e4843b90b80da6b 100644 --- a/Equivalent mutations/Mutants/Stack_bool_is_result.java +++ b/Equivalent mutations/Mutants/Stack_bool_is_result.java @@ -90,7 +90,7 @@ class Program } public Object Pop() { - if (isEmpty()) + if (this.isEmpty()) { System.out.println("Stack is empty!"); return "No elements"; @@ -103,7 +103,7 @@ class Program } public Object Peek() { - if (isEmpty()) + if (this.isEmpty()) { System.out.println("Stack is empty!"); return "No elements"; diff --git a/Equivalent mutations/Mutants/Stack_constructor_duplication.java b/Equivalent mutations/Mutants/Stack_constructor_duplication.java index 151eb58e6e9ef490e13c9e00f478151c0317cbd1..04c4580b8bd56facfd7bc7483a1242b327979ae3 100644 --- a/Equivalent mutations/Mutants/Stack_constructor_duplication.java +++ b/Equivalent mutations/Mutants/Stack_constructor_duplication.java @@ -90,7 +90,7 @@ class Program } public Object Pop() { - if (isEmpty()) + if (this.isEmpty()) { System.out.println("Stack is empty!"); return "No elements"; @@ -103,7 +103,7 @@ class Program } public Object Peek() { - if (isEmpty()) + if (this.isEmpty()) { System.out.println("Stack is empty!"); return "No elements"; diff --git a/Equivalent mutations/Mutants/Stack_useless_property.java b/Equivalent mutations/Mutants/Stack_useless_property.java index 9a37ee62a5542d45073642fc4f6a8fcdb4983982..5c871864f50449e6d29727f29fef68ee26f9a702 100644 --- a/Equivalent mutations/Mutants/Stack_useless_property.java +++ b/Equivalent mutations/Mutants/Stack_useless_property.java @@ -90,7 +90,7 @@ class Program } public Object Pop() { - if (isEmpty()) + if (this.isEmpty()) { System.out.println("Stack is empty!"); return "No elements"; @@ -103,7 +103,7 @@ class Program } public Object Peek() { - if (isEmpty()) + if (this.isEmpty()) { System.out.println("Stack is empty!"); return "No elements"; diff --git a/Equivalent mutations/Stack.java b/Equivalent mutations/Stack.java index d67d9f1ded8e33528f4dab236afff195b9e7fd59..cfbd48669d6abf6281a598be471feb75ad3a2eea 100644 --- a/Equivalent mutations/Stack.java +++ b/Equivalent mutations/Stack.java @@ -88,27 +88,27 @@ class Program this.item[++this.top] = element; System.out.println("Item pushed successfully!"); + } } - } - public Object Pop() - { - if (isEmpty()) + + public Object Pop() { - System.out.println("Stack is empty!"); - return "No elements"; + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; } else { - return this.item[this.top--]; } } public Object Peek() { - if (isEmpty()) + if (this.isEmpty()) { System.out.println("Stack is empty!"); - return "No elements"; + return "No elements"; } else { @@ -123,6 +123,6 @@ class Program { System.out.printf("Item {0}: {1}", (i + 1), this.item[i]); - } - } + } + } } diff --git a/HelperFunctions.hs b/HelperFunctions.hs index dbdacb72d3233b8cb40d41277448fe6405e0ccdd..b380bfe34d585856a033e10491359d51fc37509f 100644 --- a/HelperFunctions.hs +++ b/HelperFunctions.hs @@ -110,6 +110,7 @@ getMethod' classTypeDecls methodId = case (concatMap searchClass classTypeDecls) [] -> Nothing -- Library function call where searchClass (ClassTypeDecl (ClassDecl _ _ _ _ _ (ClassBody decls))) = searchDecls decls + searchClass _ = [] searchDecls (MemberDecl (MethodDecl _ _ t id params _ (MethodBody (Just b))):_) | methodId == id = [(StmtBlock b, t, params)] searchDecls (MemberDecl (ConstructorDecl _ _ id params _ (ConstructorBody _ b)):_) | methodId == toConstrId id = [(StmtBlock (Block b), Just (RefType (ClassRefType (ClassType [(id, [])]))), params)] searchDecls (_:decls) = searchDecls decls @@ -125,6 +126,7 @@ getMainMethod classTypeDecls = fromJust' "getMainMethod" $ getMethod classTypeDe getMethodIds :: [TypeDecl] -> [Ident] getMethodIds classTypeDecls = concatMap searchClass classTypeDecls where searchClass (ClassTypeDecl (ClassDecl _ _ _ _ _ (ClassBody decls))) = searchDecls decls + searchClass _ = [] searchDecls (MemberDecl (MethodDecl _ _ _ id _ _ _):decls) = id : searchDecls decls searchDecls (_:decls) = searchDecls decls searchDecls [] = [] diff --git a/Main.hs b/Main.hs index 76d20b45d7181f66fd1c2478805a8662d8114b0d..6ee33142029b86f77ec3a85bb8cd760a7bdc9e17 100644 --- a/Main.hs +++ b/Main.hs @@ -102,7 +102,7 @@ getPostCond t = case parser Language.Java.Parser.exp postCond' of -- Calculate the wlp (for testing purposes) calcWlp :: IO () calcWlp = do - source <- readFile (joinPath ["Equivalent mutations", "BST.java"]) -- sourcePath + source <- readFile (joinPath ["Equivalent mutations", "stack.java"]) -- sourcePath let result = parser compilationUnit source