1
test_mergeNamedAtomicVectors <- function()
3
## The function is currently not exported.
4
mergeNamedAtomicVectors <- GenomeInfoDb:::mergeNamedAtomicVectors
6
x <- c(a=1, b=2, c=3, d=NA)
7
checkIdentical(mergeNamedAtomicVectors(x, x), x)
10
checkIdentical(mergeNamedAtomicVectors(x, y1), x)
11
checkIdentical(mergeNamedAtomicVectors(y1, x), x)
13
y2 <- c(c=NA_real_, d=NA_real_, b=NA_real_)
14
checkIdentical(mergeNamedAtomicVectors(x, y2), x)
15
checkIdentical(mergeNamedAtomicVectors(y2, x)[names(x)], x)
16
checkIdentical(mergeNamedAtomicVectors(y2, x)[names(y2)], x[names(y2)])
18
y3 <- c(c=3, e=NA, d=4, b=2)
19
got <- mergeNamedAtomicVectors(x, y3)
20
want <- c(a=1, b=2, c=3, d=4, e=NA)
21
checkIdentical(got, want)
22
got <- mergeNamedAtomicVectors(y3, x)
23
want <- c(c=3, e=NA, d=4, b=2, a=1)
24
checkIdentical(got, want)
26
y4 <- c(c=0, e=NA, d=4, b=0)
27
checkException(mergeNamedAtomicVectors(x, y4), silent=TRUE)
28
checkException(mergeNamedAtomicVectors(y4, x), silent=TRUE)
30
x2 <- c(a=1, b=NA, c=3, d=NA)
31
y5 <- c(c=NA, e=5, d=4, b=2)
32
got <- mergeNamedAtomicVectors(x2, y5)
33
want <- c(a=1, b=2, c=3, d=4, e=5)
34
checkIdentical(got, want)