diff options
| author | Federico I <git@federicoigne.com> | 2020-03-17 20:04:00 +0000 |
|---|---|---|
| committer | Federico Igne <git@federicoigne.com> | 2021-11-03 18:54:52 +0000 |
| commit | 9975f9635cd1c2c58b6c1dbe47585859b0b1d573 (patch) | |
| tree | a9a48f5940f440549ad76d52298d51d9efa509c3 /difference-of-squares/tests/difference-of-squares.rs | |
| parent | 1dfcb5c8c04f94a02c6527cac848f6411c8af32f (diff) | |
| download | exercism-9975f9635cd1c2c58b6c1dbe47585859b0b1d573.tar.gz exercism-9975f9635cd1c2c58b6c1dbe47585859b0b1d573.zip | |
[rust] Difference of Squares
Diffstat (limited to 'difference-of-squares/tests/difference-of-squares.rs')
| -rw-r--r-- | difference-of-squares/tests/difference-of-squares.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/difference-of-squares/tests/difference-of-squares.rs b/difference-of-squares/tests/difference-of-squares.rs new file mode 100644 index 0000000..4a029b3 --- /dev/null +++ b/difference-of-squares/tests/difference-of-squares.rs | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | use difference_of_squares as squares; | ||
| 2 | |||
| 3 | #[test] | ||
| 4 | fn test_square_of_sum_1() { | ||
| 5 | assert_eq!(1, squares::square_of_sum(1)); | ||
| 6 | } | ||
| 7 | |||
| 8 | #[test] | ||
| 9 | fn test_square_of_sum_5() { | ||
| 10 | assert_eq!(225, squares::square_of_sum(5)); | ||
| 11 | } | ||
| 12 | |||
| 13 | #[test] | ||
| 14 | fn test_square_of_sum_100() { | ||
| 15 | assert_eq!(25_502_500, squares::square_of_sum(100)); | ||
| 16 | } | ||
| 17 | |||
| 18 | #[test] | ||
| 19 | fn test_sum_of_squares_1() { | ||
| 20 | assert_eq!(1, squares::sum_of_squares(1)); | ||
| 21 | } | ||
| 22 | |||
| 23 | #[test] | ||
| 24 | fn test_sum_of_squares_5() { | ||
| 25 | assert_eq!(55, squares::sum_of_squares(5)); | ||
| 26 | } | ||
| 27 | |||
| 28 | #[test] | ||
| 29 | fn test_sum_of_squares_100() { | ||
| 30 | assert_eq!(338_350, squares::sum_of_squares(100)); | ||
| 31 | } | ||
| 32 | |||
| 33 | #[test] | ||
| 34 | fn test_difference_1() { | ||
| 35 | assert_eq!(0, squares::difference(1)); | ||
| 36 | } | ||
| 37 | |||
| 38 | #[test] | ||
| 39 | fn test_difference_5() { | ||
| 40 | assert_eq!(170, squares::difference(5)); | ||
| 41 | } | ||
| 42 | |||
| 43 | #[test] | ||
| 44 | fn test_difference_100() { | ||
| 45 | assert_eq!(25_164_150, squares::difference(100)); | ||
| 46 | } | ||
