CANopenNode / CANopenEditor

CANopen Object Dictionary Editor
GNU General Public License v3.0
122 stars 60 forks source link

Fix for bug in CanOpenNodeExporter_V4.Make_cname #5

Closed DylanRobertBennett closed 1 year ago

DylanRobertBennett commented 3 years ago

-Bug description- EDSEditor failed on 'Export CanOpenNode..' and threw an exception. The exception was cause by referencing an array out-of-bounds. See picture for exact exception message.

-Commit Summary- Subject: Added a test file for CanOpenNodeExporter_V4.

The method Make_cname in CanOpenNodeExporter_V4 was failing and no tests existed. The test created was replicated from the method make_cname in CanOpenNodeExporter. To create the test CanOpenNodeExporter_V4.Make_cname was changed from private to protected.

Subject: Added string to test that caused an exception in Make_cname().

The string that failed when running 'Export CanOpenNode...' in the EDSEditor was added to the test for CanOpenNodeExporter_V4.Make_cname. Other strings were also added that tests conditions that Make_cname should handle. The exception was caused by an array out-of-bounds error.

Subject: Fixed a bug in the CanOpenNodeExporter_V4.Make_cname.

The method would fail on a array out-of-bounds exception. This was do to and empty string that was added to the tokens list. It was fixed by removing all empty strings from the tokens list as was done in CanOpenNodeExporter.make_cname.

The conditions in the test for this method all failed. The method was modified to pass the conditions in the test.

Exception