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
39019979
Commit
39019979
authored
6 years ago
by
Christopher Schankula
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git@gitlab.cas.mcmaster.ca:schankuc/2XB3.git
parents
04e712a4
202c83c0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/test/TestBasicSearchResult.java
+57
-18
57 additions, 18 deletions
src/test/TestBasicSearchResult.java
src/test/TestCluster.java
+7
-22
7 additions, 22 deletions
src/test/TestCluster.java
src/test/TestHistogram.java
+12
-10
12 additions, 10 deletions
src/test/TestHistogram.java
with
76 additions
and
50 deletions
src/test/TestBasicSearchResult.java
+
57
−
18
View file @
39019979
...
...
@@ -2,14 +2,11 @@ package test;
import
search.trawl.*
;
import
java.util.ArrayList
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
data.Record
;
import
model.TrawlExpert
;
import
search.RedBlackTree
;
import
data.FileProcessor
;
import
data.biotree.BioTree
;
import
search.trawl.BasicSearchResult
;
/**
...
...
@@ -17,42 +14,84 @@ import search.trawl.BasicSearchResult;
* @author TrawlStars, Inc.
*
*/
public
class
TestBasicSearchResult
{
public
static
TrawlExpert
te
;
@Before
public
void
setUp
()
throws
Exception
{
// Assumes serialized data is present
te
=
new
TrawlExpert
();
public
class
TestBasicSearchResult
{
@BeforeClass
public
static
void
setUp
()
throws
Exception
{
BioTree
.
init
();
FileProcessor
.
setPath
(
"smalldata.csv"
);
FileProcessor
.
initProcessing
();
}
@Test
public
void
testTaxonId
()
{
BasicSearchResult
bsr
=
te
.
rangeSearch
(
154210
,
1990
,
2000
);
// Esox lucius
BasicSearchResult
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2000
);
// Esox lucius
assert
(
bsr
.
taxonId
()
==
154210
);
}
@Test
public
void
testYearLo
()
{
BasicSearchResult
bsr
=
te
.
rangeSearch
(
154210
,
1990
,
2000
);
// Esox lucius
BasicSearchResult
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2000
);
// Esox lucius
assert
(
bsr
.
yearLo
()
==
1990
);
}
@Test
public
void
testYearHi
()
{
BasicSearchResult
bsr
=
te
.
rangeSearch
(
154210
,
1990
,
2000
);
// Esox lucius
BasicSearchResult
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2000
);
// Esox lucius
assert
(
bsr
.
yearHi
()
==
2000
);
}
@Test
public
void
testSize
()
{
BasicSearchResult
bsr
=
te
.
rangeSearch
(
154210
,
1990
,
2000
);
// Esox lucius
BasicSearchResult
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2000
);
// Esox lucius
assert
(
bsr
.
n
()
==
4
);
}
@Test
public
void
testSum
()
{
BasicSearchResult
bsr
=
te
.
rangeSearch
(
448306
,
1990
,
2008
);
// Anura
BasicSearchResult
bsr
=
BasicSearch
.
range
(
448306
,
1990
,
2008
);
// Anura
assert
(
bsr
.
sum
()
==
9
);
}
}
//public class TestBasicSearchResult {
// public static TrawlExpert te;
//
// @Before
// public void setUp() throws Exception {
// // Assumes serialized data is present
// te = new TrawlExpert();
// FileProcessor.setPath("smalldata.csv");
// FileProcessor.initProcessing();
// }
//
// @Test
// public void testTaxonId() {
// BasicSearchResult bsr = te.rangeSearch(154210, 1990, 2000); // Esox lucius
// assert(bsr.taxonId() == 154210);
// }
//
// @Test
// public void testYearLo() {
// BasicSearchResult bsr = te.rangeSearch(154210, 1990, 2000); // Esox lucius
// assert(bsr.yearLo() == 1990);
// }
//
// @Test
// public void testYearHi() {
// BasicSearchResult bsr = te.rangeSearch(154210, 1990, 2000); // Esox lucius
// assert(bsr.yearHi() == 2000);
// }
//
// @Test
// public void testSize() {
// BasicSearchResult bsr = te.rangeSearch(154210, 1990, 2000); // Esox lucius
// assert(bsr.n() == 4);
// }
//
// @Test
// public void testSum() {
// BasicSearchResult bsr = te.rangeSearch(448306, 1990, 2008); // Anura
// assert(bsr.sum() == 9);
// }
//}
This diff is collapsed.
Click to expand it.
src/test/TestCluster.java
+
7
−
22
View file @
39019979
...
...
@@ -4,18 +4,14 @@ import search.trawl.*;
import
java.util.ArrayList
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
data.FileProcessor
;
import
data.Record
;
import
data.biotree.BioTree
;
import
model.TrawlExpert
;
import
search.RedBlackTree
;
import
search.trawl.BasicSearchResult
;
import
graph.Cluster
;
import
graph.RecordCluster
;
import
data.biotree.*
;
import
data.FileProcessor
;
/**
* Test cases for Cluster.java
...
...
@@ -23,23 +19,20 @@ import graph.RecordCluster;
*
*/
public
class
TestCluster
{
public
static
TrawlExpert
te
;
public
static
BasicSearchResult
bsr
;
public
static
ArrayList
<
RecordCluster
>
clus
;
@BeforeClass
public
static
void
setUp
()
throws
Exception
{
// Assumes serialized data is present
//te = new TrawlExpert();
BioTree
.
init
();
FileProcessor
.
setPath
(
"smalldata.csv"
);
FileProcessor
.
initProcessing
();
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2008
);
// Esox lucius
}
// Check if a cluster is returned for each object
@Test
public
void
testCluster1
()
{
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2008
);
// Esox lucius
clus
=
Cluster
.
cluster
(
1.0
,
bsr
);
assert
(
clus
.
size
()
==
bsr
.
n
());
}
...
...
@@ -47,6 +40,7 @@ public class TestCluster {
// Check if a cluster contains the correct amount of points
@Test
public
void
testCluster2
()
{
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2008
);
// Esox lucius
clus
=
Cluster
.
cluster
(.
01
,
bsr
);
System
.
out
.
println
(
clus
.
get
(
0
).
N
());
assert
(
clus
.
get
(
0
).
N
()
==
1
);
...
...
@@ -55,27 +49,18 @@ public class TestCluster {
// Check if a cluster contains the correct amount of points
@Test
public
void
testCluster3
()
{
bsr
=
BasicSearch
.
range
(
448306
,
1990
,
2008
);
bsr
=
BasicSearch
.
range
(
448306
,
1990
,
2008
);
// Anura
clus
=
Cluster
.
cluster
(
30.0
,
bsr
);
System
.
out
.
println
(
clus
.
get
(
0
).
N
());
System
.
out
.
println
(
clus
.
get
(
2
).
N
());
assert
(
clus
.
get
(
0
).
N
()
==
3
);
}
// Check if a cluster contains the correct amount of points
@Test
public
void
testCluster4
()
{
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2008
);
System
.
out
.
println
(
bsr
.
n
());
bsr
=
BasicSearch
.
range
(
154210
,
1990
,
2008
);
// Esox lucius
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.
src/test/TestHistogram.java
+
12
−
10
View file @
39019979
...
...
@@ -2,12 +2,12 @@ package test;
import
search.trawl.*
;
import
org.junit.Before
;
import
org.junit.Before
Class
;
import
org.junit.Test
;
import
data.FileProcessor
;
import
data.biotree.BioTree
;
import
model.TrawlExpert
;
import
search.RedBlackTree
;
import
search.trawl.BasicSearchResult
;
/**
* Test cases for Histogram.java
...
...
@@ -17,27 +17,29 @@ import search.trawl.BasicSearchResult;
public
class
TestHistogram
{
public
static
TrawlExpert
te
;
@Before
public
void
setUp
()
throws
Exception
{
// Assumes serialized data is present
te
=
new
TrawlExpert
();
@BeforeClass
public
static
void
setUp
()
throws
Exception
{
BioTree
.
init
();
FileProcessor
.
setPath
(
"smalldata.csv"
);
FileProcessor
.
initProcessing
();
}
@Test
public
void
testSum1
()
{
BasicSearchResult
result
=
te
.
rangeSearch
(
154210
,
1990
,
2000
);
// Esox lucius
BasicSearchResult
result
=
BasicSearch
.
range
(
154210
,
1990
,
2000
);
// Esox lucius
assert
(
Histogram
.
sum
(
result
.
results
())
==
4
);
}
@Test
public
void
testSum2
()
{
BasicSearchResult
result
=
te
.
rangeSearch
(
154210
,
2000
,
2005
);
// Esox lucius
BasicSearchResult
result
=
BasicSearch
.
range
(
154210
,
2000
,
2005
);
// Esox lucius
assert
(
Histogram
.
sum
(
result
.
results
())
==
0
);
}
@Test
public
void
testSum3
()
{
BasicSearchResult
result
=
te
.
rangeSearch
(
448306
,
2000
,
2008
);
// Anura
BasicSearchResult
result
=
BasicSearch
.
range
(
448306
,
2000
,
2008
);
// Anura
assert
(
Histogram
.
sum
(
result
.
results
())
==
9
);
}
}
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