Neuer Methodenaufruf
parent
a28c0b5460
commit
de36cc0f25
|
@ -8,52 +8,79 @@ class Main:
|
||||||
print("Main class instantiated")
|
print("Main class instantiated")
|
||||||
|
|
||||||
|
|
||||||
|
def process_data_in_chunks(data, chunk_size=1000000):
|
||||||
|
chunks = [data[i:i+chunk_size] for i in range(0, len(data), chunk_size)]
|
||||||
|
return chunks
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
filename = "resources/data2.txt"
|
filename = "resources/SmallTest.txt"
|
||||||
|
|
||||||
with open(filename, "rb") as f:
|
with open(filename, "rb") as f:
|
||||||
binary_data = f.read().strip()
|
binary_data = f.read().strip()
|
||||||
|
|
||||||
filename = "resources/data2.txt"
|
|
||||||
with open(filename, "rb") as f:
|
with open(filename, "rb") as f:
|
||||||
byte_data = f.read().strip()
|
byte_data = f.read().strip()
|
||||||
|
|
||||||
# Call the StarUpTest
|
print("Run all StartUPTests")
|
||||||
|
binary_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = binary_chunks[0]
|
||||||
|
result = StartUPTest.run_all_tests(first_chunk)
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
print("Run all TotOnline tests")
|
||||||
|
binary_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = binary_chunks[0]
|
||||||
|
result = TotOnline.run_all_tests(first_chunk)
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
# Call the StartUpTest
|
||||||
print("StartUp:")
|
print("StartUp:")
|
||||||
result = StartUPTest.monobit_test(byte_data)
|
binary_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = binary_chunks[0]
|
||||||
|
result = StartUPTest.monobit_test(first_chunk)
|
||||||
print("p_value:", result[0])
|
print("p_value:", result[0])
|
||||||
print("test passed (p_value >= 0.01):", result[1])
|
print("test passed (p_value >= 0.01):", result[1])
|
||||||
|
|
||||||
result = StartUPTest.chi_square(byte_data)
|
result = StartUPTest.chi_square(first_chunk)
|
||||||
print("p_value:", result[0])
|
print("p_value:", result[0])
|
||||||
print("test passed (p_value >= 0.01):", result[1])
|
print("test passed (p_value >= 0.01):", result[1])
|
||||||
print("Chi2_statistic", result[2])
|
print("Chi2_statistic", result[2])
|
||||||
|
|
||||||
# Call the TotalFailure-Test
|
# Call the TotalFailure-Test
|
||||||
|
|
||||||
print("Total Failure:")
|
print("Total Failure:")
|
||||||
result = TotOnline.total_failure_test(byte_data, pattern_length=10)
|
byte_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = byte_chunks[0]
|
||||||
|
result = TotOnline.total_failure_test(first_chunk, pattern_length=10)
|
||||||
print("p_value:", result[0])
|
print("p_value:", result[0])
|
||||||
print("test passed (p_value >= 0.01):", result[1])
|
print("test passed (p_value >= 0.01):", result[1])
|
||||||
|
|
||||||
# Call the Online Test
|
|
||||||
|
# Call the Online Test
|
||||||
print("Monobit:")
|
print("Monobit:")
|
||||||
result = TotOnline.monobit_test(byte_data)
|
byte_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = byte_chunks[0]
|
||||||
|
result = TotOnline.monobit_test(first_chunk)
|
||||||
print("p_value:", result[0])
|
print("p_value:", result[0])
|
||||||
print("test passed (p_value >= 0.01):", result[1])
|
print("test passed (p_value >= 0.01):", result[1])
|
||||||
|
|
||||||
print("Block Frequency:")
|
print("Block Frequency:")
|
||||||
result = TotOnline.block_frequency_test(byte_data)
|
byte_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = byte_chunks[0]
|
||||||
|
result = TotOnline.block_frequency_test(first_chunk)
|
||||||
print("p_value:", result[0])
|
print("p_value:", result[0])
|
||||||
print("test passed (p_value >= 0.01):", result[1])
|
print("test passed (p_value >= 0.01):", result[1])
|
||||||
|
|
||||||
print("Run:")
|
print("Run:")
|
||||||
result = TotOnline.run_test(byte_data)
|
byte_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = byte_chunks[0]
|
||||||
|
result = TotOnline.run_test(first_chunk)
|
||||||
print("p_value:", result[0])
|
print("p_value:", result[0])
|
||||||
print("test passed (p_value >= 0.01):", result[1])
|
print("test passed (p_value >= 0.01):", result[1])
|
||||||
|
|
||||||
print("Longest Run:")
|
print("Longest Run:")
|
||||||
result = TotOnline.longest_one_block_test(byte_data)
|
byte_chunks = process_data_in_chunks(byte_data)
|
||||||
|
first_chunk = byte_chunks[0]
|
||||||
|
result = TotOnline.longest_one_block_test(first_chunk)
|
||||||
print("p_value:", result[0])
|
print("p_value:", result[0])
|
||||||
print("test passed (p_value >= 0.01):", result[1])
|
print("test passed (p_value >= 0.01):", result[1])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue