Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/testthat/test-jnd2xyz.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

jnd_x <- jnd2xyz(cd.flowers, rotate = FALSE)

# After conversion to coordinates, the distance should not be modified
expect_equal(
as.matrix(dist(jnd_x, diag = TRUE, upper = TRUE)),
coldist2mat(cd.flowers)[["dS"]],
tolerance = 1e-6
)

jnd_x_rot <- jnd2xyz(cd.flowers, rotate = TRUE)

expect_snapshot(jnd_x_rot)
Expand All @@ -27,6 +34,12 @@

jnd_xy <- jnd2xyz(cd.flowers, rotate = FALSE)

# After conversion to coordinates, the distance should not be modified
expect_equal(

Check warning on line 38 in tests/testthat/test-jnd2xyz.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=tests/testthat/test-jnd2xyz.R,line=38,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
as.matrix(dist(jnd_xy, diag = TRUE, upper = TRUE)),
coldist2mat(cd.flowers)[["dS"]]
)

jnd_xy_rot <- jnd2xyz(cd.flowers, rotate = TRUE)

expect_snapshot(jnd_xy_rot)
Expand All @@ -47,6 +60,13 @@

jnd_xyz <- jnd2xyz(cd.flowers, rotate = FALSE)

# After conversion to coordinates, the distance should not be modified
expect_equal(
as.matrix(dist(jnd_xyz, diag = TRUE, upper = TRUE)),
coldist2mat(cd.flowers)[["dS"]],
tolerance = 1e-6
)

jnd_xyz_rot <- jnd2xyz(cd.flowers, rotate = TRUE)

expect_snapshot(jnd_xyz_rot)
Expand Down
Loading