Skip to content

Commit 60869d2

Browse files
committed
Remove obsolete combined test file
1 parent b53b80f commit 60869d2

31 files changed

Lines changed: 5773 additions & 5772 deletions

tests/testthat/_snaps/add.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# add1
2+
3+
Code
4+
slow_add1
5+
Output
6+
function(x) {
7+
declare(type(x = double(NA)))
8+
x <- x + 1
9+
x
10+
}
11+
<environment: 0x0>
12+
Code
13+
cat(fsub)
14+
Output
15+
subroutine slow_add1(x, x__len_) bind(c)
16+
use iso_c_binding, only: c_double, c_ptrdiff_t
17+
implicit none
18+
19+
! manifest start
20+
! sizes
21+
integer(c_ptrdiff_t), intent(in), value :: x__len_
22+
23+
! args
24+
real(c_double), intent(in out) :: x(x__len_)
25+
! manifest end
26+
27+
28+
x = (x + 1.0_c_double)
29+
end subroutine
30+
Code
31+
cat(cwrapper)
32+
Output
33+
#define R_NO_REMAP
34+
#include <R.h>
35+
#include <Rinternals.h>
36+
37+
38+
extern void slow_add1(double* const x__, const R_xlen_t x__len_);
39+
40+
SEXP slow_add1_(SEXP _args) {
41+
// x
42+
_args = CDR(_args);
43+
SEXP x = CAR(_args);
44+
if (TYPEOF(x) != REALSXP) {
45+
Rf_error("typeof(x) must be 'double', not '%s'", R_typeToChar(x));
46+
}
47+
x = Rf_duplicate(x);
48+
SETCAR(_args, x);
49+
double* const x__ = REAL(x);
50+
const R_xlen_t x__len_ = Rf_xlength(x);
51+
52+
53+
slow_add1(x__, x__len_);
54+
55+
return x;
56+
}
57+
58+
# add2
59+
60+
Code
61+
slow_add2
62+
Output
63+
function(x, y) {
64+
declare(type(x = integer(n)), type(y = integer(n)))
65+
out <- x + y
66+
out
67+
}
68+
<environment: 0x0>
69+
Code
70+
cat(fsub)
71+
Output
72+
subroutine slow_add2(x, y, out, x__len_) bind(c)
73+
use iso_c_binding, only: c_int, c_ptrdiff_t
74+
implicit none
75+
76+
! manifest start
77+
! sizes
78+
integer(c_ptrdiff_t), intent(in), value :: x__len_
79+
80+
! args
81+
integer(c_int), intent(in) :: x(x__len_)
82+
integer(c_int), intent(in) :: y(x__len_)
83+
integer(c_int), intent(out) :: out(x__len_)
84+
! manifest end
85+
86+
87+
out = (x + y)
88+
end subroutine
89+
Code
90+
cat(cwrapper)
91+
Output
92+
#define R_NO_REMAP
93+
#include <R.h>
94+
#include <Rinternals.h>
95+
96+
97+
extern void slow_add2(
98+
const int* const x__,
99+
const int* const y__,
100+
int* const out__,
101+
const R_xlen_t x__len_);
102+
103+
SEXP slow_add2_(SEXP _args) {
104+
// x
105+
_args = CDR(_args);
106+
SEXP x = CAR(_args);
107+
if (TYPEOF(x) != INTSXP) {
108+
Rf_error("typeof(x) must be 'integer', not '%s'", R_typeToChar(x));
109+
}
110+
const int* const x__ = INTEGER(x);
111+
const R_xlen_t x__len_ = Rf_xlength(x);
112+
113+
// y
114+
_args = CDR(_args);
115+
SEXP y = CAR(_args);
116+
if (TYPEOF(y) != INTSXP) {
117+
Rf_error("typeof(y) must be 'integer', not '%s'", R_typeToChar(y));
118+
}
119+
const int* const y__ = INTEGER(y);
120+
const R_xlen_t y__len_ = Rf_xlength(y);
121+
122+
if (x__len_ != y__len_)
123+
Rf_error("length(y) must equal length(x),"
124+
" but are %0.f and %0.f",
125+
(double)y__len_, (double)x__len_);
126+
const R_xlen_t out__len_ = x__len_;
127+
SEXP out = PROTECT(Rf_allocVector(INTSXP, out__len_));
128+
int* out__ = INTEGER(out);
129+
130+
slow_add2(
131+
x__,
132+
y__,
133+
out__,
134+
x__len_);
135+
136+
UNPROTECT(1);
137+
return out;
138+
}
139+

