From a57db2fda0fb379c2667f8e8a110c9bafc8591a2 Mon Sep 17 00:00:00 2001 From: Orion Yeung <11580988+orionyeung001@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:38:41 -0500 Subject: [PATCH] docs: describe how to run tests including NIST --- README.md | 13 +++++++++++++ tests/nist_tests.rs | 17 +++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/README.md b/README.md index 4cd36567..740e5dfe 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,19 @@ statrs = "*" # replace * by the latest version of the crate. For examples, view [the docs](https://docs.rs/statrs/*/statrs/). +### Running tests + +If you'd like to run all suggested tests, you'll need to download some data from +NIST, we have a script for this and formatting the data in the `tests/` folder. + +```sh +cargo test +./tests/gather_nist_data.sh && cargo test -- --include-ignored nist_ +``` + +If you'd like to modify where the data is downloaded, you can use the environment variable, +`STATRS_NIST_DATA_DIR` for running the script and the tests. + ## Contributing Thanks for your help to improve the project! diff --git a/tests/nist_tests.rs b/tests/nist_tests.rs index a985820f..0f731067 100644 --- a/tests/nist_tests.rs +++ b/tests/nist_tests.rs @@ -1,3 +1,20 @@ +//! This test relies on data that is reusable but not distributable by statrs as +//! such, the data will need to be downloaded from the relevant NIST StRD dataset +//! the parsing for testing assumes data to be of form, +//! ```text +//! sample mean : +//! sample std_dev : +//! sample correlation: +//! [zero or more blank lines] +//! data0 +//! data1 +//! data2 +//! ... +//! ``` +//! This test can be run on it's own from the shell from this folder as +//! ```sh +//! ./gather_nist_data.sh && cargo test -- --ignored nist_ +//! ``` use anyhow::Result; use approx::assert_relative_eq; use statrs::statistics::Statistics;