@@ -17,17 +17,19 @@ def compare_blocklists(list1, list2):
1717 assert list1 [i ] == list2 [i ], "block #{} mismatch" .format (i )
1818
1919
20- def test_write_read_all_blocks ():
20+ @pytest .mark .parametrize ("endianness" , ["<" , ">" ])
21+ def test_write_read_all_blocks (endianness ):
2122 # Track the blocks we're writing
2223 out_blocks = []
2324
2425 # Build our original/output session
2526 o_shb = blocks .SectionHeader (
27+ endianness = endianness ,
2628 options = {
2729 "shb_hardware" : "pytest" ,
2830 "shb_os" : "python" ,
2931 "shb_userappl" : "python-pcapng" ,
30- }
32+ },
3133 )
3234 out_blocks .append (o_shb )
3335
@@ -129,7 +131,8 @@ def test_write_read_all_blocks():
129131 compare_blocklists (in_blocks , out_blocks )
130132
131133
132- def test_spb_snap_lengths ():
134+ @pytest .mark .parametrize ("endianness" , ["<" , ">" ])
135+ def test_spb_snap_lengths (endianness ):
133136 """
134137 Simple Packet Blocks present a unique challenge in parsing. The packet does not
135138 contain an explicit "captured length" indicator, only the original observed
@@ -147,7 +150,7 @@ def test_spb_snap_lengths():
147150 data = bytes (range (0 , 256 ))
148151
149152 # First session: no snap length
150- o_shb = blocks .SectionHeader ()
153+ o_shb = blocks .SectionHeader (endianness = endianness )
151154 o_idb = o_shb .new_member (blocks .InterfaceDescription ) # noqa: F841
152155 o_blk1 = o_shb .new_member (blocks .SimplePacket , packet_data = data )
153156
@@ -162,7 +165,7 @@ def test_spb_snap_lengths():
162165 assert i_blk1 .packet_data == data
163166
164167 # Second session: with snap length
165- o_shb = blocks .SectionHeader ()
168+ o_shb = blocks .SectionHeader (endianness = endianness )
166169 o_idb = o_shb .new_member (blocks .InterfaceDescription , snaplen = 32 ) # noqa: F841
167170 o_blk1 = o_shb .new_member (blocks .SimplePacket , packet_data = data [:16 ])
168171 o_blk2 = o_shb .new_member (blocks .SimplePacket , packet_data = data [:32 ])
0 commit comments