Skip to content

added my implementation to skeleton#5

Open
haileymandal wants to merge 1 commit intomainfrom
hailey_mandal_codeReview
Open

added my implementation to skeleton#5
haileymandal wants to merge 1 commit intomainfrom
hailey_mandal_codeReview

Conversation

@haileymandal
Copy link

No description provided.

@sarafarag sarafarag requested a review from AaronBird759 June 14, 2023 18:21
@Override
public int count() {
return 0;
if(myString == null){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 16 and 21 can be combined since both will always result in countWords being zero.

public void testCount4() {
fail("Not yet implemented");
//sixth test
public void count_leadingSpace_returnsCorrectCount(){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test seems a little redundant since the test above already tests if a space might accidently count another word.

@Test
public void testRestoreString5()
//twenty-ninth test case
public void restoreString_upperCaseAndLowerCaseLetters_returnsRestoredString()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test might seem be redundant after looking at the implementation, but I can understand why this was tested in the case that the implementation was different.


@Test
//thirtieth test case
public void restoreString_repeatedLetters_returnsRestoredString()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test might be unnecessary since method is only concerned with the indices.

return countWords;
}

String removeSpace = myString.trim();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you could potentially check if removeSpace.equals("") could be checked before going into the for loop since .trim() should remove all the leading and trailing spaces. In the case of the string "_ _ _ _" (spacing between _'s used to clarify example), spaces would be removed, thus leaving you a string "" and you can return before the loop.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants