diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..286188e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c2599cf --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Unit tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose diff --git a/src/calculations.rs b/src/calculations.rs index 6368de6..e4639bc 100644 --- a/src/calculations.rs +++ b/src/calculations.rs @@ -28,7 +28,9 @@ impl Investment { /// # Example /// /// ``` - /// let matches = clap::App::new("investment") + /// use cic::calculations::Investment; + /// + /// let matches = clap::Command::new("investment") /// .arg(clap::Arg::new("principal").default_value("0")) /// .arg(clap::Arg::new("contribution").default_value("1")) /// .arg(clap::Arg::new("rate").default_value("5")) @@ -66,6 +68,9 @@ impl Investment { /// # Example /// /// ``` + /// use cic::calculations::YearlySummary; + /// use cic::calculations::Investment; + /// /// let investment = Investment { /// principal: 1000.0, /// contribution: 100.0, @@ -133,6 +138,9 @@ pub struct YearlySummary { /// # Example /// /// ```no_run +/// use cic::calculations::plot_summary; +/// use cic::calculations::YearlySummary; +/// /// let summary = vec![ /// YearlySummary { year: 1, principal: 1000.0, annual_contribution: 1200.0, total_contribution: 1200.0, annual_interest: 50.0, total_interest: 50.0, total_amount: 2150.0 }, /// // Add more summaries here @@ -198,3 +206,63 @@ pub fn plot_summary(summary: &[YearlySummary]) -> Result<(), Box