SmartCane/r_app/run_tests.R
Timon 07aee7bed1 –[200~Improve CI report visualization and migrate to terra package
- Replace raster package with terra throughout the codebase
- Update map visualizations with better layout and legends
- Add descriptive headers to report sections
- Improve map legend positioning and sizing
- Enhance error handling for missing data
- Remove redundant legends in field-specific visualizations
- Optimize figure dimensions to prevent page overflow
- Expand documentation of CI index and report components
- Update package dependencies in packages.
2025-04-22 20:55:02 +02:00

38 lines
982 B
R

# run_tests.R
#
# TEST RUNNER FOR SMARTCANE
# =======================
# This script runs all tests for the SmartCane project.
# Usage: Rscript run_tests.R [test_pattern]
# - test_pattern: Optional regex pattern to match test files (default: all test_*.R files)
#
# Process command line arguments
args <- commandArgs(trailingOnly = TRUE)
test_pattern <- if (length(args) > 0) args[1] else "^test_.+\\.R$"
# Set working directory to script location
script_dir <- dirname(normalizePath(sys.frame(1)$ofile))
setwd(script_dir)
# Source test framework
source("tests/test_framework.R")
# Set up test environment
env <- setup_test_env()
# Run tests
cat("Running tests with pattern:", test_pattern, "\n\n")
success <- run_tests(test_pattern)
# Clean up
teardown_test_env()
# Exit with appropriate status code
if (success) {
cat("\n✓ All tests passed successfully!\n")
quit(save = "no", status = 0)
} else {
cat("\n✗ Some tests failed.\n")
quit(save = "no", status = 1)
}