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

Huffman Minimization Mark List Initialization Issue #7

Open
Versifex opened this issue Feb 24, 2013 · 3 comments
Open

Huffman Minimization Mark List Initialization Issue #7

Versifex opened this issue Feb 24, 2013 · 3 comments

Comments

@Versifex
Copy link

The initialization of the List called "mark" in MinimizationOperations.MinimizeHuffman is incomplete, and consequently an Index Out of Bounds error is produced for "mark[n1][n2] = true;" (This is of course only when Automaton.Minimization is set to Automaton.MinimizeHuffman).

@moodmosaic
Copy link
Owner

Thank you for reporting this – The reason is mainly behind the methodology that has been used in to port the code from dk.brics.automaton and xeger.

For each test in the RegexPatternTestCases class we were porting the smallest possible amount of code in order to make the test pass.

However, if we have to port further we need to start with a failing test case in the NotSupportedRegexPatternTestCases class.

I think it would be great if you provide a concrete test case :)

@Versifex
Copy link
Author

Hi Nikos,

Near as I can tell, the MinimizationOperations.MinimizeHuffman method will fail with any input whatsoever for the reason I described... it's just a matter of switching the hard-coded Automaton.Minimization to Automaton.Huffman.

My need for this fix has passed however... I was experiencing the documented .* issue with the default minimization (where the program would never return while running Xeger against a regex like ._G._V.X.), and just wanted to see if the other minimization algorithms handled it better. I've since addressed the issue by stripping off any leading or trailing .* (which I made work for my purposes), and now the default minimization runs just fine.

Otherwise, while I have some experience writing unit tests, it is limited and not very recent. So I fear I would only embarrass myself trying to assist in this area.

@moodmosaic
Copy link
Owner

If you have modified the code to suit your needs you can always send a Pull Request so we have something concrete to discuss.

Pull Requests are more than welcome :)

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

No branches or pull requests

2 participants