Skip to content
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

Closed
wants to merge 0 commits into from
Closed

Conversation

MercMayhem
Copy link
Contributor

Closes #5 by modifying wpm calculation to be done using words correct instead of by characters correct.

@MercMayhem
Copy link
Contributor Author

I changed how get_string() works so the checks are failing

@MercMayhem
Copy link
Contributor Author

Should I create a new function for just this usecase?

Copy link
Owner

@radlinskii radlinskii left a 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

@@ -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{
Copy link
Owner

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

Copy link
Contributor Author

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

@@ -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
Copy link
Owner

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

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Count WPM only in words that were typed correctly
2 participants