def udp_checksum(context): request = Request("unit-test-request") block = Block(name="unit-test-block", request=request) request.push(block) ipv4_packet = QWord(0x01, name="IPv4 Packet") ipv4_src = DWord(0x12345678, name="IPv4 Src Block") ipv4_dst = DWord(0x23456789, name="IPv4 Dst Block") request.push(ipv4_packet) request.push(ipv4_src) request.push(ipv4_dst) checksum = Checksum( block_name="IPv4 Packet", ipv4_src_block_name="IPv4 Src Block", ipv4_dst_block_name="IPv4 Dst Block", request=request, fuzzable=True, algorithm="udp", name="Checksum block", ) request.push(checksum) request.pop() context.uut = checksum context.block = ipv4_packet context.request = request context.ipv4_src = ipv4_src context.ipv4_dst = ipv4_dst
def a_checksum(context): request = Request("unit-test-request") block = Block(name="unit-test-block", request=request) request.push(block) byte1 = Byte(default_value=0x01, name="Byte block 1") byte2 = Byte(default_value=0x02, name="Byte block 2") block.push(byte1) block.push(byte2) checksum = Checksum(block_name="unit-test-block", request=request, fuzzable=True, name="Checksum block") request.push(checksum) request.pop() context.uut = checksum context.block = block context.request = request