Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tla2bAST
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tla2bAST
Commits
8332e01b
Commit
8332e01b
authored
10 years ago
by
hansen
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
6dc3d9ec
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/de/tla2b/util/TestUtil.java
+59
-57
59 additions, 57 deletions
src/test/java/de/tla2b/util/TestUtil.java
with
59 additions
and
57 deletions
src/test/java/de/tla2b/util/TestUtil.java
+
59
−
57
View file @
8332e01b
...
@@ -43,23 +43,21 @@ public class TestUtil {
...
@@ -43,23 +43,21 @@ public class TestUtil {
start
.
apply
(
aP
);
start
.
apply
(
aP
);
System
.
out
.
println
(
aP
.
getResultString
());
System
.
out
.
println
(
aP
.
getResultString
());
final
BParser
parser
=
new
BParser
(
"testcase"
);
final
BParser
parser
=
new
BParser
(
"testcase"
);
final
Start
ppStart
=
parser
.
parse
(
aP
.
getResultString
(),
false
);
final
Start
ppStart
=
parser
.
parse
(
aP
.
getResultString
(),
false
);
String
result
=
getTreeAsString
(
start
);
String
result
=
getTreeAsString
(
start
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
String
ppResult
=
getTreeAsString
(
ppStart
);
String
ppResult
=
getTreeAsString
(
ppStart
);
System
.
out
.
println
(
ppResult
);
System
.
out
.
println
(
ppResult
);
System
.
out
.
println
(
"-------------------"
);
System
.
out
.
println
(
"-------------------"
);
assertEquals
(
result
,
ppResult
);
assertEquals
(
result
,
ppResult
);
// System.out.println(t.getBDefinitions().getDefinitionNames());
// System.out.println(t.getBDefinitions().getDefinitionNames());
}
}
public
static
void
compareExpr
(
String
bExpr
,
String
tlaExpr
)
throws
BException
{
public
static
void
compareExpr
(
String
bExpr
,
String
tlaExpr
)
throws
BException
{
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
reset
();
ToolIO
.
reset
();
Start
resultNode
=
Translator
.
translateTlaExpression
(
tlaExpr
);
Start
resultNode
=
Translator
.
translateTlaExpression
(
tlaExpr
);
...
@@ -73,15 +71,16 @@ public class TestUtil {
...
@@ -73,15 +71,16 @@ public class TestUtil {
assertEquals
(
bAstString
,
result
);
assertEquals
(
bAstString
,
result
);
}
}
public
static
void
compareExprIncludingModel
(
String
bExpr
,
String
tlaExpr
,
String
moduleString
)
throws
TLA2BException
{
public
static
void
compareExprIncludingModel
(
String
bExpr
,
String
tlaExpr
,
String
moduleString
)
throws
TLA2BException
{
Translator
trans
=
new
Translator
(
moduleString
,
null
);
Translator
trans
=
new
Translator
(
moduleString
,
null
);
trans
.
translate
();
trans
.
translate
();
Start
result
=
trans
.
translateExpression
(
tlaExpr
);
Start
result
=
trans
.
translateExpression
(
tlaExpr
);
// TODO
}
}
public
static
void
compare
(
String
bMachine
,
String
tlaModule
)
public
static
void
compare
(
String
bMachine
,
String
tlaModule
)
throws
BException
,
TLA2BException
{
throws
BException
,
TLA2BException
{
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
String
expected
=
getAstStringofBMachineString
(
bMachine
);
String
expected
=
getAstStringofBMachineString
(
bMachine
);
System
.
out
.
println
(
expected
);
System
.
out
.
println
(
expected
);
...
@@ -96,15 +95,16 @@ public class TestUtil {
...
@@ -96,15 +95,16 @@ public class TestUtil {
System
.
out
.
println
(
aP
.
getResultString
());
System
.
out
.
println
(
aP
.
getResultString
());
final
BParser
parser
=
new
BParser
(
"testcase"
);
final
BParser
parser
=
new
BParser
(
"testcase"
);
Start
ast
=
parser
.
parse
(
aP
.
getResultString
(),
false
);
Start
ast
=
parser
.
parse
(
aP
.
getResultString
(),
false
);
//BParser.printASTasProlog(System.out, new BParser(), new
File("./test.mch"), resultNode, false, true, null);
//
BParser.printASTasProlog(System.out, new BParser(), new
// File("./test.mch"), resultNode, false, true, null);
// System.out.println(result);
// System.out.println(result);
assertEquals
(
expected
,
result
);
assertEquals
(
expected
,
result
);
assertEquals
(
expected
,
getTreeAsString
(
ast
));
assertEquals
(
expected
,
getTreeAsString
(
ast
));
}
}
public
static
void
compare
(
String
bMachine
,
String
tlaModule
,
String
config
)
throws
BException
,
TLA2BException
{
public
static
void
compare
(
String
bMachine
,
String
tlaModule
,
String
config
)
throws
BException
,
TLA2BException
{
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
String
expected
=
getAstStringofBMachineString
(
bMachine
);
String
expected
=
getAstStringofBMachineString
(
bMachine
);
System
.
out
.
println
(
expected
);
System
.
out
.
println
(
expected
);
...
@@ -116,7 +116,8 @@ public class TestUtil {
...
@@ -116,7 +116,8 @@ public class TestUtil {
resultNode
.
apply
(
aP
);
resultNode
.
apply
(
aP
);
System
.
out
.
println
(
aP
.
getResultString
());
System
.
out
.
println
(
aP
.
getResultString
());
//BParser.printASTasProlog(System.out, new BParser(), new File("./test.mch"), resultNode, false, true, null);
// BParser.printASTasProlog(System.out, new BParser(), new
// File("./test.mch"), resultNode, false, true, null);
String
result
=
getTreeAsString
(
resultNode
);
String
result
=
getTreeAsString
(
resultNode
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
...
@@ -141,8 +142,8 @@ public class TestUtil {
...
@@ -141,8 +142,8 @@ public class TestUtil {
parser
.
parse
(
aP
.
getResultString
(),
false
);
parser
.
parse
(
aP
.
getResultString
(),
false
);
}
}
public
static
TestTypeChecker
typeCheckString
(
String
moduleString
)
public
static
TestTypeChecker
typeCheckString
(
String
moduleString
)
throws
FrontEndException
,
TLA2BException
{
throws
FrontEndException
,
TLA2BException
{
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
reset
();
ToolIO
.
reset
();
TestTypeChecker
testTypeChecker
=
new
TestTypeChecker
();
TestTypeChecker
testTypeChecker
=
new
TestTypeChecker
();
...
@@ -151,7 +152,8 @@ public class TestUtil {
...
@@ -151,7 +152,8 @@ public class TestUtil {
}
}
public
static
TestTypeChecker
typeCheckString
(
String
moduleString
,
String
configString
)
throws
FrontEndException
,
TLA2BException
{
public
static
TestTypeChecker
typeCheckString
(
String
moduleString
,
String
configString
)
throws
FrontEndException
,
TLA2BException
{
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
reset
();
ToolIO
.
reset
();
TestTypeChecker
testTypeChecker
=
new
TestTypeChecker
();
TestTypeChecker
testTypeChecker
=
new
TestTypeChecker
();
...
@@ -159,7 +161,8 @@ public class TestUtil {
...
@@ -159,7 +161,8 @@ public class TestUtil {
return
testTypeChecker
;
return
testTypeChecker
;
}
}
public
static
TestTypeChecker
typeCheck
(
String
moduleFileName
)
throws
FrontEndException
,
TLA2BException
{
public
static
TestTypeChecker
typeCheck
(
String
moduleFileName
)
throws
FrontEndException
,
TLA2BException
{
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
setMode
(
ToolIO
.
TOOL
);
ToolIO
.
reset
();
ToolIO
.
reset
();
moduleFileName
=
moduleFileName
.
replace
(
'/'
,
FileUtil
.
separatorChar
);
moduleFileName
=
moduleFileName
.
replace
(
'/'
,
FileUtil
.
separatorChar
);
...
@@ -190,5 +193,4 @@ public class TestUtil {
...
@@ -190,5 +193,4 @@ public class TestUtil {
return
string
;
return
string
;
}
}
}
}
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