/
test-smk-isNaDS.R
89 lines (65 loc) · 1.96 KB
/
test-smk-isNaDS.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#-------------------------------------------------------------------------------
# Copyright (c) 2019-2020 University of Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
#
# Set up
#
context("isNaDS::smk::setup")
#
# Tests
#
context("isNaDS::smk::numeric vector")
test_that("numeric vector isNaDS", {
input <- c(0.1, 1.1, 2.1, 3.1, 4.1)
res <- isNaDS(input)
expect_length(res, 1)
expect_equal(class(res), "logical")
expect_equal(res, FALSE)
})
test_that("numeric vector isNaDS - with NA single", {
input <- c(0.1, NA, 2.1, 3.1, 4.1)
res <- isNaDS(input)
expect_length(res, 1)
expect_equal(class(res), "logical")
expect_equal(res, FALSE)
})
test_that("numeric vector isNaDS - with NA all", {
input <- c(NA, NA, NA, NA, NA)
res <- isNaDS(input)
expect_length(res, 1)
expect_equal(class(res), "logical")
expect_equal(res, TRUE)
})
context("isNaDS::smk::character vector")
test_that("character vector isNaDS", {
input <- c("101", "202", "303", "404", "505")
res <- isNaDS(input)
expect_length(res, 1)
expect_equal(class(res), "logical")
expect_equal(res, FALSE)
})
test_that("character vector isNaDS - with NA single", {
input <- c("101", NA, "303", "404", "505")
res <- isNaDS(input)
expect_length(res, 1)
expect_equal(class(res), "logical")
expect_equal(res, FALSE)
})
test_that("character vector isNaDS - with NA all", {
input <- c(NA, NA, NA, NA, NA)
res <- isNaDS(input)
expect_length(res, 1)
expect_equal(class(res), "logical")
expect_equal(res, TRUE)
})
#
# Done
#
context("isNaDS::smk::shutdown")
context("isNaDS::smk::done")