Skip to content

Commit

Permalink
added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardszoecs committed Jul 2, 2015
1 parent 2d93392 commit 3c74d9a
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/testthat/test-ncbi_children.R
@@ -0,0 +1,17 @@
# tests for ncbi_get_taxon_summary

context("ncbi_children")

tt <- ncbi_children(id = 4751)
tt2 <- ncbi_children(id = 4751, out_type = 'uid')


test_that("ncbi_childres returns correct class and result", {
expect_is(tt, "list")
expect_is(tt[[1]], "data.frame")
expect_equal(ncol(tt[[1]]), 3)
expect_is(tt1, "list")
expect_is(tt1[[1]], "vector")
expect_error(ncbi_children(name = 'Ilex', id = 4751))
expect_equal(ncbi_children(name = NA)[[1]], NA)
})
20 changes: 20 additions & 0 deletions tests/testthat/test-ncbi_get_taxon_summary.R
@@ -0,0 +1,20 @@
# tests for ncbi_get_taxon_summary

context("ncbi_get_taxon_summary")


tt <- ncbi_get_taxon_summary(c(4751))
tt2 <- ncbi_get_taxon_summary(NA)
tt3 <- ncbi_get_taxon_summary(id = NULL)

test_that("ncbi_get_taxon_summary returns correct class and result", {
expect_is(tt, "data.frame")
expect_equal(ncol(tt), 3)
expect_equal(tt[1, 3], 'kingdom')
expect_equal(tt2, NA)
expect_equal(tt3, NULL)
})

test_that("vascan_search returns the correct dimensions", {
expect_equal(NCOL(aa[[1]]$matches[[1]]$taxonomicassertions), 7)
})
57 changes: 57 additions & 0 deletions tests/testthat/test-ping.R
@@ -0,0 +1,57 @@
# tests for eol_ping fxn in taxize
context("ping")

test_that("col_ping returns the correct value", {
expect_true(col_ping())
expect_false(col_ping(503))
expect_true(col_ping("content"))
})


test_that("ncbi_ping returns the correct value", {
expect_true(ncbi_ping())
expect_false(ncbi_ping(503))
expect_true(ncbi_ping("content"))
})

test_that("trpicos_ping returns the correct value", {
expect_true(tropicos_ping())
expect_false(tropicos_ping(503))
expect_true(tropicos_ping("content"))
})

test_that("nbn_ping returns the correct value", {
expect_true(nbn_ping())
expect_false(nbn_ping(503))
expect_true(nbn_ping("content"))
})

test_that("gbif_ping returns the correct value", {
expect_true(gbif_ping())
expect_false(gbif_ping(503))
expect_true(gbif_ping("content"))
})

test_that("ubio_ping returns the correct value", {
expect_true(ubio_ping())
expect_false(ubio_ping(503))
expect_true(ubio_ping("content"))
})

test_that("bold_ping returns the correct value", {
expect_true(bold_ping())
expect_false(bold_ping(503))
expect_true(bold_ping("content"))
})

test_that("ipni_ping returns the correct value", {
expect_true(ipni_ping())
expect_false(ipni_ping(503))
expect_true(ipni_ping("content"))
})

test_that("vascan_ping returns the correct value", {
expect_true(vascan_ping())
expect_false(vascan_ping(503))
expect_true(vascan_ping("content"))
})
13 changes: 13 additions & 0 deletions tests/testthat/test-ubio_classification.R
@@ -0,0 +1,13 @@
# tests for ubio_classification

context("ubio_classification")

tt <- ubio_classification(hierarchiesID = 2483153)


test_that("ncbi_get_taxon_summary returns correct class and result", {
expect_is(tt, "list")
expect_equal(length(tt), 5)
expect_is(tt$data, "data.frame")
expect_equal(ncol(tt$data), 8)
})

0 comments on commit 3c74d9a

Please sign in to comment.