def test_onefield_struct(self): parsed_doc = parser.parse(self.xmlOneFieldSource) res = ws.build_struct(parsed_doc["structures"][0], parsed_doc["header"]["name"]) self.assertEqual(res, norm_multiline_str(""" struct stdUDPHeader { byte_order big_endian; muhheader header; uint16 MessageID; } """) )
def test_onefield_struct(self): parsed_doc = parser.parse(self.xmlOneFieldSource) res = ws.build_struct(parsed_doc["structures"][0], parsed_doc["header"]["name"]) self.assertEqual( res, norm_multiline_str(""" struct stdUDPHeader { byte_order big_endian; muhheader header; uint16 MessageID; } """))
def test_multiplefields_struct(self): parsed_doc = parser.parse(self.xmlSource) res = ws.build_struct(parsed_doc["structures"][0], parsed_doc["header"]["name"]) self.assertEqual(res, norm_multiline_str(""" struct stdUDPHeader { byte_order big_endian; muhheader header; uint16 MessageID; uint16 MessageLenght; uint32 MessageCount; int64 MessageSendTime; uint32 MessageChecksum; } """) )
def test_multiplefields_struct(self): parsed_doc = parser.parse(self.xmlSource) res = ws.build_struct(parsed_doc["structures"][0], parsed_doc["header"]["name"]) self.assertEqual( res, norm_multiline_str(""" struct stdUDPHeader { byte_order big_endian; muhheader header; uint16 MessageID; uint16 MessageLenght; uint32 MessageCount; int64 MessageSendTime; uint32 MessageChecksum; } """))
def setUp(self): with open("tests/test_data/stdUDPHeader.xml") as test_data: self.xmlSource = test_data.read() self.parsed_doc = structureparser.parse(self.xmlSource)
def setUp(self): with open("tests/test_data/stdUDPHeader.xml") as stdUDPHeader: self.xmlSource = stdUDPHeader.read() parsed_doc = parser.parse(self.xmlSource) self.res = ws.build_wsgd(parsed_doc, "stdUDPHeader")