Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #74 from xoopR/patch_devel
Browse files Browse the repository at this point in the history
patch one test for devel
  • Loading branch information
RaphaelS1 authored Oct 15, 2021
2 parents 196f8eb + fac186f commit e27a19e
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: set6
Title: R6 Mathematical Sets Interface
Version: 0.2.3
Version: 0.2.4
Authors@R:
c(person(given = "Raphael",
family = "Sonabend",
Expand All @@ -13,7 +13,7 @@ Authors@R:
email = "[email protected]"))
Description: An object-oriented package for mathematical sets, upgrading the current gold-standard {sets}. Many forms of mathematical sets are implemented, including (countably finite) sets, tuples, intervals (countably infinite or uncountable), and fuzzy variants. Wrappers extend functionality by allowing symbolic representations of complex operations on sets, including unions, (cartesian) products, exponentiation, and differences (asymmetric and symmetric).
LinkingTo: Rcpp
Imports: checkmate, Rcpp, R6, utils
Imports: checkmate, ooplah, Rcpp, R6, utils
Suggests: knitr, testthat, devtools, rmarkdown
License: MIT + file LICENSE
LazyData: true
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export(testSetList)
export(testSubset)
export(testTuple)
export(useUnicode)
import(ooplah)
importFrom(R6,R6Class)
importFrom(Rcpp,sourceCpp)
useDynLib(set6, .registration = TRUE)
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# set6 0.2.4

* Patch for R devel
* Imported ooplah

# set6 0.2.3

* Containedness checks for 'n' dimensional sets no longer require same length vectors if power is
Expand Down
4 changes: 3 additions & 1 deletion R/operation_setintersect.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
setintersect <- function(x, y) {
if (testCountablyFinite(x) & testCountablyFinite(y) & !inherits(x, "SetWrapper") &
!inherits(y, "SetWrapper")) {
return(Set$new(elements = intersect(x$elements, y$elements)))
elx <- vcapply(x$elements, as.character)
eli <- x$elements[match(vcapply(y$elements, as.character), elx, 0L)]
return(Set$new(elements = eli))
}

if (getR6Class(y) == "Universal") {
Expand Down
2 changes: 2 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#' @import ooplah
#' @importFrom R6 R6Class
NULL

# nocov start
.onLoad <- function(libname, pkgname) {
Expand Down
2 changes: 1 addition & 1 deletion man/set6-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// IntervalContains
std::vector<bool> IntervalContains(NumericVector x, long double inf, long double sup, long double min, long double max, bool bound, const char* class_str);
RcppExport SEXP _set6_IntervalContains(SEXP xSEXP, SEXP infSEXP, SEXP supSEXP, SEXP minSEXP, SEXP maxSEXP, SEXP boundSEXP, SEXP class_strSEXP) {
Expand Down
21 changes: 12 additions & 9 deletions tests/testthat/test_operations_setintersect.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ test_that("ComplementSet", {
})

test_that("ProductSet", {
expect_equal(
setproduct(Set$new(1, 2), Set$new(3, 4), simplify = TRUE) & Set$new(Tuple$new(1, 4)),
Set$new(Tuple$new(1, 4))
)
expect_equal(
(Set$new(1, 2) * Set$new(3, 4)) & Set$new(Tuple$new(1, 4), Tuple$new(5, 6)),
useUnicode(FALSE)
obj <- setproduct(Set$new(1, 2), Set$new(3, 4), simplify = TRUE) &
Set$new(Tuple$new(1, 4))
)
expect_equal((Set$new(1, 2) * Set$new(3, 4)) & Tuple$new(1, 4), Set$new())
expect_message((Set$new(1, 2) * Set$new(3, 4)) & (Set$new(1, 2) * Set$new(3, 4)), "currently not implemented")
expect_equal(as.character(obj), "{(1, 4)}")
obj <- (Set$new(1, 2) * Set$new(3, 4)) &
Set$new(Tuple$new(1, 4), Tuple$new(5, 6))
expect_equal(as.character(obj), "{(1, 4)}")
expect_equal(as.character((Set$new(1, 2) * Set$new(3, 4)) & Tuple$new(1, 4)),
"{}")
expect_message(
(Set$new(1, 2) * Set$new(3, 4)) & (Set$new(1, 2) * Set$new(3, 4)),
"currently not implemented")
useUnicode(TRUE)
})

0 comments on commit e27a19e

Please sign in to comment.