Added tests, fixed subfunctions (#3)
This commit is contained in:
parent
606078c355
commit
a8cae95c82
4 changed files with 38 additions and 19 deletions
|
|
@ -35,19 +35,38 @@ test_that("testaaKoordinaatit works as expected", {
|
|||
})
|
||||
|
||||
test_that("lakseKlitik() and subfunctions produce expected output", {
|
||||
expect_equal(neighbors(matrix(c(11, 22, 33, 44), 2), 2), c(1, 2))
|
||||
expect_equal(myintersect(matrix(1:4, 2), matrix(2:5, 2)), 2:4)
|
||||
expect_equal(myintersect(matrix(1:4, 2), matrix(5:8, 2)), integer(0))
|
||||
expect_equal(myintersect(matrix(1:4, 2), matrix(4:7, 2)), 4)
|
||||
expect_true(myisvector(runif(1)))
|
||||
expect_true(myisvector(matrix(runif(1))))
|
||||
expect_true(myisvector(runif(2)))
|
||||
expect_true(myisvector(matrix(runif(2))))
|
||||
expect_true(myisvector(rand(2, 1)))
|
||||
expect_true(myisvector(rand(1, 2)))
|
||||
expect_false(myisvector(rand(2, 2)))
|
||||
expect_equal(mysize(rand(1, 1)), 1)
|
||||
expect_equal(mysize(rand(2, 1)), 2)
|
||||
expect_equal(mysize(rand(1, 2)), 2)
|
||||
expect_equal(mysize(rand(2, 2)), c(2, 2))
|
||||
expect_equal(dec2bitv(1, 2), c(0, 1))
|
||||
expect_equal(dec2bitv(5, 2), c(1, 0, 1))
|
||||
expect_equal(dec2bitv(5, 5), c(0, 0, 1, 0, 1))
|
||||
expect_equal(dec2bitv(5, 1), c(1, 0, 1))
|
||||
expect_equal(dec2bitv(5, 0), c(1, 0, 1))
|
||||
expect_equal(dec2bitv(10, 1), c(1, 0, 1, 0))
|
||||
expect_equal(dec2bitv(10, 5), c(0, 1, 0, 1, 0))
|
||||
expect_equal(dec2bitv(10, 10), c(0, 0, 0, 0, 0, 0, 1, 0, 1, 0))
|
||||
# TODO: test ind2subv()
|
||||
# TODO: test argmin()
|
||||
# TODO: test elim_order()
|
||||
# TODO: test triangulate()
|
||||
# TODO: test neighbors()
|
||||
# TODO: test myintersect()
|
||||
# TODO: test mysubset()
|
||||
# TODO: test findCliques()
|
||||
# TODO: test cliques_to_jtree()
|
||||
# TODO: test minimum_spanning_tree()
|
||||
# TODO: test myunion()
|
||||
# TODO: test argmin()
|
||||
# TODO: test mysize()
|
||||
# TODO: test ind2subv()
|
||||
# TODO: test myisvector()
|
||||
# TODO: ... and anythin left from findCliques.m
|
||||
# TODO: test lakseKlitik()
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue