library(PawelKawskiPackage)
context("stock_price_simulation properties")
test_that(" Number of simulated days = 0 results in an error", {
expect_error(stock_price_simulation("GOOG", 0, 200, "open", TRUE),
"Number of days must be integer value and greater then 0")
})
test_that(" Number of simulated days = 3/2 results in an error", {
expect_error(stock_price_simulation("GOOG", 3/2, 200, "open", TRUE),
"Number of days must be integer value and greater then 0")
})
test_that(" symbol which is not character value results in an error", {
expect_error(stock_price_simulation(2, 100, 200, "open", TRUE),"symbol is not a character vector")
})
test_that(" price_type which is not set on \"close\" or \"open\" results in an error", {
expect_error(stock_price_simulation("GOOG", 100, 200, "high", TRUE),
"price_type == \"close\" | price_type == \"open\" is not TRUE")
})
test_that(" driftless which is not logical value results in an error", {
expect_error(stock_price_simulation("GOOG", 100, 200, "close", "TRUE"),
"Do you want simulate process of prices with drift or not.+")
})
test_that(" Number of simulations = 5/2 results in an error", {
expect_error(stock_price_simulation("GOOG", 5/2, 200, "open", TRUE),
"Number of days must be integer value and greater then 0")
})
A <- typeof(stock_price_simulation("GOOG", 100, 200, "open", TRUE))
test_that(" Return is a list ", {
expect_equal(A, "list")
})
B <- nrow(stock_price_simulation("GOOG", 100, 200, "open", TRUE)[[2]])
test_that(" Returned simulated trajctories have given length", {
expect_equal(B, 200)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.