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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tlc4b
Commits
bd378107
Commit
bd378107
authored
10 months ago
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Move getMachines methods into TestUtil
parent
d9cc292e
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/util/AbstractParseMachineTest.java
+2
-29
2 additions, 29 deletions
src/test/java/de/tlc4b/util/AbstractParseMachineTest.java
src/test/java/de/tlc4b/util/TestUtil.java
+29
-0
29 additions, 0 deletions
src/test/java/de/tlc4b/util/TestUtil.java
with
31 additions
and
29 deletions
src/test/java/de/tlc4b/util/AbstractParseMachineTest.java
+
2
−
29
View file @
bd378107
...
@@ -9,38 +9,11 @@ import de.tlc4b.tlc.TLCResults.TLCResult;
...
@@ -9,38 +9,11 @@ import de.tlc4b.tlc.TLCResults.TLCResult;
import
de.tlc4b.util.PolySuite.Configuration
;
import
de.tlc4b.util.PolySuite.Configuration
;
public
abstract
class
AbstractParseMachineTest
{
public
abstract
class
AbstractParseMachineTest
{
private
static
final
String
MCH_SUFFIX
=
".mch"
;
protected
static
File
[]
getMachines
(
String
path
)
{
return
new
File
(
path
).
listFiles
((
dir
,
name
)
->
name
.
endsWith
(
MCH_SUFFIX
));
}
protected
static
List
<
File
>
getMachinesRecursively
(
String
path
)
{
File
root
=
new
File
(
path
);
File
[]
list
=
root
.
listFiles
();
List
<
File
>
files
=
new
ArrayList
<>();
if
(
list
==
null
)
return
files
;
for
(
File
f
:
list
)
{
if
(
f
.
isDirectory
())
{
files
.
addAll
(
getMachinesRecursively
(
f
.
getAbsolutePath
()));
}
else
{
String
name
=
f
.
getName
();
if
(
name
.
endsWith
(
MCH_SUFFIX
))
{
files
.
add
(
f
);
}
}
}
return
files
;
}
protected
static
Configuration
getConfiguration2
(
List
<
String
>
list
)
{
protected
static
Configuration
getConfiguration2
(
List
<
String
>
list
)
{
List
<
File
>
allMachines
=
new
ArrayList
<>();
List
<
File
>
allMachines
=
new
ArrayList
<>();
for
(
String
path
:
list
)
{
for
(
String
path
:
list
)
{
allMachines
.
addAll
(
getMachinesRecursively
(
path
));
allMachines
.
addAll
(
TestUtil
.
getMachinesRecursively
(
path
));
}
}
return
new
Configuration
()
{
return
new
Configuration
()
{
...
@@ -66,7 +39,7 @@ public abstract class AbstractParseMachineTest {
...
@@ -66,7 +39,7 @@ public abstract class AbstractParseMachineTest {
List
<
File
>
allMachines
=
new
ArrayList
<>();
List
<
File
>
allMachines
=
new
ArrayList
<>();
for
(
String
path
:
list
)
{
for
(
String
path
:
list
)
{
allMachines
.
addAll
(
Arrays
.
asList
(
getMachines
(
path
)));
allMachines
.
addAll
(
Arrays
.
asList
(
TestUtil
.
getMachines
(
path
)));
}
}
return
new
Configuration
()
{
return
new
Configuration
()
{
...
...
This diff is collapsed.
Click to expand it.
src/test/java/de/tlc4b/util/TestUtil.java
+
29
−
0
View file @
bd378107
package
de.tlc4b.util
;
package
de.tlc4b.util
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
...
@@ -23,6 +24,34 @@ import static de.tlc4b.TLC4BOption.NOTRACE;
...
@@ -23,6 +24,34 @@ import static de.tlc4b.TLC4BOption.NOTRACE;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
public
class
TestUtil
{
public
class
TestUtil
{
private
static
final
String
MCH_SUFFIX
=
".mch"
;
public
static
File
[]
getMachines
(
String
path
)
{
return
new
File
(
path
).
listFiles
((
dir
,
name
)
->
name
.
endsWith
(
MCH_SUFFIX
));
}
public
static
List
<
File
>
getMachinesRecursively
(
String
path
)
{
File
root
=
new
File
(
path
);
File
[]
list
=
root
.
listFiles
();
List
<
File
>
files
=
new
ArrayList
<>();
if
(
list
==
null
)
{
return
files
;
}
for
(
File
f
:
list
)
{
if
(
f
.
isDirectory
())
{
files
.
addAll
(
getMachinesRecursively
(
f
.
getAbsolutePath
()));
}
else
{
String
name
=
f
.
getName
();
if
(
name
.
endsWith
(
MCH_SUFFIX
))
{
files
.
add
(
f
);
}
}
}
return
files
;
}
public
static
void
compare
(
final
String
expectedModule
,
final
String
machineString
)
throws
BCompoundException
,
TLA2BException
{
public
static
void
compare
(
final
String
expectedModule
,
final
String
machineString
)
throws
BCompoundException
,
TLA2BException
{
TLC4BGlobals
.
setForceTLCToEvalConstants
(
false
);
TLC4BGlobals
.
setForceTLCToEvalConstants
(
false
);
...
...
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