Skip to content

Commit

Permalink
skip cwb_encode and cwb_compress_rdx() on Windows in test_encode.R #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Blätte authored and Andreas Blätte committed Feb 29, 2024
1 parent 9a553b1 commit d6e23a1
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions tests/testthat/test_cwb_encode.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,45 @@ test_that(
)

for (p_attr in c("word", "pos", "lemma")){
cwb_makeall(corpus = "BT", p_attribute = p_attr, registry = get_tmp_registry())
cwb_huffcode(corpus = "BT", p_attribute = p_attr, registry = get_tmp_registry())
cwb_compress_rdx(corpus = "BT", p_attribute = p_attr, registry = get_tmp_registry())
cwb_makeall(corpus = "BT", p_attribute = p_attr, registry = regdir)
if (.Platform$OS.type != "windows"){
cwb_huffcode(corpus = "BT", p_attribute = p_attr, registry = regdir)
cwb_compress_rdx(corpus = "BT", p_attribute = p_attr, registry = regdir)
}
}

expect_true(cl_load_corpus(corpus = "BT", registry = get_tmp_registry()))
expect_true(cl_load_corpus(corpus = "BT", registry = regdir))
expect_true(tolower("BT") %in% cl_list_corpora())

# In the CQP context, corpus IDs are uppered - here we knowingly provide
# a lowercase ID that is uppered internally #64
expect_true(cqp_load_corpus(corpus = "bt", registry = get_tmp_registry()))
expect_true(cqp_load_corpus(corpus = "bt", registry = regdir))
expect_true("BT" %in% cqp_list_corpora())

for (p_attr in c("word", "pos", "lemma")){
expect_equal(
cl_attribute_size(corpus = "BT", attribute = p_attr, attribute_type = "p", registry = get_tmp_registry()),
cl_attribute_size(
corpus = "BT",
attribute = p_attr,
attribute_type = "p",
registry = regdir
),
8402
)
}

n <- cl_attribute_size(corpus = "BT", attribute = "word", attribute_type = "p", registry = get_tmp_registry())
n <- cl_attribute_size(
corpus = "BT",
attribute = "word",
attribute_type = "p",
registry = regdir
)
ids <- cl_cpos2id(
"BT", p_attribute = "word", registry = get_tmp_registry(),
"BT", p_attribute = "word", registry = regdir,
cpos = 0L:(n-1L)
)

words <- cl_id2str("BT", p_attribute = "word", registry = get_tmp_registry(), id = ids)
words <- cl_id2str("BT", p_attribute = "word", registry = regdir, id = ids)
expect_equal(table(words == "Liebe")[["TRUE"]], 6)
expect_equal(table(words == "SPD")[["TRUE"]], 31)

Expand Down

0 comments on commit d6e23a1

Please sign in to comment.