From 02481656966b0a8dfc95cf3c22bcc049660ff7d4 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Sat, 26 Dec 2020 17:48:38 +0000 Subject: Move Rust exercises in a subdirectory --- .../tests/difference-of-squares.rs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 rust/difference-of-squares/tests/difference-of-squares.rs (limited to 'rust/difference-of-squares/tests/difference-of-squares.rs') diff --git a/rust/difference-of-squares/tests/difference-of-squares.rs b/rust/difference-of-squares/tests/difference-of-squares.rs new file mode 100644 index 0000000..4a029b3 --- /dev/null +++ b/rust/difference-of-squares/tests/difference-of-squares.rs @@ -0,0 +1,46 @@ +use difference_of_squares as squares; + +#[test] +fn test_square_of_sum_1() { + assert_eq!(1, squares::square_of_sum(1)); +} + +#[test] +fn test_square_of_sum_5() { + assert_eq!(225, squares::square_of_sum(5)); +} + +#[test] +fn test_square_of_sum_100() { + assert_eq!(25_502_500, squares::square_of_sum(100)); +} + +#[test] +fn test_sum_of_squares_1() { + assert_eq!(1, squares::sum_of_squares(1)); +} + +#[test] +fn test_sum_of_squares_5() { + assert_eq!(55, squares::sum_of_squares(5)); +} + +#[test] +fn test_sum_of_squares_100() { + assert_eq!(338_350, squares::sum_of_squares(100)); +} + +#[test] +fn test_difference_1() { + assert_eq!(0, squares::difference(1)); +} + +#[test] +fn test_difference_5() { + assert_eq!(170, squares::difference(5)); +} + +#[test] +fn test_difference_100() { + assert_eq!(25_164_150, squares::difference(100)); +} -- cgit v1.2.3