[Returnanalytics-commits] r3723 - pkg/Dowd/tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 23 22:01:39 CEST 2015


Author: dacharya
Date: 2015-06-23 22:01:39 +0200 (Tue, 23 Jun 2015)
New Revision: 3723

Modified:
   pkg/Dowd/tests/testthat/testBinomialBacktest.R
Log:
More test cases added.

Modified: pkg/Dowd/tests/testthat/testBinomialBacktest.R
===================================================================
--- pkg/Dowd/tests/testthat/testBinomialBacktest.R	2015-06-23 20:01:13 UTC (rev 3722)
+++ pkg/Dowd/tests/testthat/testBinomialBacktest.R	2015-06-23 20:01:39 UTC (rev 3723)
@@ -1,11 +1,19 @@
 test_that("Binomial Backtest Works.",{
-  # Success
+  # Success - 1
+  # x < n * p
   expect_equal(0.7358, BinomialBacktest(1, 100, 0.99), tolerance=0.001)
-  expect_equal(0.2529, BinomialBacktest(55, 1000, 0.95), tolerance=0.001)
   
-  # Warnings
-  expect_warning(val <- BinomialBacktest(35,30,0.95))
-  expect_true(is.nan(val))
-  expect_warning(val <- BinomialBacktest(5,30,1.5))
-  expect_true(is.nan(val))
+  # Success - 2
+  # x >= n * p
+  expect_equal(0, BinomialBacktest(91, 100, 0.90), tolerance=0.001)
+  
+  # Error - 1
+  expect_error(val <- BinomialBacktest(35, 30, 0.95))
+  
+  # Error - 2
+  expect_error(val <- BinomialBacktest(5, 30, 1.5))
+  
+  # Error - 3
+  expect_error(val <- BinomialBacktest(5, 30, -.95))
+
 })
\ No newline at end of file



More information about the Returnanalytics-commits mailing list