forked from tidyverse/dplyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle regular number, NA and NaN in comparison<REALSXP>. closes tidy…
- Loading branch information
1 parent
7660827
commit 609cdd3
Showing
5 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
context("internals") | ||
|
||
test_that("comparisons<REALSXP> works as expected (#275)", { | ||
res <- test_comparisons() | ||
expect_true( all(res) ) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <dplyr.h> | ||
|
||
using namespace Rcpp ; | ||
using namespace dplyr ; | ||
|
||
// [[Rcpp::export]] | ||
LogicalVector test_comparisons(){ | ||
dplyr::comparisons<REALSXP> comp ; | ||
return LogicalVector::create( | ||
comp.is_less( 1.0, 2.0 ), | ||
!comp.is_less( 2.0, 1.0 ), | ||
comp.is_less( NA_REAL, R_NaN ), | ||
! comp.is_less( R_NaN, NA_REAL), | ||
! comp.is_less( NA_REAL, 1.0 ), | ||
! comp.is_less( R_NaN, 1.0 ), | ||
comp.is_less( 1.0, NA_REAL ), | ||
comp.is_less( 1.0, R_NaN ) | ||
) ; | ||
} | ||
|