Skip to content

Commit

Permalink
fixed default for parameter ordered in *SetEqual functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mllg committed Oct 20, 2015
1 parent 37aaabd commit f8518f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Version 1.6.3 (2015-xx-xx)
* Assertions can now be collected (via `makeAssertCollection()`) and reported
(via `reportAssertions()`).
* `qassert()` can now perform bound checks on strings
* The default for the parameter "ordered" of the *SetEqual functions is now set
to FALSE, as described in the documentation.

Version 1.6.2 (2015-07-26)
-------------------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions R/checkSetEqual.r
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ checkSetEqual = function(x, y, ordered = FALSE) {

#' @rdname checkSetEqual
#' @export
assertSetEqual = function(x, y, ordered = TRUE, add = NULL, .var.name) {
res = checkSetEqual(x, y, ordered)
assertSetEqual = function(x, y, ordered = FALSE, add = NULL, .var.name) {
res = checkSetEqual(x, y, ordered = ordered)
makeAssertion(res, vname(x, .var.name), add)
}

#' @rdname checkSetEqual
#' @export
testSetEqual = function(x, y, ordered = TRUE) {
res = checkSetEqual(x, y, ordered)
testSetEqual = function(x, y, ordered = FALSE) {
res = checkSetEqual(x, y, ordered = ordered)
isTRUE(res)
}

#' @rdname checkSetEqual
#' @template expect
#' @export
expect_set_equal = function(x, y, ordered = TRUE, info = NULL, label = NULL) {
res = checkSetEqual(x, y, ordered)
expect_set_equal = function(x, y, ordered = FALSE, info = NULL, label = NULL) {
res = checkSetEqual(x, y, ordered = ordered)
makeExpectation(res, info = info, label = vname(x, label))
}
6 changes: 3 additions & 3 deletions man/checkSetEqual.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
\usage{
checkSetEqual(x, y, ordered = FALSE)

assertSetEqual(x, y, ordered = TRUE, add = NULL, .var.name)
assertSetEqual(x, y, ordered = FALSE, add = NULL, .var.name)

testSetEqual(x, y, ordered = TRUE)
testSetEqual(x, y, ordered = FALSE)

expect_set_equal(x, y, ordered = TRUE, info = NULL, label = NULL)
expect_set_equal(x, y, ordered = FALSE, info = NULL, label = NULL)
}
\arguments{
\item{x}{[any]\cr
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test_checkSetEqual.r
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
context("checkSetEqual")

test_that("checkSetEqual", {
myobj = letters[1:3]
myobj = letters[3:1]
expect_succ_all(SetEqual, myobj, letters[1:3])
expect_fail_all(SetEqual, myobj, letters[1:3], ordered = TRUE)
myobj = letters[1:2]
expect_fail_all(String, myobj, letters[1:3])

Expand Down

0 comments on commit f8518f7

Please sign in to comment.