File: test-is-identical-to-true-false-na.R

package info (click to toggle)
r-cran-assertive.base 0.0-9-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 476 kB
  • sloc: sh: 13; makefile: 2
file content (91 lines) | stat: -rw-r--r-- 1,808 bytes parent folder | download | duplicates (2)
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
90
91
test_that(
  "test is_identical_to_false with false returns true", 
  {
    expect_true(is_identical_to_false(FALSE))
  }
)

test_that(
  "test is_identical_to_false with a false vector returns false", 
  {
    expect_false(is_identical_to_false(logical(2)))
  }
)

test_that(
  "test is_identical_to_false with NA returns false", 
  {
    expect_false(is_identical_to_false(NA))
  }
)

test_that(
  "test is_identical_to_false with false + attr returns allow_attributes", 
  {
    x <- c(truth = FALSE)
    expect_false(is_identical_to_false(x))
    expect_true(is_identical_to_false(x, allow_attributes = TRUE))
  }
)


test_that(
  "test is_identical_to_na with TRUE returns false", 
  {
    expect_false(is_identical_to_na(TRUE))
  }
)

test_that(
  "test is_identical_to_na with NA returns true", 
  {
    expect_true(is_identical_to_na(NA))
  }
)

test_that(
  "test is_identical_to_na with an NA vector.returns false", 
  {
    expect_false(is_identical_to_na(rep.int(NA, 2)))
  }
)

test_that(
  "test is_identical_to_na NA + attr returns allow_attributes", 
  {
    x <- c(truth = NA)
    expect_false(is_identical_to_na(x))
    expect_true(is_identical_to_na(x, allow_attributes = TRUE))
  }
)


test_that(
  "test is_identical_to_true NA returns false", 
  {
    expect_false(is_identical_to_true(NA))
  }
)

test_that(
  "test is_identical_to_true with true returns true", 
  {
    expect_true(is_identical_to_true(TRUE))
  }
)

test_that(
  "test is_identical_to_true with a true vector returns false", 
  {
    expect_false(is_identical_to_true(rep.int(TRUE, 2)))
  }
)

test_that(
  "test is_identical_to_true true + attr returns allow_attributes", 
  {
    x <- c(truth = TRUE)
    expect_false(is_identical_to_true(x))
    expect_true(is_identical_to_true(x, allow_attributes = TRUE))
  }
)