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
eab3a42b
There was an error fetching the commit references. Please try again later.
Commit
eab3a42b
authored
7 years ago
by
Ar1sD
Browse files
Options
Downloads
Patches
Plain Diff
Add JUnit test case for Histogram.java
parent
b62b3fa6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/TestHistogram.java
+58
-0
58 additions, 0 deletions
src/test/TestHistogram.java
with
58 additions
and
0 deletions
src/test/TestHistogram.java
0 → 100644
+
58
−
0
View file @
eab3a42b
package
test
;
import
search.trawl.*
;
import
static
org
.
junit
.
Assert
.*;
import
org.json.simple.parser.ParseException
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
data.FileProcessor
;
import
data.Record
;
import
data.biotree.BioTree
;
import
data.biotree.TaxonNode
;
import
model.TrawlExpert
;
import
search.RedBlackTree
;
import
search.trawl.BasicSearch
;
import
search.trawl.BasicSearchResult
;
/**
* Testing was performed on a small dataset for which we know the correct numbers of data for each
* taxon. Takes a while to process the dataset since most of the species in the set are unique and
* thus require API calls.
* @author TrawlStars, Inc.
*
*/
public
class
TestHistogram
{
public
static
TrawlExpert
te
;
public
static
RedBlackTree
<
Integer
,
Integer
>
histo
;
/**
* Loads the small dataset into memory using the FileProcessor.
* @throws Exception Cannot find dataset given.
*/
@BeforeClass
public
static
void
setUp
()
throws
Exception
{
// Assumes serialized data is present
te
=
new
TrawlExpert
();
}
@Test
public
void
testSum1
()
{
BasicSearchResult
result
=
te
.
rangeSearch
(
154210
,
1990
,
2000
);
// Esox lucius
assert
(
Histogram
.
sum
(
result
.
results
())
==
4
);
}
@Test
public
void
testSum2
()
{
BasicSearchResult
result
=
te
.
rangeSearch
(
154210
,
2000
,
2005
);
// Esox lucius
assert
(
Histogram
.
sum
(
result
.
results
())
==
0
);
}
@Test
public
void
testSum3
()
{
BasicSearchResult
result
=
te
.
rangeSearch
(
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