Skip to content

Commit

Permalink
final tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khufkens committed Nov 1, 2018
1 parent 94870d4 commit 1adc07b
Showing 1 changed file with 60 additions and 8 deletions.
68 changes: 60 additions & 8 deletions tests/testthat/test_main_functions.r
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,31 @@ test_that("test mt_subset()",{
)
)

# no band provided
expect_error(
mt_subset(
product = "MOD11A2",
lat = 40,
lon = -110,
start = "2004-01-01",
end = "2004-02-20",
progress = FALSE
)
)

# bad band provided
expect_error(
mt_subset(
product = "MOD11A2",
lat = 40,
lon = -110,
band = "LST_Day_0km",
start = "2004-01-01",
end = "2004-02-20",
progress = FALSE
)
)

# missing coordinate
expect_error(
mt_subset(
Expand All @@ -99,14 +124,6 @@ test_that("test mt_subset()",{
)
)

# no band provided
expect_error(mt_subset(
product = "MOD11A2",
lat = 40,
start = "2004-01-01",
end = "2004-03-31"
))

# no product provided
expect_error(
mt_subset(
Expand All @@ -118,6 +135,18 @@ test_that("test mt_subset()",{
)
)

# wrong product provided
expect_error(
mt_subset(
product = "MOD11AZ",
lat = 40,
lon = -110,
band = "LST_Day_1km",
start = "2004-01-01",
end = "2004-03-31"
)
)

# good site query
expect_is(
mt_subset(
Expand Down Expand Up @@ -245,6 +274,18 @@ test_that("test mt_batch_subset()",{
)
)

# error bad product name
expect_error(
mt_batch_subset(
df = df,
product = "MOD11AZ",
band = "LST_Day_1km",
internal = TRUE,
start = "2004-01-01",
end = "2004-03-31"
)
)

# error missing product
expect_error(
mt_batch_subset(
Expand All @@ -267,6 +308,17 @@ test_that("test mt_batch_subset()",{
end = "2004-03-31"
)
)

# missing band name
expect_error(
mt_batch_subset(
df = df,
product = "MOD11A2",
internal = TRUE,
start = "2004-01-01",
end = "2004-03-31"
)
)
})

# test coordinate conversions
Expand Down

0 comments on commit 1adc07b

Please sign in to comment.