tests/testthat/_snaps/div-mod.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# %% and %/%
2+
3+
Code
4+
fn
5+
Output
6+
function(a, b) {
7+
declare(type(a = double(n)), type(b = double(n)))
8+
a %% b
9+
}
10+
<environment: 0x0>
11+
Code
12+
cat(fsub)
13+
Output
14+
subroutine fn(a, b, out_, a__len_) bind(c)
15+
use iso_c_binding, only: c_double, c_ptrdiff_t
16+
implicit none
17+
18+
! manifest start
19+
! sizes
20+
integer(c_ptrdiff_t), intent(in), value :: a__len_
21+
22+
! args
23+
real(c_double), intent(in) :: a(a__len_)
24+
real(c_double), intent(in) :: b(a__len_)
25+
real(c_double), intent(out) :: out_(a__len_)
26+
! manifest end
27+
28+
29+
out_ = modulo(a, b)
30+
end subroutine
31+
Code
32+
cat(cwrapper)
33+
Output
34+
#define R_NO_REMAP
35+
#include <R.h>
36+
#include <Rinternals.h>
37+
38+
39+
extern void fn(
40+
const double* const a__,
41+
const double* const b__,
42+
double* const out___,
43+
const R_xlen_t a__len_);
44+
45+
SEXP fn_(SEXP _args) {
46+
// a
47+
_args = CDR(_args);
48+
SEXP a = CAR(_args);
49+
if (TYPEOF(a) != REALSXP) {
50+
Rf_error("typeof(a) must be 'double', not '%s'", R_typeToChar(a));
51+
}
52+
const double* const a__ = REAL(a);
53+
const R_xlen_t a__len_ = Rf_xlength(a);
54+
55+
// b
56+
_args = CDR(_args);
57+
SEXP b = CAR(_args);
58+
if (TYPEOF(b) != REALSXP) {
59+
Rf_error("typeof(b) must be 'double', not '%s'", R_typeToChar(b));
60+
}
61+
const double* const b__ = REAL(b);
62+
const R_xlen_t b__len_ = Rf_xlength(b);
63+
64+
if (a__len_ != b__len_)
65+
Rf_error("length(b) must equal length(a),"
66+
" but are %0.f and %0.f",
67+
(double)b__len_, (double)a__len_);
68+
const R_xlen_t out___len_ = a__len_;
69+
SEXP out_ = PROTECT(Rf_allocVector(REALSXP, out___len_));
70+
double* out___ = REAL(out_);
71+
72+
fn(
73+
a__,
74+
b__,
75+
out___,
76+
a__len_);
77+
78+
UNPROTECT(1);
79+
return out_;
80+
}
81+
82+
---
83+
84+
Code
85+
fn
86+
Output
87+
function(a, b) {
88+
declare(type(a = double(n)), type(b = double(n)))
89+
a %/% b
90+
}
91+
<environment: 0x0>
92+
Code
93+
cat(fsub)
94+
Output
95+
subroutine fn(a, b, out_, a__len_) bind(c)
96+
use iso_c_binding, only: c_double, c_ptrdiff_t
97+
implicit none
98+
99+
! manifest start
100+
! sizes
101+
integer(c_ptrdiff_t), intent(in), value :: a__len_
102+
103+
! args
104+
real(c_double), intent(in) :: a(a__len_)
105+
real(c_double), intent(in) :: b(a__len_)
106+
real(c_double), intent(out) :: out_(a__len_)
107+
! manifest end
108+
109+
110+
out_ = floor(a / b)
111+
end subroutine
112+
Code
113+
cat(cwrapper)
114+
Output
115+
#define R_NO_REMAP
116+
#include <R.h>
117+
#include <Rinternals.h>
118+
119+
120+
extern void fn(
121+
const double* const a__,
122+
const double* const b__,
123+
double* const out___,
124+
const R_xlen_t a__len_);
125+
126+
SEXP fn_(SEXP _args) {
127+
// a
128+
_args = CDR(_args);
129+
SEXP a = CAR(_args);
130+
if (TYPEOF(a) != REALSXP) {
131+
Rf_error("typeof(a) must be 'double', not '%s'", R_typeToChar(a));
132+
}
133+
const double* const a__ = REAL(a);
134+
const R_xlen_t a__len_ = Rf_xlength(a);
135+
136+
// b
137+
_args = CDR(_args);
138+
SEXP b = CAR(_args);
139+
if (TYPEOF(b) != REALSXP) {
140+
Rf_error("typeof(b) must be 'double', not '%s'", R_typeToChar(b));
141+
}
142+
const double* const b__ = REAL(b);
143+
const R_xlen_t b__len_ = Rf_xlength(b);
144+
145+
if (a__len_ != b__len_)
146+
Rf_error("length(b) must equal length(a),"
147+
" but are %0.f and %0.f",
148+
(double)b__len_, (double)a__len_);
149+
const R_xlen_t out___len_ = a__len_;
150+
SEXP out_ = PROTECT(Rf_allocVector(REALSXP, out___len_));
151+
double* out___ = REAL(out_);
152+
153+
fn(
154+
a__,
155+
b__,
156+
out___,
157+
a__len_);
158+
159+
UNPROTECT(1);
160+
return out_;
161+
}
162+

0 commit comments

Comments
 (0)