MadsKirkFoged / EngineeringUnits

Working with units made easy with automatic unit-check and converting between units
MIT License
41 stars 10 forks source link

Unit test unicode fixes #49

Closed mschmitz2 closed 5 months ago

mschmitz2 commented 5 months ago

Seems like it all has something to do with non-UTF-8 characters in UTF-8 files...

For some reason, whenever I happened to open the unit test source files in question in Visual Studio, it automatically did some changes on the "dot", "degree" and "cubed" characters. Weird thing was they then showed up in Visual Studio as and in my local git diff as -> . It also wouldn't let me commit anything before reverting the changes and closing without saving.

You can see in my first two commits that I first attempted to fix it by pasting in the correct characters again, the assumption being that they might now be formatted correctly. And that seemed to work too. Interestingly, the diff on this pull request showed the characters replaced by the same characters (but encoded differently..?), e.g. ° -> °.

Eventually, I figured these issues might have something to do with some local settings and that other users might have the same issues as I had before when opening the now changed files. Which is why I ten used the actual unicode, hoping that this is universally true.

Let me know what you think.

Btw, it seems like all these "comparison" tests are within the Angle class, which seems incorrect.

MadsKirkFoged commented 5 months ago

I have in the past also seen this UTF-8 warning in visual studio but never really taken the time to look into it! Great that you did!

Feel free to restructure the tests if something looks odd! I haven't looked at most of the tests for years!

MadsKirkFoged commented 5 months ago

I can see that some of the unittests are failing. Are they also failing when you run them?

mschmitz2 commented 5 months ago

Good catch. I must have forgotten to run the unit tests again after the very last commit, which introduced some errors