tcunit / TcUnit

An unit testing framework for Beckhoff's TwinCAT 3
Other
273 stars 75 forks source link

Runtime Error "SSE Invalid Operation" when Asserting a Real after a String #237

Open GustlCGN opened 8 months ago

GustlCGN commented 8 months ago

Describe the bug When running a Test with first an AssertEquals_String with an Empty String and then an AssertEquals_Real a runtime Error can occur. This probably happens because TcUnit is checking all prior assertions which leads to the String being interpreted as a Real which can lead to a Invalid Real and a crash follows. As this check happens with the union of the expected and actual value, the crash also depends on both expected and actual value of the string. My observation is that, one has to be a NaN and the other one has to be really empty for the crash to happen.

To Reproduce Reproducing the problem is difficult, probably because it is depended on the old data in the memory area allocated to the T_MaxString. But if you do first an AssertEquals_String with an Empty String and then an AssertEquals_Real the runtime Error can occur. Maybe if you write directly to the memory area of the string a more deterministic crash can be achieved.

Expected behavior The assertion of the Real should not be dependent on asserting a String before.

Screenshots grafik The picture shows the NaN when the String is interpreted as a Real.

Software versions TcUnit 1.3.0, TwinCAT XAE version 55

Run environment Desktop development machine

Additional context