Skip to content

Commit db2213b

Browse files
committed
Add skeleton for Vec<T> and tests
0 parents  commit db2213b

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target/
2+
**/*.rs.bk
3+
Cargo.lock

Diff for: Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "slowsort"
3+
version = "1.0.0"
4+
authors = ["Felix Wittwer <[email protected]>"]
5+
6+
[dependencies]

Diff for: src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pub trait Slowsort {
2+
fn slowsort(&mut self) -> Self;
3+
}
4+
5+
6+
impl<T: Ord> Slowsort for Vec<T> {
7+
fn slowsort(&mut self) -> Vec<T> {
8+
unimplemented!();
9+
}
10+
}

Diff for: tests/sorting.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extern crate slowsort;
2+
3+
use slowsort::*;
4+
5+
#[test]
6+
fn sorts_vectors() {
7+
let mut unsorted_vec = vec![1, 4, 6, 7, 9, 2, 3, 8, 5];
8+
9+
unsorted_vec.slowsort();
10+
11+
assert_eq!(unsorted_vec, vec![1, 2, 3, 4, 5, 6, 7, 8, 9]);
12+
}

0 commit comments

Comments
 (0)