Skip to content

Commit

Permalink
Fix conditional tests after CRAN errors --> v0.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dschuhmacher committed May 30, 2024
1 parent b1b0388 commit c2afb2b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: kanjistat
Type: Package
Title: A Statistical Framework for the Analysis of Japanese Kanji Characters
Version: 0.14.0
Date: 2024-05-29
Version: 0.14.1
Date: 2024-05-30
Authors@R: c( person("Dominic", "Schuhmacher", email = "[email protected]", role = c("aut","cre"), comment = c(ORCID = "0000-0001-7079-6313")),
person("Lennart", "Finke", email = "[email protected]", role = "aut", comment = c(ORCID = "0009-0003-6908-314X")) )
Maintainer: Dominic Schuhmacher <[email protected]>
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# kanjistat 0.14.1 (2024-05-30)

## Bug fixes

* Some unit tests were performed conditionally on the availability of package spatstat.data rather than kanjistat.data, which led to errors in the CRAN checks whenever spatstat.data was available but kanjistat.data was not. Fixed.

-------------------------------

# kanjistat 0.14.0 (2024-05-29)

## New features
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-kanji1.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test_that("convert_kanji, single entry, simplify", {
expect_equal( convert_kanji(list(kanjivec_ref_fuji), "index"), 1032 )
expect_equal( convert_kanji(list(kanjivec_ref_fuji), "character"), "" )
expect_equal( convert_kanji(list(kanjivec_ref_fuji), "hexmode"), as.hexmode("85e4") )
skip_if_not_installed("spatstat.data")
skip_if_not_installed("kanjistat.data")
# output = "all"
expect_equal( convert_kanji(""), list(index=1032, character="",
hexmode=as.hexmode("85e4"), kanjivec=kanjivec_ref_fuji),
Expand Down Expand Up @@ -87,7 +87,7 @@ test_that("convert_kanji, multiple entries, simplify", {
expect_equal( convert_kanji(list(kanjivec_ref_fuji, kanjivec_ref_fuji), "index"), c(1032, 1032) )
expect_equal( convert_kanji(list(kanjivec_ref_fuji, kanjivec_ref_fuji), "character"), c("", "") )
expect_equal( convert_kanji(list(kanjivec_ref_fuji, kanjivec_ref_fuji), "hexmode"), as.hexmode(c("85e4", "85e4")) )
skip_if_not_installed("spatstat.data")
skip_if_not_installed("kanjistat.data")
# output = "all"
sublist <- list(index=1032, character="", hexmode=as.hexmode("85e4"), kanjivec=kanjivec_ref_fuji)
expect_equal( convert_kanji(c("","")), list(sublist, sublist),
Expand Down Expand Up @@ -144,12 +144,12 @@ test_that("convert_kanji, single entry, don't simplify", {
expect_equal( convert_kanji(list(kanjivec_ref_fuji), "index", simplify=FALSE), list(1032) )
expect_equal( convert_kanji(list(kanjivec_ref_fuji), "character", simplify=FALSE), list("") )
expect_equal( convert_kanji(list(kanjivec_ref_fuji), "hexmode", simplify=FALSE), list(as.hexmode("85e4")) )
skip_if_not_installed("spatstat.data")
skip_if_not_installed("kanjistat.data")
# output = "all"
expect_equal( convert_kanji(list(""), simplify=FALSE)[[1]],
list(index=1032, character="",
hexmode=as.hexmode("85e4"), kanjivec=kanjivec_ref_fuji),
ignore_attr=c("call", "kanjistat_version") )
ignore_attr=c("call", "kanjistat_version") )
# test only the first one also *without* list
expect_equal( convert_kanji(1032, "kanjivec", simplify=FALSE), kanjivec_ref_fuji,
ignore_attr=c("call", "kanjistat_version") )
Expand Down Expand Up @@ -198,7 +198,7 @@ test_that("convert_kanji, multiple entries, don't simplify", {
expect_equal( convert_kanji(list(kanjivec_ref_fuji, kanjivec_ref_fuji), "index", simplify=FALSE), list(1032, 1032) )
expect_equal( convert_kanji(list(kanjivec_ref_fuji, kanjivec_ref_fuji), "character", simplify=FALSE), list("", "") )
expect_equal( convert_kanji(list(kanjivec_ref_fuji, kanjivec_ref_fuji), "hexmode", simplify=FALSE), list(as.hexmode("85e4"), as.hexmode("85e4")) )
skip_if_not_installed("spatstat.data")
skip_if_not_installed("kanjistat.data")
# output = "all"
sublist <- list(index=1032, character="", hexmode=as.hexmode("85e4"), kanjivec=kanjivec_ref_fuji)
expect_equal( convert_kanji(list("",""), simplify=FALSE), list(sublist, sublist),
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-stroke_edit_distance.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# contains indirectly also tests for values of dstrokedit

test_that("sedist, same as Yencken, type does not matter", {
skip_if_not_installed("spatstat.data")
skip_if_not_installed("kanjistat.data")
ind1 <- 384L
ind2 <- c(93L, 413L, 786L, 895L, 1020L, 1137L, 1282L, 1359L, 1433L, 1642L, 1959L)
res <- sedist(ind1, ind2)
Expand Down Expand Up @@ -30,7 +30,7 @@ test_that("sedist, different from Yencken, type does matter", {
0.5, 0.44444444444444442) # sedist first
expect_equal(dstrokedit[ind1,ind2], expected0)
#
skip_if_not_installed("spatstat.data")
skip_if_not_installed("kanjistat.data")
expect_equal( as.vector(sedist(ind1, ind2, type="full")), expected1)
expect_equal( as.vector(sedist(ind1, ind2, type="before_slash")), expected1)
expect_equal( as.vector(sedist(ind1, ind2, type="first")), expected2)
Expand Down

0 comments on commit c2afb2b

Please sign in to comment.