Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs2-19wi
project07
Commits
c8c07c46
Commit
c8c07c46
authored
6 years ago
by
Ethan Ordentlich
Browse files
Options
Download
Email Patches
Plain Diff
Fix directionality of edge test in common
parent
12868450
master
1 merge request
!2
Fix directionality of edge test in marvel common
Pipeline
#8969
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/edu/caltech/cs2/project07/MarvelTests.java
+21
-2
tests/edu/caltech/cs2/project07/MarvelTests.java
with
21 additions
and
2 deletions
+21
-2
tests/edu/caltech/cs2/project07/MarvelTests.java
View file @
c8c07c46
...
...
@@ -101,7 +101,12 @@ public class MarvelTests {
MARVEL_GRAPH
.
removeEdge
(
c2
,
c1
);
assertEquals
(
null
,
MARVEL_GRAPH
.
adjacent
(
c2
,
c1
),
"An edge is non-null after removal"
);
if
(
edge
>
80
)
{
common
.
add
(
c1
+
" --"
+
edge
+
"-- "
+
c2
);
if
(
c1
.
compareTo
(
c2
)
<
0
)
{
common
.
add
(
c1
.
strip
()
+
" --"
+
edge
+
"-- "
+
c2
.
strip
());
}
else
{
common
.
add
(
c2
.
strip
()
+
" --"
+
edge
+
"-- "
+
c1
.
strip
());
}
}
}
assertTrue
(
MARVEL_GRAPH
.
neighbors
(
c1
).
isEmpty
(),
"After removing all of a vertex's neighbors, neighbors() is non-empty"
);
...
...
@@ -122,7 +127,21 @@ public class MarvelTests {
}
while
(
fr
.
hasNextLine
())
{
expected
.
add
(
fr
.
nextLine
());
String
l
=
fr
.
nextLine
();
// is edge - sort to remove dependence on directionality for correctness
if
(
l
.
contains
(
"--"
))
{
String
[]
spl
=
l
.
split
(
"--"
);
String
v1
=
spl
[
0
].
strip
();
String
v2
=
spl
[
2
].
strip
();
String
e
=
spl
[
1
];
if
(
v1
.
compareTo
(
v2
)
<
0
)
{
l
=
v1
+
" --"
+
e
+
"-- "
+
v2
;
}
else
{
l
=
v2
+
" --"
+
e
+
"-- "
+
v1
;
}
}
expected
.
add
(
l
);
}
MatcherAssert
.
assertThat
(
actual
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help