inst/unitTests/test_cosmiq.R

#R
.test_.xcmsDescendMin <- function(){
    message("testing xcmsDescendMin ...")
    testData1 <- c(94.365805, 911.18083, 125.8396, 158.5383, 89.768696, 
        472.67183, 951.40073, 94.297452, 122.82489, 161.59248, 
        256.72408, 141.30519, 167.64752, 88.872588, 107.62698, 
        199.35246, 837.26705, 137.3569, 161.33797, 667.60712, 
        169.08174, 146.35956, 1492.52, 264.93567, 114.51734, 
        136.07079, 104.7465, 127.83637, 187.20631, 208.51467, 
        159.98827, 99.312765, 240.19226, 184.40785, 311.59658, 
        652.15195, 1125.3216, 8467.7229, 2108.1767, 125.45002, 
        200.23513, 89.778789, 1436.4147, 307.33846, 1051.151, 
        104.67221, 165.24037, 110.01166, 1701.3935, 136.92837, 
        111.36549, 157.08592, 314.33061, 161.54403, 154.85662, 
        164.49464, 352.04938, 122.82433, 102.00902, 1771.4054, 
        121.45058, 264.77063, 200.40516, 2599.6781, 2166.9528, 
        103.81005, 191.75017, 140.37837, 468.99747, 348.29999, 
        405.68041, 99.888625, 135.12999, 481.11709, 168.44324, 
        132.11153, 394.37709, 149.59329, 457.43132, 470.4804, 
        1239.6893, 187.74328, 289.08741, 791.08485, 135.51586, 
        391.65912, 1717.1127, 505.02457, 1539.691, 1824.1368, 
        119.97852, 168.92077, 311.68533, 192.3587, 392.77587, 
        1258.1984, 4273.7075, 232.04787, 143.3346, 117.00967, 
        156.96842, 139.03079, 140.72256, 259.80668, 690.41912, 
        1338.9439, 140.23548, 932.9534, 151.5618, 4779.3279, 
        188.99176, 1202.3908, 1176.4702, 4112.1439, 7760.9924, 
        3094.4715, 289.9043, 166.90929, 713.65077, 220.32798, 
        1286.573, 1863.6734, 1153.6656, 292.48138, 724.34914, 
        1426.58, 356.2272, 435.58814, 1840.6163, 176.05684, 641.63448, 
        321.8697, 1059.4754)

    testData2<-c(9, 25, 41, 96, 150, 198, 170, 161, 96, 29, 17, 8)

    input.idx <- c(1, 2, 3, 5, 8, 13, 21, 34, 55, 89)
    output.desired <- list(c(1, 1), c(1, 3), c(3, 3), c(5, 5), 
        c(8, 8), c(12, 14), c(21, 22), c(34, 34), c(55, 55), 
        c(88, 89))
    res <- mapply(function(x, y) {
        output <- cosmiq:::.xcmsDescendMin(testData1, istart = x)
        checkTrue(output["ilower"] == y[1])
        checkTrue(output["iupper"] == y[2])
    }, input.idx, output.desired)

    message(cosmiq:::.xcmsDescendMin(testData2))
}
dajofischer/cosmiq documentation built on June 3, 2019, 6:21 p.m.