File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -926,6 +926,7 @@ for _ in range(20):
926926 success_count += 1
927927 except:
928928 pass
929+
929930success_count >= 18
930931
931932= Random nested arrays encode/decode correctly
@@ -951,38 +952,43 @@ from scapy.cbor import RandCBORObject
951952rand = RandCBORObject()
952953objects = []
953954for _ in range(100):
955+ obj = None
954956 try:
955957 obj = rand._fix()
956- objects.append(obj)
957958 except:
958959 pass
960+ if obj is not None:
961+ objects.append(obj)
962+
959963len(objects) >= 95
960964
961965= Encode 50 random objects without errors
962966from scapy.cbor import RandCBORObject
963967rand = RandCBORObject()
964968encoded_count = 0
965969for _ in range(50):
970+ obj = rand._fix()
966971 try:
967- obj = rand._fix()
968972 encoded = bytes(obj)
969973 if len(encoded) > 0:
970974 encoded_count += 1
971975 except:
972976 pass
977+
973978encoded_count >= 45
974979
975980= Roundtrip 50 random objects
976981from scapy.cbor import RandCBORObject, CBOR_Codecs
977982rand = RandCBORObject()
978983roundtrip_count = 0
979984for _ in range(50):
985+ obj = rand._fix()
980986 try:
981- obj = rand._fix()
982987 encoded = bytes(obj)
983988 decoded, remainder = CBOR_Codecs.CBOR.dec(encoded)
984989 if remainder == b'':
985990 roundtrip_count += 1
986991 except:
987992 pass
993+
988994roundtrip_count >= 45
You can’t perform that action at this time.
0 commit comments