Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2XB3FinalProject
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
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
Christopher Schankula
2XB3FinalProject
Commits
ff8d115f
Commit
ff8d115f
authored
7 years ago
by
Ar1sD
Browse files
Options
Downloads
Patches
Plain Diff
Create JUnit for Cluster.java
parent
ec298069
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/TestCluster.java
+74
-0
74 additions, 0 deletions
src/test/TestCluster.java
with
74 additions
and
0 deletions
src/test/TestCluster.java
0 → 100644
+
74
−
0
View file @
ff8d115f
package
test
;
import
search.trawl.*
;
import
java.util.ArrayList
;
import
org.junit.Before
;
import
org.junit.Test
;
import
data.Record
;
import
model.TrawlExpert
;
import
search.RedBlackTree
;
import
search.trawl.BasicSearchResult
;
import
graph.Cluster
;
import
graph.RecordCluster
;
/**
* Test cases for Cluster.java
* @author TrawlStars, Inc.
*
*/
public
class
TestCluster
{
public
static
TrawlExpert
te
;
public
static
BasicSearchResult
bsr
;
public
static
ArrayList
<
RecordCluster
>
clus
;
@Before
public
void
setUp
()
throws
Exception
{
// Assumes serialized data is present
te
=
new
TrawlExpert
();
bsr
=
te
.
rangeSearch
(
154210
,
1990
,
2008
);
// Esox lucius
}
// Check if a cluster is returned for each object
@Test
public
void
testCluster1
()
{
clus
=
Cluster
.
cluster
(
1.0
,
bsr
);
assert
(
clus
.
size
()
==
bsr
.
n
());
}
// Check if a cluster contains the correct amount of points
@Test
public
void
testCluster2
()
{
clus
=
Cluster
.
cluster
(.
01
,
bsr
);
System
.
out
.
println
(
clus
.
get
(
0
).
N
());
assert
(
clus
.
get
(
0
).
N
()
==
1
);
}
// Check if a cluster contains the correct amount of points
@Test
public
void
testCluster3
()
{
bsr
=
te
.
rangeSearch
(
448306
,
1990
,
2008
);
clus
=
Cluster
.
cluster
(
30.0
,
bsr
);
System
.
out
.
println
(
clus
.
get
(
0
).
N
());
assert
(
clus
.
get
(
0
).
N
()
==
3
);
}
// Check if a cluster contains the correct amount of points
@Test
public
void
testCluster4
()
{
bsr
=
te
.
rangeSearch
(
154210
,
1990
,
2008
);
clus
=
Cluster
.
cluster
(
300.0
,
bsr
);
System
.
out
.
println
(
clus
.
get
(
0
).
N
());
assert
(
clus
.
get
(
0
).
N
()
==
4
);
}
// @Test
// public void tesLatRange() {
// Cluster.latRange(222.222);
// System.out.println();
// assert();
// }
}
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