diff --git a/Tests/ExporterTests.cs b/Tests/ExporterTests.cs index 16f53eeb..062b2345 100644 --- a/Tests/ExporterTests.cs +++ b/Tests/ExporterTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Xunit; using libEDSsharp; @@ -44,7 +44,7 @@ public void Test_record_objects() subod = new ODentry("Test String 2", 0x01, DataType.VISIBLE_STRING, new string('*', 255), EDSsharp.AccessType.ro, PDOMappingType.optional, od); test = export_one_record_type(subod, ""); - if (test != " {(void*)&CO_OD_RAM.testRecord.testString2, 0x26, 0xFF }," + Environment.NewLine) + if (test != " {(void*)&CO_OD_RAM.testRecord.testString2, 0x36, 0xFF }," + Environment.NewLine) throw (new Exception("export_one_record_type() error test 2")); } @@ -78,7 +78,7 @@ public void TestArrays() string test = print_h_entry(od); - if (test != "/*2000 */ VISIBLE_STRING testArray[32][4];" + Environment.NewLine) + if (test != "/*2000 */ VISIBLE_STRING testArray[4][32];" + Environment.NewLine) throw (new Exception("TestArrays() test 1 failed")); @@ -151,7 +151,7 @@ public void TestArrayNoEntries() od.subobjects.Add(0x03, new ODentry("LINE1", 0x03, DataType.UNSIGNED32, "0x01", EDSsharp.AccessType.ro, PDOMappingType.optional)); test = write_od_line(od); - if (test != "{0x1003, 0x03, 0x06, 0, (void*)&CO_OD_RAM.testArray[0]}," + Environment.NewLine) + if (test != "{0x1003, 0x03, 0x0E, 0, (void*)&CO_OD_RAM.testArray[0]}," + Environment.NewLine) throw (new Exception("TestArrayNoEntries() failed")); diff --git a/Tests/PDOHelperTests.cs b/Tests/PDOHelperTests.cs index 6db83077..df940964 100644 --- a/Tests/PDOHelperTests.cs +++ b/Tests/PDOHelperTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Xunit; using libEDSsharp; @@ -53,10 +53,10 @@ public void Test_TPDO() throw new Exception("Mapping paramaters not generated"); } - if (comparamOD.subobjects.Count != 7) + if (comparamOD.subobjects.Count != 6) throw new Exception("Wrong number of sub objects generated"); - if(comparamOD.Nosubindexes!=7) + if(comparamOD.Nosubindexes!=6) throw new Exception("Wrong number of sub objects generated"); if (comparamOD.subobjects[1].datatype != DataType.UNSIGNED32) @@ -65,8 +65,6 @@ public void Test_TPDO() throw new Exception("Wrong data type for Transmission type"); if (comparamOD.subobjects[3].datatype != DataType.UNSIGNED16) throw new Exception("Wrong data type for Inhibit time"); - if (comparamOD.subobjects[4].datatype != DataType.UNSIGNED8) - throw new Exception("Wrong data type for Compatibility Entry"); if (comparamOD.subobjects[5].datatype != DataType.UNSIGNED16) throw new Exception("Wrong data type for Event timer"); if (comparamOD.subobjects[6].datatype != DataType.UNSIGNED8) @@ -132,22 +130,25 @@ public void Test_RPDO() throw new Exception("Mapping paramaters not generated"); } - if (comparamOD.subobjects.Count != 3) + if (comparamOD.subobjects.Count != 4) throw new Exception("Wrong number of sub objects generated"); - if (comparamOD.Nosubindexes != 3) + if (comparamOD.Nosubindexes != 4) throw new Exception("Wrong number of sub objects generated"); if (comparamOD.subobjects[1].datatype != DataType.UNSIGNED32) throw new Exception("Wrong data type for COB"); if (comparamOD.subobjects[2].datatype != DataType.UNSIGNED8) throw new Exception("Wrong data type for Transmission type"); + if (comparamOD.subobjects[5].datatype != DataType.UNSIGNED16) + throw new Exception("Wrong data type for Transmission type"); if (comparamOD.subobjects[1].defaultvalue != "0x401") //481 hex throw new Exception("TPDO COB wrong"); if (comparamOD.subobjects[2].defaultvalue != "254") throw new Exception("TPDO transmission type wrong"); - + if (comparamOD.subobjects[5].defaultvalue != "20") + throw new Exception("TPDO event timer wrong default value"); } diff --git a/libEDSsharp/CanOpenXDD.cs b/libEDSsharp/CanOpenXDD.cs index 13b40334..616b534f 100644 --- a/libEDSsharp/CanOpenXDD.cs +++ b/libEDSsharp/CanOpenXDD.cs @@ -1118,7 +1118,7 @@ public EDSsharp convert(ISO15745ProfileContainer container) subentry.uniqueID = subobj.uniqueIDRef; - entry.subobjects.Add(subobj.subIndex[0], subentry); + entry.subobjects.Add(subobj.subIndex[subobj.subIndex.Length - 1], subentry); } }