Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
javawlp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
impresshs
javawlp
Commits
00df5d27
Commit
00df5d27
authored
7 years ago
by
Orestis Melkonian
Browse files
Options
Downloads
Patches
Plain Diff
Main: debug prints
parent
0e6a0a95
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SimpleFormulaChecker.hs
+6
-5
6 additions, 5 deletions
src/SimpleFormulaChecker.hs
with
6 additions
and
5 deletions
src/SimpleFormulaChecker.hs
+
6
−
5
View file @
00df5d27
...
...
@@ -40,6 +40,7 @@ instance Show Response where
show
Timeout
=
"Timeout occured"
show
(
NotEquivalent
model
)
=
"Not equivalent: "
++
show
model
-- Whether to print debug messages.
debug
=
False
-- Function that compares both the pre and the post condition for two methods.
...
...
@@ -51,9 +52,9 @@ compareSpec method1@(_, name1) method2@(_, name2) = do
m2
@
(
decls2
,
mbody2
,
env2
)
<-
parseMethod
method2
when
(
decls1
/=
decls2
)
$
fail
"inconsistent class declarations"
-- when (env1 /= env2) $ fail "inconsistent environments"
--
putStrLn $ "----PRE---- (" ++ name1 ++ " vs " ++ name2 ++ ")"
when
debug
$
putStrLn
$
"----PRE---- ("
++
name1
++
" vs "
++
name2
++
")"
preAns
<-
determineFormulaEq
m1
m2
"pre"
--
putStrLn "\n----POST---"
when
debug
$
putStrLn
"
\n
----POST---"
postAns
<-
determineFormulaEq
m1
m2
"post"
return
$
preAns
<>
postAns
...
...
@@ -65,7 +66,7 @@ determineFormulaEq m1@(decls1, mbody1, env1) m2@(decls2, mbody2, env2) name = do
when
debug
$
putStrLn
$
"e1:
\n
"
++
prettyPrint
e1
++
"
\n\n
e2:
\n
"
++
prettyPrint
e2
++
"
\n
"
let
(
l1
,
l2
)
=
(
javaExpToLExpr
e1
env1
decls1
,
javaExpToLExpr
e2
env2
decls2
)
let
(
l
,
l'
)
=
(
lExprPreprocessNull
l1
,
lExprPreprocessNull
l2
)
-- preprocess "a == null" to "isNull(a)"
--
putStrLn $ "LogicIR.Pretty 1:\n" ++ prettyLExpr l ++ "\n\nLogicIR.Pretty 2:\n" ++ prettyLExpr l' ++ "\n"
when
debug
$
putStrLn
$
"LogicIR.Pretty 1:
\n
"
++
prettyLExpr
l
++
"
\n\n
LogicIR.Pretty 2:
\n
"
++
prettyLExpr
l'
++
"
\n
"
z3Response
<-
l
`
Z3
.
equivalentTo
`
l'
case
z3Response
of
Z3
.
Equivalent
->
return
Equivalent
...
...
@@ -128,10 +129,10 @@ methodDefToLExpr m1@(decls1, _, env1) m2@(decls2, _, env2) name = do
testSpec
::
(
FilePath
,
String
)
->
(
FilePath
,
String
)
->
Int
->
IO
Bool
testSpec
method1
@
(
_
,
name1
)
method2
@
(
_
,
name2
)
n
=
do
(
m1
,
m2
)
<-
parse
method1
method2
putStrLn
$
"----PRE---- ("
++
name1
++
" vs "
++
name2
++
")"
when
debug
$
putStrLn
$
"----PRE---- ("
++
name1
++
" vs "
++
name2
++
")"
let
(
lExpr1
,
lExpr2
)
=
methodDefToLExpr
m1
m2
"pre"
(
preAns
,
counterModel
)
<-
testEquality
n
lExpr1
lExpr2
putStrLn
"
\n
----POST---"
when
debug
$
putStrLn
"
\n
----POST---"
let
(
lExpr1
,
lExpr2
)
=
methodDefToLExpr
m1
m2
"post"
(
postAns
,
counterModel
)
<-
testEquality
n
lExpr1
lExpr2
return
$
preAns
&&
postAns
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment