Skip to content

implement: src/testing -- #[test], assert!, integration tests with real data #6

@BryanChasko

Description

@BryanChasko

topic: testing

rust has first-class test support built into cargo.

concepts to demonstrate

  • #[test] attribute
  • assert!, assert_eq!, assert_ne!
  • #[should_panic] for expected failures
  • #[cfg(test)] module pattern
  • integration tests in tests/ directory
  • doc tests in /// comments

patriots theme

unit tests for passer_rating() against brady's known 2004 stats.
integration test loading real CSV data from datasets/ and asserting totals.

files

src/testing/test_helpers.rs
tests/integration_stats.rs

reference

python mirror: basic_test_calculator.py, basic_test_hello.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions