Closed AGBrown closed 4 years ago
I just had an intermittent test failure on Mutate_ForAnywhere_AddsMutation_BetweenWords
. I'm not sure why, so I'll do test runs until failure again to see if it's an issue with the test fixtures or something else.
It's an issue with the encoding of the test words file scowl wordlist up to 50.txt
in the RandomiseWordsList project. I'll look at a fix for it later/tomorrow.
Thanks @AGBrown - I'm starting work now, but I'll check your changes in more detail tonight.
Encoding issue fixed with 140cf3b
. The file was encoded as windows 1252 after my git clone (according to sublime, which seemed to read it all correctly as compared to the tests which were reading many characters in as ). As the code I grabbed from RandomiseWordsList
used File.OpenText
it was using UTF8 encoding, therefore the accented characters were read as U+FFFC
which failed Char.IsLetterOrDigit
and so the word boundaries were incorrect compared to what was expected by the tests.
I added the nugets to the test project, updated the StreamReader
to use the right encoding and now it reads the accented characters correctly. A 10 minute "run unit tests until fail" run didn't fail so I'm as sure as I can be that this must have been the cause of the error.
TL;DR: the failure didn't really related to the test itself but this was the simplest way to fix and move on for the moment.
Thanks for your work, Andrew. I won't merge this pull request (as appealing as having more than zero unit tests is, I doubt I'll have time to improve coverage). I've responded to the original issue.
PS: you were right about assumption 3 - the EndOfWord
is a special case to make it look more "natural" without whitespace preceding the .
. So I am a sentence.
rather than I am a sentence .
Closing as fix was applied via other means.
This should fix #3 - the
ArgumentOutOfRangeException
inConstantMutator
I've created a unit test project and added a test fixture for the
ConstantMutator
and submitted a fix for the same.I've had to make some guesses about how
ConstantMutator
is meant to behave. I've assumedStringBuilder
may or may not have a trailing space depending on what mutators have done before this one is invoked, e.g."foo"
→". foo"
"foo bar fizz bang"
→"foo . bar fizz bang"
."foo 6"
→"foo 6."
and"foo "
→"foo. "
Assumption (3) in particular seems like it might be wrong, so needs reviewing, but is easy enough to change the tests and code if it needs correcting.
The penultimate commit (
4e8f38b
) will fail the relevant test, and the final commit (bf246f4
) makes the tests pass by fixing theMutate
method. The rest of the commits are just setting up the test infrastructure as there wasn't a unit test project already in place (unless I missed it).