Skip to content

Commit 7abccea

Browse files
...
1 parent 5eade3e commit 7abccea

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

cpp11test/src/test-doubles.cpp

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -376,35 +376,10 @@ context("doubles-C++") {
376376
}
377377

378378
test_that("as_doubles(integers)") {
379-
/*
380-
cpp11::writable::integers y;
381-
y.push_back(10);
382-
y.push_back(13616);
383-
y.push_back(124);
384-
y.push_back(899);
385-
cpp11::doubles i(cpp11::as_doubles(y));
386-
387-
expect_true(i[0] == 10);
388-
expect_true(i[1] == 13616);
389-
expect_true(i[2] == 124);
390-
expect_true(i[3] == 899);
391-
expect_true(TYPEOF(i) == REALSXP);
392-
393-
cpp11::writable::strings e;
394-
e.push_back("a");
395-
e.push_back("b");
396-
expect_error(cpp11::as_doubles(e));
397-
398-
cpp11::doubles na2(Rf_ScalarReal(NA_REAL));
399-
expect_true(ISNA(na2[0]));
400-
expect_true(cpp11::is_na<double>(na2[0]));
401-
expect_true(cpp11::is_na(na2[0]));
402-
*/
403-
404379
// cpp11::writable::integers na{NA_INTEGER};
405-
cpp11::sexp na(Rf_ScalarInteger(NA_INTEGER));
380+
// cpp11::sexp na();
406381

407-
cpp11::integers na3(cpp11::as_doubles(na));
382+
cpp11::integers na3(cpp11::as_doubles(Rf_ScalarInteger(NA_INTEGER)));
408383
expect_true(na3.size() == 1);
409384
// expect_true(ISNA(na3[0]));
410385
// expect_true(cpp11::is_na<double>(na3[0]));

inst/include/cpp11/doubles.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int na();
149149
template <>
150150
int r_vector<int>::operator[](const R_xlen_t pos) const;
151151

152-
inline integers as_doubles(sexp x) {
152+
inline integers as_doubles(SEXP x) {
153153
/*if (TYPEOF(x) == REALSXP) {
154154
return as_cpp<doubles>(x);
155155
} else

0 commit comments

Comments
 (0)