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
e7c0c27e
Commit
e7c0c27e
authored
6 years ago
by
Ar1sD
Browse files
Options
Downloads
Patches
Plain Diff
Fixes
- No longer uses trawlexpert class - before -> beforeclass
parent
ff8d115f
No related branches found
Branches containing commit
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
+13
-22
13 additions, 22 deletions
src/test/TestCluster.java
src/test/TestHistogram.java
+12
-10
12 additions, 10 deletions
src/test/TestHistogram.java
with
82 additions
and
50 deletions
src/test/TestBasicSearchResult.java
+
57
−
18
View file @
e7c0c27e
...
...
@@ -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
+
13
−
22
View file @
e7c0c27e
...
...
@@ -3,13 +3,10 @@ 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
;
import
graph.Cluster
;
import
graph.RecordCluster
;
...
...
@@ -20,20 +17,20 @@ import graph.RecordCluster;
*
*/
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
@Before
Class
public
static
void
setUp
()
throws
Exception
{
BioTree
.
init
();
FileProcessor
.
setPath
(
"smalldata.csv"
);
FileProcessor
.
initProcessing
();
}
// 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
());
}
...
...
@@ -41,6 +38,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
);
...
...
@@ -49,26 +47,19 @@ public class TestCluster {
// Check if a cluster contains the correct amount of points
@Test
public
void
testCluster3
()
{
bsr
=
te
.
rangeSearch
(
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
(
4
).
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
);
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 @
e7c0c27e
...
...
@@ -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