From a24b1513ab9d45d3a59874d53e6a020ff3934dbe Mon Sep 17 00:00:00 2001 From: Urhengulas Date: Wed, 27 Jul 2022 17:56:04 +0200 Subject: [PATCH 1/3] Add unit tests for `fn round_up`. --- src/canary.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/canary.rs b/src/canary.rs index ae7211fd..d8412134 100644 --- a/src/canary.rs +++ b/src/canary.rs @@ -297,3 +297,22 @@ fn prepare_subroutine( Ok(previous_pc) } + +#[cfg(test)] +mod tests { + use super::*; + + use rstest::rstest; + + #[rstest] + #[case(2, 4, 4)] + #[case(4, 4, 4)] + #[case(6, 4, 8)] + #[case(8, 4, 8)] + #[case::odd(5, 3, 6)] + #[should_panic] + #[case::div_zero(4, 0, 0)] + fn test_round_up(#[case] n: u32, #[case] k: u32, #[case] res: u32) { + assert_eq!(round_up(n, k), res); + } +} From 92b3ebdcc656347ef0619a6700b9c99992c20b42 Mon Sep 17 00:00:00 2001 From: Urhengulas Date: Wed, 27 Jul 2022 17:59:16 +0200 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77edc3ea..e1db7a47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] +- [#xxx] Add unit tests for `fn round_up` - [#334] Simplify snapshot tests - [#333] Clean up `enum Outcome` - [#331] Refactor stack painting @@ -20,6 +21,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - [#314] Clarify documentation in README - [#293] Update snapshot tests to new TRACE output +[#xxx]: https://github.com/knurling-rs/probe-run/pull/xxx [#334]: https://github.com/knurling-rs/probe-run/pull/334 [#333]: https://github.com/knurling-rs/probe-run/pull/333 [#331]: https://github.com/knurling-rs/probe-run/pull/331 From a2d29f1389ca4d56340506f3bdd0b206929771ff Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Wed, 27 Jul 2022 18:34:08 +0200 Subject: [PATCH 3/3] Update `CHANGELOG.md` --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1db7a47..3068560e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] -- [#xxx] Add unit tests for `fn round_up` +- [#335] Add unit tests for `fn round_up` - [#334] Simplify snapshot tests - [#333] Clean up `enum Outcome` - [#331] Refactor stack painting @@ -21,7 +21,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - [#314] Clarify documentation in README - [#293] Update snapshot tests to new TRACE output -[#xxx]: https://github.com/knurling-rs/probe-run/pull/xxx +[#335]: https://github.com/knurling-rs/probe-run/pull/335 [#334]: https://github.com/knurling-rs/probe-run/pull/334 [#333]: https://github.com/knurling-rs/probe-run/pull/333 [#331]: https://github.com/knurling-rs/probe-run/pull/331