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

Implement missing logic in WildPatternMatcher + re-enable unit tests #1348

Merged
merged 3 commits into from
May 30, 2024

Conversation

nemerle
Copy link
Collaborator

@nemerle nemerle commented May 26, 2024

The unit test was also extended to check additional case for patterns ending with wildcard

The unit test was also extended to check additional case
Copy link
Owner

@uxmal uxmal left a comment

Choose a reason for hiding this comment

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

Hello @nemerle ! I've added a few comments to your PR.

}
}
}
return occ_P;
}

private bool isValidPos(int pos,int len,int nextPatternWildcards,int textLength)
Copy link
Owner

Choose a reason for hiding this comment

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

Coding style: for consistency method names are Capitalized. Also, the comment inside the method could be made into a doc comment:

/// <summary>
/// Checks that a match at the position <paramref name="pos" /> is within the text.
/// </summary>

public void Wpm_Wildcard()
{
var dcp = new WildPatternMatcher();
var x = dcp.FindDcp("abracadabraaska", "a**a");
Assert.AreEqual(new[] { 0, 3 }, x.ToArray());
Assert.AreEqual(new[] { 0, 7,11 }, x.ToArray());
Copy link
Owner

Choose a reason for hiding this comment

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

Consider making a separate test case Wpm_WildcardAtEnd

Nemerle and others added 2 commits May 29, 2024 16:47
@uxmal
Copy link
Owner

uxmal commented May 30, 2024

Looks good. Thanks for the contribution!

@uxmal uxmal merged commit 5d233ea into uxmal:master May 30, 2024
6 of 8 checks passed
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.

None yet

2 participants