diff options
| author | Federico I <git@federicoigne.com> | 2020-03-16 14:42:35 +0000 |
|---|---|---|
| committer | Federico Igne <git@federicoigne.com> | 2021-11-03 18:54:35 +0000 |
| commit | a4b6e4b2e898b7efa0b44b490bd731557b0cc41b (patch) | |
| tree | 2eb81879f22eb42e8884fa3fbea13be396866b75 /nth-prime/tests | |
| parent | 6d468ece96c1e89f73828369be907d17513b455f (diff) | |
| download | exercism-a4b6e4b2e898b7efa0b44b490bd731557b0cc41b.tar.gz exercism-a4b6e4b2e898b7efa0b44b490bd731557b0cc41b.zip | |
[rust] Nth Prime
Diffstat (limited to 'nth-prime/tests')
| -rw-r--r-- | nth-prime/tests/nth-prime.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nth-prime/tests/nth-prime.rs b/nth-prime/tests/nth-prime.rs new file mode 100644 index 0000000..b313ff2 --- /dev/null +++ b/nth-prime/tests/nth-prime.rs | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | use nth_prime as np; | ||
| 2 | |||
| 3 | #[test] | ||
| 4 | fn test_first_prime() { | ||
| 5 | assert_eq!(np::nth(0), 2); | ||
| 6 | } | ||
| 7 | |||
| 8 | #[test] | ||
| 9 | fn test_second_prime() { | ||
| 10 | assert_eq!(np::nth(1), 3); | ||
| 11 | } | ||
| 12 | |||
| 13 | #[test] | ||
| 14 | fn test_sixth_prime() { | ||
| 15 | assert_eq!(np::nth(5), 13); | ||
| 16 | } | ||
| 17 | |||
| 18 | #[test] | ||
| 19 | fn test_big_prime() { | ||
| 20 | assert_eq!(np::nth(10_000), 104_743); | ||
| 21 | } | ||
