Skip to content

Commit

Permalink
test skeleton getter
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasRieger committed Aug 19, 2021
1 parent 22f2dba commit 8ec6d8a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/testthat/test_RollingLDA.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ test_that("is.RollingLDA", {
expect_true(is.RollingLDA(init_proto_updated3))
})

test_that("is.LDA", {
expect_true(is.LDA(getLDA(roll_lda)))
expect_true(is.LDA(getLDA(roll_lda), verbose = TRUE))
expect_true(is.LDA(getLDA(roll_proto)))
expect_true(is.LDA(getLDA(roll_lda2)))
expect_true(is.LDA(getLDA(roll_proto2)))
expect_true(is.LDA(getLDA(init_proto)))
expect_true(is.LDA(getLDA(init_proto_updated1)))
expect_true(is.LDA(getLDA(init_proto_updated2)))
expect_true(is.LDA(getLDA(init_proto_updated3)))
})

test_that("chunks: match statistics with expactations", {
expect_equal(getChunks(roll_lda),
data.table(
Expand Down Expand Up @@ -177,3 +189,19 @@ test_that("Parameter LDA match", {
expect_identical(getParam(getLDA(roll_proto2)),
getParam(getLDA(roll_lda2)))
})

test_that("print.RollingLDA", {
# prints not equal
expect_error(expect_output(print(roll_lda), capture.output(print(roll_lda2))))
# RollingLDA Object
expect_output(print(roll_lda), "RollingLDA Object")
expect_output(print(roll_lda2), "RollingLDA Object")

# LDA print is part of RollingLDA print
for(i in capture.output(print(getLDA(roll_lda)))[1:5]){
expect_output(print(roll_lda), i, fixed = TRUE)
}
for(i in capture.output(print(getLDA(roll_lda2)))[1:5]){
expect_output(print(roll_lda2), i, fixed = TRUE)
}
})
11 changes: 11 additions & 0 deletions tests/testthat/test_getter.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
context("Getter")

data("economy_texts")
data("economy_dates")

roll_proto = RollingLDA(economy_texts, economy_dates, "quarter", "6 month",
init = 20, K = 5, n = 10)

test_that("bla", {

})

0 comments on commit 8ec6d8a

Please sign in to comment.