-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make instructions append and hints consistent (#1851)
- Move some content from instructions.append.md which contain hints to hints.md. - Make sure all instructions.append.md files start with the line `# Instructions append`. https://exercism.org/docs/building/tracks/practice-exercises#h-file-docs-introduction-append-md - Make sure all hints.md files start with the line `## General`. https://exercism.org/docs/building/tracks/practice-exercises#h-file-docs-hints-md - Add tests for the correct headings.
- Loading branch information
Showing
24 changed files
with
91 additions
and
42 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...e/accumulate/.docs/instructions.append.md → exercises/practice/accumulate/.docs/hints.md
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
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,16 @@ | ||
## General | ||
|
||
[Slices](https://doc.rust-lang.org/book/2018-edition/ch04-03-slices.html) have additionally to | ||
the normal element access via indexing (slice[index]) many useful functions like | ||
[split_at](https://doc.rust-lang.org/std/primitive.slice.html#method.split_at) or [getting | ||
subslices](https://doc.rust-lang.org/std/primitive.slice.html#method.get) (slice[start..end]). | ||
|
||
You can solve this exercise by just using boring old element access via indexing, but maybe the | ||
other provided functions can make your code cleaner and safer. | ||
|
||
## For Bonus Points | ||
|
||
- To get your function working with all kind of elements which can be ordered, | ||
have a look at the [Ord Trait](https://doc.rust-lang.org/std/cmp/trait.Ord.html). | ||
- To get your function working directly on Vec and Array, you can use the | ||
[AsRef Trait](https://doc.rust-lang.org/std/convert/trait.AsRef.html) |
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
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
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,5 @@ | ||
## General | ||
|
||
- Instead of implementing arbitrary-precision arithmetic from scratch, consider building your type on top of the [num_bigint](https://crates.io/crates/num-bigint) crate. | ||
- You might be able to [derive](https://doc.rust-lang.org/book/2018-edition/appendix-03-derivable-traits.html) some of the required traits. | ||
- `Decimal` is assumed to be a signed type. You do not have to create a separate unsigned type, though you may do so as an implementation detail if you so choose. |
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
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
2 changes: 1 addition & 1 deletion
2
...-linked-list/.docs/instructions.append.md → ...ractice/doubly-linked-list/.docs/hints.md
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
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,5 @@ | ||
# Instructions append | ||
|
||
Note the additional test case in `tests/alloc-attack.rs`. It tests against | ||
algorithmically inefficient implementations. Because of that, it usually times | ||
out online instead of outright failing, leading to a less helpful error message. |
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 +1,3 @@ | ||
# Instructions append | ||
|
||
In the Rust track, tests are run using the command `cargo test`. |
2 changes: 1 addition & 1 deletion
2
.../high-scores/.docs/instructions.append.md → ...cises/practice/high-scores/.docs/hints.md
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,4 +1,4 @@ | ||
# Hints | ||
## General | ||
|
||
Consider retaining a reference to `scores` in the struct - copying is not | ||
necessary. You will require some lifetime annotations, though. |
2 changes: 1 addition & 1 deletion
2
...ries-product/.docs/instructions.append.md → ...ice/largest-series-product/.docs/hints.md
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,4 +1,4 @@ | ||
# Largest Series Product in Rust | ||
## General | ||
|
||
These iterators may be useful, depending on your approach | ||
|
||
|
This file was deleted.
Oops, something went wrong.
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
4 changes: 3 additions & 1 deletion
4
exercises/practice/parallel-letter-frequency/.docs/instructions.append.md
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
2 changes: 1 addition & 1 deletion
2
...actice/poker/.docs/instructions.append.md → exercises/practice/poker/.docs/hints.md
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
5 changes: 4 additions & 1 deletion
5
exercises/practice/reverse-string/.docs/instructions.append.md
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
4 changes: 3 additions & 1 deletion
4
exercises/practice/rna-transcription/.docs/instructions.append.md
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
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
2 changes: 1 addition & 1 deletion
2
...-linked-list/.docs/instructions.append.md → ...ractice/simple-linked-list/.docs/hints.md
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
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
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,4 +1,4 @@ | ||
# Triangle in Rust | ||
# Instructions append | ||
|
||
- [Result](https://doc.rust-lang.org/std/result/index.html) | ||
|
||
|
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
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,32 @@ | ||
use glob::glob; | ||
use utils::fs::cd_into_repo_root; | ||
|
||
// https://exercism.org/docs/building/tracks/practice-exercises#h-file-docs-hints-md | ||
#[test] | ||
fn hints_have_correct_heading() { | ||
cd_into_repo_root(); | ||
for entry in glob("exercises/practice/*/.docs/hints.md").unwrap() { | ||
let path = entry.unwrap(); | ||
let content = std::fs::read_to_string(&path).unwrap(); | ||
assert!( | ||
content.starts_with("## General"), | ||
"incorrect heading in {}", | ||
path.display() | ||
) | ||
} | ||
} | ||
|
||
// https://exercism.org/docs/building/tracks/practice-exercises#h-file-docs-introduction-append-md | ||
#[test] | ||
fn instructions_append_have_correct_heading() { | ||
cd_into_repo_root(); | ||
for entry in glob("exercises/*/*/.docs/instructions.append.md").unwrap() { | ||
let path = entry.unwrap(); | ||
let content = std::fs::read_to_string(&path).unwrap(); | ||
assert!( | ||
content.starts_with("# Instructions append"), | ||
"incorrect heading in {}", | ||
path.display() | ||
) | ||
} | ||
} |