Skip to content

Commit 9b4477d

Browse files
committed
use integer rather than numeric for pkg test
1 parent dfb201a commit 9b4477d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/testthat/pkg/RcppParallelTest/src/test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ using namespace RcppParallel;
88
struct Sum : public Worker
99
{
1010
// source vector
11-
const RVector<double> input;
11+
const RVector<int> input;
1212

1313
// accumulated value
14-
double value;
14+
int value;
1515

1616
// constructors
17-
Sum(const NumericVector input) : input(input), value(0) {}
17+
Sum(const IntegerVector input) : input(input), value(0) {}
1818
Sum(const Sum& sum, Split) : input(sum.input), value(0) {}
1919

2020
// accumulate just the element of the range I've been asked to
2121
void operator()(std::size_t begin, std::size_t end) {
22-
value += std::accumulate(input.begin() + begin, input.begin() + end, 0.0);
22+
value += std::accumulate(input.begin() + begin, input.begin() + end, 0);
2323
}
2424

2525
// join my value with that of another Sum
@@ -29,7 +29,7 @@ struct Sum : public Worker
2929
};
3030

3131
// [[Rcpp::export]]
32-
double parallelVectorSum(NumericVector x) {
32+
double parallelVectorSum(IntegerVector x) {
3333

3434
// declare the SumBody instance
3535
Sum sum(x);

tests/testthat/test-pkg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test_that( "linking from a package works", {
1414
intern = TRUE, ignore.stderr = TRUE)
1515
require(RcppParallelTest, lib.loc = templib, quietly = TRUE)
1616

17-
v <- as.numeric(c(1:10000))
17+
v <- as.integer(c(1:1000))
1818

1919
expect_equal(
2020
sum(v),

0 commit comments

Comments
 (0)