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-20wi
project08
Commits
5837873b
Commit
5837873b
authored
4 years ago
by
Archie Shahidullah
Browse files
Options
Download
Email Patches
Plain Diff
Fix issue 2
parent
b37e9e2b
1 merge request
!2
Review Tests for Project 8
Pipeline
#46466
canceled with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/edu/caltech/cs2/project08/BeavermapTests.java
+6
-4
tests/edu/caltech/cs2/project08/BeavermapTests.java
tests/edu/caltech/cs2/project08/DijkstraTest.java
+4
-4
tests/edu/caltech/cs2/project08/DijkstraTest.java
with
10 additions
and
8 deletions
+10
-8
tests/edu/caltech/cs2/project08/BeavermapTests.java
View file @
5837873b
...
...
@@ -290,7 +290,12 @@ public class BeavermapTests {
IDeque
<
Location
>
actualPath
=
bmg
.
dijkstra
(
start
,
target
);
List
<
Long
>
actualPathIDs
=
new
ArrayList
<>();
if
(
actualPath
!=
null
)
{
if
(
expectedPathIDs
.
size
()
==
0
)
{
assertNull
(
actualPath
,
"Path does not exist from "
+
start
.
id
+
" to "
+
target
.
id
+
" but was found"
);
}
else
{
assertNotNull
(
actualPath
,
"Path exists from "
+
start
.
id
+
" to "
+
target
.
id
+
" but was not found"
);
for
(
Location
l
:
actualPath
)
{
actualPathIDs
.
add
(
l
.
id
);
}
...
...
@@ -298,9 +303,6 @@ public class BeavermapTests {
MatcherAssert
.
assertThat
(
actualPathIDs
,
IsIterableContainingInOrder
.
contains
(
expectedPathIDs
.
toArray
()));
}
else
if
(
expectedPathIDs
.
size
()
!=
0
)
{
fail
(
"Found path from "
+
start
.
id
+
" to "
+
target
.
id
+
" where there is none."
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/edu/caltech/cs2/project08/DijkstraTest.java
View file @
5837873b
...
...
@@ -79,10 +79,10 @@ public class DijkstraTest {
String
line
=
s
.
nextLine
();
if
(
line
.
equals
(
"null"
))
{
assertNull
(
res
,
"Path does not exist but was found"
);
assertNull
(
res
,
"Path does not exist
from "
+
start
+
" to "
+
end
+
"
but was found"
);
}
else
{
assertNotNull
(
res
,
"Path exists but was not found"
);
assertNotNull
(
res
,
"Path exists
from "
+
start
+
" to "
+
end
+
"
but was not found"
);
for
(
Location
l
:
res
)
{
if
(
prev
!=
null
)
{
pathLen
+=
bmg
.
adjacent
(
prev
.
id
,
l
.
id
);
...
...
@@ -135,10 +135,10 @@ public class DijkstraTest {
String
line
=
s
.
nextLine
();
if
(
line
.
equals
(
"null"
))
{
assertNull
(
res
,
"Path does not exist but was found"
);
assertNull
(
res
,
"Path does not exist
from "
+
startvertex
+
" to "
+
endvertex
+
"
but was found"
);
}
else
{
assertNotNull
(
res
,
"Path exists but was not found"
);
assertNotNull
(
res
,
"Path exists
from "
+
startvertex
+
" to "
+
endvertex
+
"
but was not found"
);
double
pathLen
=
0
;
Location
prev
=
null
;
for
(
Location
l
:
res
)
{
...
...
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