[Vegan-commits] r1661 - in pkg/permute: . inst inst/tests tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 29 00:55:41 CEST 2011


Author: gsimpson
Date: 2011-06-29 00:55:41 +0200 (Wed, 29 Jun 2011)
New Revision: 1661

Added:
   pkg/permute/inst/tests/
   pkg/permute/inst/tests/test-shuffle.R
   pkg/permute/tests/
   pkg/permute/tests/test-all.R
Modified:
   pkg/permute/DESCRIPTION
   pkg/permute/inst/ChangeLog
Log:
bump to 0.5-1, adds tests via testthat package

Modified: pkg/permute/DESCRIPTION
===================================================================
--- pkg/permute/DESCRIPTION	2011-06-28 22:54:03 UTC (rev 1660)
+++ pkg/permute/DESCRIPTION	2011-06-28 22:55:41 UTC (rev 1661)
@@ -1,10 +1,10 @@
 Package: permute
 Title: Functions for generating restricted permutations of data
-Version: 0.5-0
+Version: 0.5-1
 Date: $Date$
 Author: Gavin L. Simpson
 Maintainer: Gavin L. Simpson <gavin.simpson at ucl.ac.uk>
-Suggests: vegan
+Suggests: vegan, testthat (>= 0.5)
 Description: The 'permute' package implements a set of restricted permutation designsfor freely exchangeable, line transects (time series), and spatial grid designs plus permutation of blocks (groups of samples). 'permute' also allows split-plot designs, in which the whole-plots or split-plots or both can be freely-exchangeble or one of the restricted designs.
 License: GPL-2 
 URL: http://vegan.r-forge.r-project.org/

Modified: pkg/permute/inst/ChangeLog
===================================================================
--- pkg/permute/inst/ChangeLog	2011-06-28 22:54:03 UTC (rev 1660)
+++ pkg/permute/inst/ChangeLog	2011-06-28 22:55:41 UTC (rev 1661)
@@ -2,8 +2,16 @@
 
 permute ChangeLog
 
-Version 0.5-0 (opened June 17, 2011)
+Version 0.5-1 (opened June 28, 2011)
 
+	* shuffle: now returns seq_len(n) for no permutation within
+	blocks or of blocks.
+
+	* tests: testing using the `testthat` package. Initial
+	infrasctructure.
+
+Version 0.5-0 (closed June 28, 2011)
+
 	* shuffle: renamed permuted.index() to shuffle()
 	* Vignette: the package has a vignette, which is very much
 	a work-in-progress.

Added: pkg/permute/inst/tests/test-shuffle.R
===================================================================
--- pkg/permute/inst/tests/test-shuffle.R	                        (rev 0)
+++ pkg/permute/inst/tests/test-shuffle.R	2011-06-28 22:55:41 UTC (rev 1661)
@@ -0,0 +1,22 @@
+library(testthat)
+library_if_available(permute)
+
+context("Testing shuffle()")
+
+## test no permutation
+test_that("shuffle(n) returns seq_len(n) when not permuting", {
+    ctrl <- permControl(within = Within(type = "none"))
+
+    expect_that(shuffle(3, control = ctrl), is_identical_to(seq_len(3)))
+    expect_that(shuffle(1, control = ctrl), is_identical_to(1L))
+})
+
+## test shuffle returns integers
+test_that("shuffle() returns integers", {
+    ctrl <- permControl(within = Within(type = "none"))
+
+    expect_that(shuffle(4), is_a("integer"))
+    expect_that(shuffle(100), is_a("integer"))
+    expect_that(shuffle(1, control = ctrl), is_identical_to(1L))
+    expect_that(shuffle(3, control = ctrl), is_identical_to(c(1L, 2L, 3L)))
+})

Added: pkg/permute/tests/test-all.R
===================================================================
--- pkg/permute/tests/test-all.R	                        (rev 0)
+++ pkg/permute/tests/test-all.R	2011-06-28 22:55:41 UTC (rev 1661)
@@ -0,0 +1,8 @@
+## Test `permute` using the `testthat` package
+
+## Setup
+library(testthat)
+library(permute)
+
+## Runs the tests in inst/tests
+test_package("permute")



More information about the Vegan-commits mailing list