From c8869d50fa36d9347d035b5dbeca33218f116f27 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:56:22 +0000 Subject: [PATCH 1/2] Initial plan From 81fed4952a98329480f7fe6a75a67dc0506034eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:58:27 +0000 Subject: [PATCH 2/2] Fix named coordinate match test assertions Co-authored-by: asgr <5617132+asgr@users.noreply.github.com> --- DESCRIPTION | 3 ++- tests/testthat.R | 4 ++++ tests/testthat/test-coordinate-matching.R | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test-coordinate-matching.R diff --git a/DESCRIPTION b/DESCRIPTION index 09883c6..4da723c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,6 +11,7 @@ Description: Contains a number of common astronomy utility functions for cosmolo License: LGPL-3 LazyData: TRUE Depends: R (>= 3.00), RANN, NISTunits, pracma -Suggests: plotrix, igraph +Suggests: plotrix, igraph, testthat (>= 3.0.0) LinkingTo: Rcpp NeedsCompilation: yes +Config/testthat/edition: 3 diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..520be89 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(celestial) + +test_check("celestial") diff --git a/tests/testthat/test-coordinate-matching.R b/tests/testthat/test-coordinate-matching.R new file mode 100644 index 0000000..ed94bcb --- /dev/null +++ b/tests/testthat/test-coordinate-matching.R @@ -0,0 +1,11 @@ +test_that("single-coordinate matching chooses the nearest in-radius source", { + matches <- coordmatchsing( + RAref = 0, Decref = 0, + coordcompare = rbind(c(1, 0), c(0, 0)), + rad = 2, radunit = "deg" + ) + + expect_equal(matches$ID, c(2, 1)) + expect_equal(unname(matches$bestmatch["compareID"]), 2) + expect_equal(unname(matches$bestmatch["sep"]), 0, tolerance = 1e-10) +})