Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tlc4b
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
tlc4b
Commits
cc78428d
Commit
cc78428d
authored
Jul 30, 2024
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Split the two variants of TestUtil.test
parent
b6a9820e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/java/de/tlc4b/tlc/integration/SpecialTest.java
+3
-2
3 additions, 2 deletions
src/test/java/de/tlc4b/tlc/integration/SpecialTest.java
src/test/java/de/tlc4b/util/TestUtil.java
+6
-10
6 additions, 10 deletions
src/test/java/de/tlc4b/util/TestUtil.java
with
9 additions
and
12 deletions
src/test/java/de/tlc4b/tlc/integration/SpecialTest.java
+
3
−
2
View file @
cc78428d
...
@@ -3,6 +3,7 @@ package de.tlc4b.tlc.integration;
...
@@ -3,6 +3,7 @@ package de.tlc4b.tlc.integration;
import
static
de
.
tlc4b
.
TLC4BOption
.*;
import
static
de
.
tlc4b
.
TLC4BOption
.*;
import
static
de
.
tlc4b
.
tlc
.
TLCResults
.
TLCResult
.*;
import
static
de
.
tlc4b
.
tlc
.
TLCResults
.
TLCResult
.*;
import
static
de
.
tlc4b
.
util
.
TestUtil
.
test
;
import
static
de
.
tlc4b
.
util
.
TestUtil
.
test
;
import
static
de
.
tlc4b
.
util
.
TestUtil
.
testWithTrace
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -65,7 +66,7 @@ public class SpecialTest {
...
@@ -65,7 +66,7 @@ public class SpecialTest {
public
void
testCustomOutputDir
()
throws
Exception
{
public
void
testCustomOutputDir
()
throws
Exception
{
Path
specialDir
=
Paths
.
get
(
"./src/test/resources/special/veryspecialoutput"
);
Path
specialDir
=
Paths
.
get
(
"./src/test/resources/special/veryspecialoutput"
);
String
[]
a
=
new
String
[]
{
"./src/test/resources/errors/InvariantError.mch"
,
OUTPUT
.
cliArg
(),
specialDir
.
toString
()};
String
[]
a
=
new
String
[]
{
"./src/test/resources/errors/InvariantError.mch"
,
OUTPUT
.
cliArg
(),
specialDir
.
toString
()};
assertEquals
(
InvariantViolation
,
test
(
a
,
true
));
assertEquals
(
InvariantViolation
,
test
WithTrace
(
a
));
assertTrue
(
Files
.
deleteIfExists
(
specialDir
.
resolve
(
"InvariantError.tla"
)));
assertTrue
(
Files
.
deleteIfExists
(
specialDir
.
resolve
(
"InvariantError.tla"
)));
assertTrue
(
Files
.
deleteIfExists
(
specialDir
.
resolve
(
"InvariantError.cfg"
)));
assertTrue
(
Files
.
deleteIfExists
(
specialDir
.
resolve
(
"InvariantError.cfg"
)));
...
@@ -81,7 +82,7 @@ public class SpecialTest {
...
@@ -81,7 +82,7 @@ public class SpecialTest {
logFile
.
toFile
().
delete
();
logFile
.
toFile
().
delete
();
String
[]
a
=
new
String
[]
{
machineFile
.
toString
(),
LOG
.
cliArg
(),
logFile
.
toString
(),
COVERAGE
.
cliArg
()};
String
[]
a
=
new
String
[]
{
machineFile
.
toString
(),
LOG
.
cliArg
(),
logFile
.
toString
(),
COVERAGE
.
cliArg
()};
assertEquals
(
InvariantViolation
,
test
(
a
,
true
));
assertEquals
(
InvariantViolation
,
test
WithTrace
(
a
));
List
<
String
>
lines
=
Files
.
readAllLines
(
logFile
);
List
<
String
>
lines
=
Files
.
readAllLines
(
logFile
);
assertEquals
(
lines
.
size
(),
12
);
assertEquals
(
lines
.
size
(),
12
);
...
...
This diff is collapsed.
Click to expand it.
src/test/java/de/tlc4b/util/TestUtil.java
+
6
−
10
View file @
cc78428d
...
@@ -178,19 +178,15 @@ public class TestUtil {
...
@@ -178,19 +178,15 @@ public class TestUtil {
}
}
public
static
TLCResult
test
(
String
[]
args
)
throws
IOException
{
public
static
TLCResult
test
(
String
[]
args
)
throws
IOException
{
return
test
(
args
,
false
);
String
[]
newArgs
=
Arrays
.
copyOf
(
args
,
args
.
length
+
1
);
newArgs
[
args
.
length
]
=
NOTRACE
.
cliArg
();
String
runnerClassName
=
TLC4BTester
.
class
.
getCanonicalName
();
return
runTLC
(
runnerClassName
,
newArgs
);
}
}
public
static
TLCResult
test
(
String
[]
args
,
boolean
createTrace
)
throws
IOException
{
public
static
TLCResult
test
WithTrace
(
String
[]
args
)
throws
IOException
{
String
runnerClassName
=
TLC4BTester
.
class
.
getCanonicalName
();
String
runnerClassName
=
TLC4BTester
.
class
.
getCanonicalName
();
String
[]
newArgs
;
return
runTLC
(
runnerClassName
,
args
);
if
(
createTrace
)
{
newArgs
=
args
;
}
else
{
newArgs
=
Arrays
.
copyOf
(
args
,
args
.
length
+
1
);
newArgs
[
args
.
length
]
=
NOTRACE
.
cliArg
();
}
return
runTLC
(
runnerClassName
,
newArgs
);
}
}
private
static
TLCResult
runTLC
(
String
runnerClassName
,
String
[]
args
)
throws
IOException
{
private
static
TLCResult
runTLC
(
String
runnerClassName
,
String
[]
args
)
throws
IOException
{
...
...
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