public void testEncodeToSpec() { byte[] buff = new byte[1024]; int i; MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); MsgIn.Body.List3.Sequence1 S2 = new MsgIn.Body.List3.Sequence1(); Console.WriteLine("[executing test (testEncodeToSpec)(TP_3.3.5.2)]"); m_MsgIn1.getHeader().getHeaderRec().setMessageID(256); S1.getRecord1().setField1(3); S1.getRecord1().setField2(117835012); S2.getRecord1().setField1(8); S2.getRecord1().setField2(202050057); m_MsgIn1.getBody().getList3().addElement(S1); m_MsgIn1.getBody().getList3().addElement(S2); // verifying message level encode is AS-5684 compliant" m_MsgIn1.encode(buff, 0); for (i = 0; i < m_MsgIn1.getSize(); i++) { Assert.AreEqual(i, buff[i]); } }
public void testSetGetOperations() { Console.WriteLine("[executing test (testSetGetOperations)(TP_3.3.5.1)]"); // verifying setMessageID/getMessageID reciprocity" m_MsgIn1.getHeader().getHeaderRec().setMessageID(5); Assert.AreEqual(5, m_MsgIn1.getHeader().getHeaderRec().getMessageID()); m_MsgIn1.getHeader().getHeaderRec().setMessageID(1); Assert.AreEqual(1, m_MsgIn1.getHeader().getHeaderRec().getMessageID()); // verifying setField/getField reciprocity" MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); MsgIn.Body.List3.Sequence1 S2 = new MsgIn.Body.List3.Sequence1(); S1.getRecord1().setField1(5); S1.getRecord1().setField2(500); S2.getRecord1().setField1(6); S2.getRecord1().setField2(600); m_MsgIn1.getBody().getList3().addElement(S1); m_MsgIn2.getBody().getList3().addElement(S2); Assert.AreEqual(5, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(500, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(6, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(600, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(5); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(500); Assert.AreEqual(m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1(), m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2(), m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); // Test copy constructor // verifying copy constructor" MsgIn copy1 = m_MsgIn1; Assert.AreEqual(copy1, m_MsgIn1); Assert.AreEqual(copy1.getBody().getList3().getNumberOfElements(), m_MsgIn1.getBody().getList3().getNumberOfElements()); }
public void testListOperations() { MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); int i, j; Console.WriteLine("[executing test (testListOperations)]"); // verifying MsgIn getNumberOfElements with Add and Delete operations" i = j = 0; for (i = 0; i < 4; i++) { Assert.AreEqual(i, m_MsgIn1.getBody().getList3().getNumberOfElements()); for (j = 0; j < 4; j++) { Assert.AreEqual((i * 4) + j, m_MsgIn2.getBody().getList3().getNumberOfElements()); S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn2.getBody().getList3().addElement(S1); } S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn1.getBody().getList3().addElement(S1); } for (j = 0, i = 16; j < 16; j++, i--) { Assert.AreEqual(i, m_MsgIn2.getBody().getList3().getNumberOfElements()); m_MsgIn2.getBody().getList3().deleteLastElement(); } // verifying deleteElement preserves order & corrects count of remaining elements" for (i = 0; i < 4; i++) { m_MsgIn1.getBody().getList3().getElement(i).getRecord1().setField1((sbyte)(i + 1)); m_MsgIn1.getBody().getList3().getElement(i).getRecord1().setField2((i + 1) * 10); } m_MsgIn1.getBody().getList3().deleteElement(0); Assert.AreEqual(3, m_MsgIn1.getBody().getList3().getNumberOfElements()); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(20, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(3, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(30, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField2()); Assert.AreEqual(4, m_MsgIn1.getBody().getList3().getElement(2).getRecord1().getField1()); Assert.AreEqual(40, m_MsgIn1.getBody().getList3().getElement(2).getRecord1().getField2()); m_MsgIn1.getBody().getList3().deleteElement(1); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getNumberOfElements()); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(20, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(4, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(40, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField2()); m_MsgIn1.getBody().getList3().deleteElement(1); Assert.AreEqual(1, m_MsgIn1.getBody().getList3().getNumberOfElements()); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(20, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); m_MsgIn1.getBody().getList3().deleteElement(0); Assert.AreEqual(0, m_MsgIn1.getBody().getList3().getNumberOfElements()); }
public void testEncodeDecodeOperations() { byte[] buff = new byte[1024]; int i; MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); for (i = 0; i < 1024; i++) { buff[i] = 0; } Console.WriteLine("[executing test (testEncodeDecodeOperations)(TP_3.3.5.3)]"); // verifying message level encode/decode reciprocity" m_MsgIn1.getHeader().getHeaderRec().setMessageID(41); m_MsgIn1.getBody().getList3().addElement(S1); S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn1.getBody().getList3().addElement(S1); m_MsgIn1.getBody().getList3().getElement(0).getRecord1().setField1(15); m_MsgIn1.getBody().getList3().getElement(0).getRecord1().setField2(300); m_MsgIn1.getBody().getList3().getElement(1).getRecord1().setField1(0); m_MsgIn1.getBody().getList3().getElement(1).getRecord1().setField2(65825); m_MsgIn2.getHeader().getHeaderRec().setMessageID(127); S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn2.getBody().getList3().addElement(S1); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(127); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(127); m_MsgIn1.encode(buff, 0); m_MsgIn2.decode(buff, 0); Assert.AreEqual(41, m_MsgIn2.getHeader().getHeaderRec().getMessageID()); Assert.AreEqual(2, m_MsgIn2.getBody().getList3().getNumberOfElements()); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(0, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(65825, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField2()); // verifying header level encode/decode reciprocity" m_MsgIn2.getHeader().getHeaderRec().setMessageID(0); m_MsgIn1.getHeader().encode(buff, 0); m_MsgIn2.getHeader().decode(buff, 0); Assert.AreEqual(41, m_MsgIn2.getHeader().getHeaderRec().getMessageID()); m_MsgIn2.getHeader().getHeaderRec().setMessageID(0); m_MsgIn1.getHeader().getHeaderRec().encode(buff, 0); m_MsgIn2.getHeader().getHeaderRec().decode(buff, 0); Assert.AreEqual(41, m_MsgIn2.getHeader().getHeaderRec().getMessageID()); // verifying body level encode/decode reciprocity" m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField2(0); S1 = new MsgIn.Body.List3.Sequence1(); S1.getRecord1().setField1(0); S1.getRecord1().setField2(0); m_MsgIn2.getBody().getList3().addElement(S1); m_MsgIn1.getBody().encode(buff, 0); m_MsgIn2.getBody().decode(buff, 0); Assert.AreEqual(2, m_MsgIn2.getBody().getList3().getNumberOfElements()); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(0, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(65825, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField2()); // verifying list level encode/decode reciprocity" m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField2(0); S1 = new MsgIn.Body.List3.Sequence1(); S1.getRecord1().setField1(0); S1.getRecord1().setField2(0); m_MsgIn2.getBody().getList3().addElement(S1); m_MsgIn1.getBody().getList3().encode(buff, 0); m_MsgIn2.getBody().getList3().decode(buff, 0); Assert.AreEqual(2, m_MsgIn2.getBody().getList3().getNumberOfElements()); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(0, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(65825, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField2()); // verifying record level encode/decode reciprocity" m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(0); m_MsgIn1.getBody().getList3().getElement(0).getRecord1().encode(buff, 0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().decode(buff, 0); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); }
public void testEncodeDecodeOperations() { byte[] buff = new byte[1024]; int i; MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); for (i = 0; i < 1024; i++) { buff[i] = 0; } Console.WriteLine("[executing test (testEncodeDecodeOperations)(TP_3.3.5.3)]"); // verifying message level encode/decode reciprocity" m_MsgIn1.getHeader().getHeaderRec().setMessageID(41); m_MsgIn1.getBody().getList3().addElement(S1); S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn1.getBody().getList3().addElement(S1); m_MsgIn1.getBody().getList3().getElement(0).getRecord1().setField1(15); m_MsgIn1.getBody().getList3().getElement(0).getRecord1().setField2(300); m_MsgIn1.getBody().getList3().getElement(1).getRecord1().setField1(0); m_MsgIn1.getBody().getList3().getElement(1).getRecord1().setField2(65825); m_MsgIn2.getHeader().getHeaderRec().setMessageID(127); S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn2.getBody().getList3().addElement(S1); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(127); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(127); m_MsgIn1.encode(buff, 0); m_MsgIn2.decode(buff, 0); Assert.AreEqual(41, m_MsgIn2.getHeader().getHeaderRec().getMessageID()); Assert.AreEqual(2, m_MsgIn2.getBody().getList3().getNumberOfElements()); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(0, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(65825, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField2()); // verifying header level encode/decode reciprocity" m_MsgIn2.getHeader().getHeaderRec().setMessageID(0); m_MsgIn1.getHeader().encode(buff, 0); m_MsgIn2.getHeader().decode(buff, 0); Assert.AreEqual(41, m_MsgIn2.getHeader().getHeaderRec().getMessageID()); m_MsgIn2.getHeader().getHeaderRec().setMessageID(0); m_MsgIn1.getHeader().getHeaderRec().encode(buff, 0); m_MsgIn2.getHeader().getHeaderRec().decode(buff, 0); Assert.AreEqual(41, m_MsgIn2.getHeader().getHeaderRec().getMessageID()); // verifying body level encode/decode reciprocity" m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField2(0); S1 = new MsgIn.Body.List3.Sequence1(); S1.getRecord1().setField1(0); S1.getRecord1().setField2(0); m_MsgIn2.getBody().getList3().addElement(S1); m_MsgIn1.getBody().encode(buff, 0); m_MsgIn2.getBody().decode(buff, 0); Assert.AreEqual(2, m_MsgIn2.getBody().getList3().getNumberOfElements()); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(0, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(65825, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField2()); // verifying list level encode/decode reciprocity" m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(1).getRecord1().setField2(0); S1 = new MsgIn.Body.List3.Sequence1(); S1.getRecord1().setField1(0); S1.getRecord1().setField2(0); m_MsgIn2.getBody().getList3().addElement(S1); m_MsgIn1.getBody().getList3().encode(buff, 0); m_MsgIn2.getBody().getList3().decode(buff, 0); Assert.AreEqual(2, m_MsgIn2.getBody().getList3().getNumberOfElements()); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(0, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(65825, m_MsgIn2.getBody().getList3().getElement(1).getRecord1().getField2()); // verifying record level encode/decode reciprocity" m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(0); m_MsgIn1.getBody().getList3().getElement(0).getRecord1().encode(buff, 0); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().decode(buff, 0); Assert.AreEqual(15, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(300, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); }
public void testSetGetOperations() { Console.WriteLine("[executing test (testSetGetOperations)(TP_3.3.5.1)]"); // verifying setMessageID/getMessageID reciprocity" m_MsgIn1.getHeader().getHeaderRec().setMessageID(5); Assert.AreEqual(5, m_MsgIn1.getHeader().getHeaderRec().getMessageID()); m_MsgIn1.getHeader().getHeaderRec().setMessageID(1); Assert.AreEqual(1, m_MsgIn1.getHeader().getHeaderRec().getMessageID()); // verifying setField/getField reciprocity" MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); MsgIn.Body.List3.Sequence1 S2 = new MsgIn.Body.List3.Sequence1(); S1.getRecord1().setField1(5); S1.getRecord1().setField2(500); S2.getRecord1().setField1(6); S2.getRecord1().setField2(600); m_MsgIn1.getBody().getList3().addElement(S1); m_MsgIn2.getBody().getList3().addElement(S2); Assert.AreEqual(5, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(500, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(6, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(600, m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2()); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField1(5); m_MsgIn2.getBody().getList3().getElement(0).getRecord1().setField2(500); Assert.AreEqual(m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField1(), m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(m_MsgIn2.getBody().getList3().getElement(0).getRecord1().getField2(), m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); // Test copy constructor // verifying copy constructor" MsgIn copy1 = m_MsgIn1; Assert.AreEqual(copy1, m_MsgIn1); Assert.AreEqual(copy1.getBody().getList3().getNumberOfElements(), m_MsgIn1.getBody().getList3().getNumberOfElements()); }
public void testListOperations() { MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); int i, j; Console.WriteLine("[executing test (testListOperations)]"); // verifying MsgIn getNumberOfElements with Add and Delete operations" i = j = 0; for (i = 0; i < 4; i++) { Assert.AreEqual(i, m_MsgIn1.getBody().getList3().getNumberOfElements()); for (j = 0; j < 4; j++) { Assert.AreEqual((i * 4) + j, m_MsgIn2.getBody().getList3().getNumberOfElements()); S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn2.getBody().getList3().addElement(S1); } S1 = new MsgIn.Body.List3.Sequence1(); m_MsgIn1.getBody().getList3().addElement(S1); } for (j = 0, i = 16; j < 16; j++, i--) { Assert.AreEqual(i, m_MsgIn2.getBody().getList3().getNumberOfElements()); m_MsgIn2.getBody().getList3().deleteLastElement(); } // verifying deleteElement preserves order & corrects count of remaining elements" for (i = 0; i < 4; i++) { m_MsgIn1.getBody().getList3().getElement(i).getRecord1().setField1((sbyte)(i + 1)); m_MsgIn1.getBody().getList3().getElement(i).getRecord1().setField2((i + 1) * 10); } m_MsgIn1.getBody().getList3().deleteElement(0); Assert.AreEqual(3, m_MsgIn1.getBody().getList3().getNumberOfElements()); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(20, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(3, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(30, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField2()); Assert.AreEqual(4, m_MsgIn1.getBody().getList3().getElement(2).getRecord1().getField1()); Assert.AreEqual(40, m_MsgIn1.getBody().getList3().getElement(2).getRecord1().getField2()); m_MsgIn1.getBody().getList3().deleteElement(1); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getNumberOfElements()); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(20, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); Assert.AreEqual(4, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField1()); Assert.AreEqual(40, m_MsgIn1.getBody().getList3().getElement(1).getRecord1().getField2()); m_MsgIn1.getBody().getList3().deleteElement(1); Assert.AreEqual(1, m_MsgIn1.getBody().getList3().getNumberOfElements()); Assert.AreEqual(2, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField1()); Assert.AreEqual(20, m_MsgIn1.getBody().getList3().getElement(0).getRecord1().getField2()); m_MsgIn1.getBody().getList3().deleteElement(0); Assert.AreEqual(0, m_MsgIn1.getBody().getList3().getNumberOfElements()); }
public void testEncodeToSpec() { byte[] buff = new byte[1024]; int i; MsgIn.Body.List3.Sequence1 S1 = new MsgIn.Body.List3.Sequence1(); MsgIn.Body.List3.Sequence1 S2 = new MsgIn.Body.List3.Sequence1(); Console.WriteLine("[executing test (testEncodeToSpec)(TP_3.3.5.2)]"); m_MsgIn1.getHeader().getHeaderRec().setMessageID(256); S1.getRecord1().setField1(3); S1.getRecord1().setField2(117835012); S2.getRecord1().setField1(8); S2.getRecord1().setField2(202050057); m_MsgIn1.getBody().getList3().addElement(S1); m_MsgIn1.getBody().getList3().addElement(S2); // verifying message level encode is AS-5684 compliant" m_MsgIn1.encode(buff, 0); for (i = 0; i < m_MsgIn1.getSize(); i++) Assert.AreEqual(i, buff[i]); }