forked from exercism/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[no important files changed]
- Loading branch information
Showing
3 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use nth_prime::*; | ||
|
||
{% for test in cases %} | ||
#[test] | ||
#[ignore] | ||
fn {{ test.description | snake_case }}() { | ||
let output = nth({{ test.input.number - 1 }}); | ||
let expected = {{ test.expected | json_encode() }}; | ||
assert_eq!(output, expected); | ||
} | ||
{% endfor -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
# This is an auto-generated file. Regular comments will be removed when this | ||
# file is regenerated. Regenerating will not touch any manually added keys, | ||
# so comments can be added in a "comment" key. | ||
# This is an auto-generated file. | ||
# | ||
# Regenerating this file via `configlet sync` will: | ||
# - Recreate every `description` key/value pair | ||
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications | ||
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) | ||
# - Preserve any other key/value pair | ||
# | ||
# As user-added comments (using the # character) will be removed when this file | ||
# is regenerated, comments can be added via a `comment` key. | ||
|
||
[75c65189-8aef-471a-81de-0a90c728160c] | ||
description = "first prime" | ||
|
||
[2c38804c-295f-4701-b728-56dea34fd1a0] | ||
description = "second prime" | ||
|
||
[56692534-781e-4e8c-b1f9-3e82c1640259] | ||
description = "sixth prime" | ||
|
||
[fce1e979-0edb-412d-93aa-2c744e8f50ff] | ||
description = "big prime" | ||
|
||
[bd0a9eae-6df7-485b-a144-80e13c7d55b2] | ||
description = "there is no zeroth prime" | ||
include = false | ||
comment = """ | ||
The zeroth prime was defined to be 2 (zero-based indexing). | ||
Changing it now would be an unnecessary breaking change. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
use nth_prime as np; | ||
use nth_prime::*; | ||
|
||
#[test] | ||
fn first_prime() { | ||
assert_eq!(np::nth(0), 2); | ||
let output = nth(0); | ||
let expected = 2; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn second_prime() { | ||
assert_eq!(np::nth(1), 3); | ||
let output = nth(1); | ||
let expected = 3; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn sixth_prime() { | ||
assert_eq!(np::nth(5), 13); | ||
let output = nth(5); | ||
let expected = 13; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn big_prime() { | ||
assert_eq!(np::nth(10_000), 104_743); | ||
let output = nth(10000); | ||
let expected = 104743; | ||
assert_eq!(output, expected); | ||
} |