-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wpm calculation #27
Wpm calculation #27
Conversation
I changed how get_string() works so the checks are failing |
Should I create a new function for just this usecase? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
putting hacktoberfest-accepted
, thx!
I'm not sure why you needed to update the expected_input
logic
src/test_results.rs
Outdated
@@ -113,6 +113,44 @@ impl TestResults { | |||
} | |||
} | |||
|
|||
pub fn get_total_words_correct(spaces: &Vec<usize>, typed_string: &String, expected_input: &String, typed_character_count: usize) -> u32{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to have a unit test for this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll create a couple of tests
src/expected_input.rs
Outdated
@@ -120,16 +119,25 @@ pub trait ExpectedInputInterface { | |||
} | |||
|
|||
impl ExpectedInputInterface for ExpectedInput { | |||
/// Cuts string saved in ExpectedInput at specified length instance and returns it | |||
/// Cuts string saved in ExpectedInput at a whitespace character present after the specified length and returns it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I'm not sure about this change, the logic to cut the input in some exact space is to make sure that the text displayed in the terminal takes exactly one line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the get_string() only being used to get the expected input for comparison with the actual input or am I mistaken? I changed it thinking that was it's only function
ccbd3bc
to
3e1a805
Compare
Closes #5 by modifying wpm calculation to be done using words correct instead of by characters correct.