FIXME
This commit is contained in:
parent
222e779da4
commit
04718f77b2
2 changed files with 14 additions and 4 deletions
|
|
@ -2516,10 +2516,11 @@ impl Words {
|
|||
}
|
||||
}
|
||||
|
||||
struct Word(String);
|
||||
// FIXME: This is terrible. Placeholder.
|
||||
pub struct Word(pub String);
|
||||
|
||||
impl Word {
|
||||
fn new(word: String) -> Result<Self, &'static str> {
|
||||
pub fn new(word: String) -> Result<Self, &'static str> {
|
||||
if word.len() >= 1 {
|
||||
Ok(Word(word))
|
||||
} else {
|
||||
|
|
@ -2527,7 +2528,7 @@ impl Word {
|
|||
}
|
||||
}
|
||||
|
||||
fn get(&self) -> &str {
|
||||
pub fn get(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,15 @@ fn test_words() {
|
|||
assert_eq!(words.last, "fox.");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_word() {
|
||||
let word = Word::new(String::from("fox"));
|
||||
assert_eq!(word.unwrap().get(), "fox");
|
||||
|
||||
let word = Word::new(String::from(""));
|
||||
word.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_engine_gender() {
|
||||
let mut e = Engine::new();
|
||||
|
|
@ -89,7 +98,7 @@ fn test_engine_get_count() {
|
|||
let mut e = Engine::new();
|
||||
|
||||
// i32 Into<IntOrString>>
|
||||
for i in -1e3 as i32..1e3 as i32 {
|
||||
for i in -1e2 as i32..1e2 as i32 {
|
||||
assert_eq!(e.get_count(Some(i)), i);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue