context("Parsing Tests")
test_that("Entered Data", {
path <- system.file("extdata/excel_test", package="wateRuse")
exportData <- parseExport(file.path(path,"Export_2010_County.xlsx"),citation=TRUE)
expect_is(exportData, 'list')
expect_equal(length(exportData), 13)
})
test_that("Compare Data", {
})
test_that("Excel Data Gets Normalized", {
path <- system.file("extdata/excel_test", package="wateRuse")
awuds <- get_awuds_data(path)
expect_equal(nrow(awuds),63)
expect_equal(ncol(awuds),98)
expect_is(object = awuds$Area,class="character")
expect_is(object = awuds$AQ.CUsFr, class="numeric")
})
test_that("Dump Data Gets Normalized", {
path <- system.file("extdata/dump", package="wateRuse")
awuds <- get_awuds_data(path)
expect_equal(nrow(awuds),48)
expect_equal(ncol(awuds),286)
expect_is(object = awuds$STATECOUNTYCODE,class="character")
expect_is(object = awuds$TP.TotPop, class="numeric")
})
test_that("Excel Data Gets Normalized When Given List of Files", {
fileList <- c(system.file("extdata/excel_test/Export_2005_County.xlsx", package="wateRuse"),
system.file("extdata/excel_test/Export_2010_County.xlsx", package="wateRuse"),
system.file("extdata/excel_test/Export_2015_County.xlsx", package="wateRuse"))
awuds <- get_awuds_data(awuds.data.files=fileList)
expect_equal(nrow(awuds),63)
expect_equal(ncol(awuds),98)
expect_is(object = awuds$Area,class="character")
expect_is(object = awuds$AQ.CUsFr, class="numeric")
})
test_that("Dump Data gets read in when given as a direct file", {
file <- c(system.file("extdata/dump/exampleAWUDSdump.txt", package="wateRuse"))
awuds <- get_awuds_data(awuds.data.files=file)
expect_equal(nrow(awuds),48)
expect_equal(ncol(awuds),286)
expect_is(object = awuds$STATECOUNTYCODE,class="character")
expect_is(object = awuds$TP.TotPop, class="numeric")
})
test_that("Test calculations", {
awuds <- wUseSample
awuds.calc <- calculate_values(awuds)
x1 <- awuds.calc$LV.WGWFr
y1 <- awuds$LS.WGWFr + awuds$LA.WGWFr
expect_equal(object = x1, expected = y1)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.