Skip to content

Commit 0bf97fc

Browse files
committed
fix codecov
1 parent be41d21 commit 0bf97fc

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

R/froll.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ partial2adaptive = function(x, n, align, adaptive) {
5353
if (length(unique(lengths(n))) != 1L)
5454
stopf("adaptive window provided in 'n' must not to have different lengths")
5555
if (is.numeric(n) && length(n) != len)
56-
stopf("length of integer vector(s) provided as list to 'n' argument must be equal to number of observations provided in 'x'")
56+
stopf("length of 'n' argument must be equal to number of observations provided in 'x'")
5757
if (is.list(n) && length(n[[1L]]) != len)
5858
stopf("length of vectors in 'x' must match to length of adaptive window in 'n'")
5959
if (verbose)

inst/tests/froll.Rraw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,7 @@ test(6006.903, frollmean(1:4, 2L, align="center", partial=TRUE), error="'partial
10321032
test(6006.904, frollmean(list(1:4, 2:4), n, partial=TRUE), error="'partial' does not support variable length of columns in 'x'")
10331033
test(6006.905, frollmean(x, TRUE, partial=TRUE), error="n must be an integer vector or a list of integer vectors")
10341034
test(6006.906, frollmean(x, list(TRUE), partial=TRUE), error="n must be an integer, list is accepted for adaptive TRUE")
1035+
test(6006.907, frollsum(1:4, integer(), partial = TRUE), error = "n must be non 0 length")
10351036

10361037
## partial adaptive
10371038
test(6006.930, frollmean(1:4, rep(2L,4L), adaptive=TRUE, partial=TRUE), c(1,1.5,2.5,3.5))
@@ -1048,6 +1049,8 @@ test(6006.9331, frollsum(1:4, c(2,4,5,6), adaptive=TRUE, partial=TRUE), c(1,3,6,
10481049
test(6006.9332, frollsum(1:4, c(2,4,5,6), align="left", adaptive=TRUE, partial=TRUE), c(3,9,7,4))
10491050
test(6006.9333, frollsum(1:4, c(1,1,3,2), adaptive=TRUE, partial=TRUE), c(1,2,6,7)) ## trailing two bigger than rev index
10501051
test(6006.9334, frollsum(1:4, c(1,1,3,2), align="left", adaptive=TRUE, partial=TRUE), c(1,2,7,4))
1052+
test(6006.9335, frollsum(1:4, list(c(1,1,3,2), c("a","b","c","d")), adaptive=TRUE, partial=TRUE), error = "n must be an integer vector or a list of integer vectors")
1053+
test(6006.9336, frollsum(1:4, c(1,2,3), adaptive=TRUE, partial=TRUE), error = "length of 'n' argument must be equal to number of observations provided in 'x'")
10511054

10521055
## give.names
10531056
test(6006.951, frollsum(1:3, 2, give.names=TRUE), c(NA,3,5))

src/froll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void frollfun(rollfun_t rfun, unsigned int algo, double *x, uint64_t nx, ans_t *
7777
frollmaxExact(x, nx, ans, k, fill, narm, hasnf, verbose);
7878
}
7979
break;
80-
default:
80+
default: // #nocov
8181
error(_("Internal error: Unknown rfun value in froll: %d"), rfun); // #nocov
8282
}
8383
if (align < 1 && ans->status < 3) {

src/frolladaptive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void frolladaptivefun(rollfun_t rfun, unsigned int algo, double *x, uint64_t nx,
3333
}
3434
frolladaptivemaxExact(x, nx, ans, k, fill, narm, hasnf, verbose);
3535
break;
36-
default:
36+
default: // #nocov
3737
error(_("Internal error: Unknown rfun value in froll: %d"), rfun); // #nocov
3838
}
3939
if (verbose)
@@ -592,7 +592,7 @@ void frolladaptiveapply(double *x, int64_t nx, SEXP pw, int *k, ans_t *ans, doub
592592
if (teval0 == REALSXP) {
593593
for (; i<nx; i++) {
594594
if (i+1 < k[i]) {
595-
ans->dbl_v[i] = fill;
595+
ans->dbl_v[i] = fill; // #nocov // this is never reached because smaller i are handled above, leaving it here because this function will be removed in next PR, and adapting it here will only make git conflicts resolution more difficult
596596
} else {
597597
SETLENGTH(pw, k[i]);
598598
memcpy(w, x+(i-k[i]+1), k[i]*sizeof(double));

0 commit comments

Comments
 (0)