„Tets_Python/Main.py“ ändern
parent
c1ddda4493
commit
6f0408e7b8
|
@ -1,58 +1,58 @@
|
||||||
from TotOnline import TotOnline
|
from TotOnline import TotOnline
|
||||||
from StartUpTest import StartUPTest
|
from StartUpTest import StartUPTest
|
||||||
|
|
||||||
|
|
||||||
class Main:
|
class Main:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
print("Main class instantiated")
|
print("Main class instantiated")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
filename = "resources/SmallTest.txt"
|
filename = "resources/Pi_ausgabe_2mal_TimeInSeconds_0_40_asTXT (1).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"
|
filename = "resources/Pi_ausgabe_2mal_TimeInSeconds_0_40_asTXT (1).txt"
|
||||||
with open(filename, "rb") as f:
|
with open(filename, "rb") as f:
|
||||||
binary_data2 = f.read().strip()
|
binary_data2 = f.read().strip()
|
||||||
|
|
||||||
# Call the StarUpTest
|
# Call the StarUpTest
|
||||||
print("StartUp:")
|
print("StartUp:")
|
||||||
result = StartUPTest.monobit_test(binary_data2)
|
result = StartUPTest.monobit_test(binary_data2)
|
||||||
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.test5(binary_data2)
|
result = StartUPTest.autocorrelation_test(binary_data2)
|
||||||
print("Z_tau:", result[0])
|
print("Z_tau:", result[0])
|
||||||
print("test passed (Z_tau > 2326 and Z_tau < 2674):", result[1])
|
print("test passed (Z_tau > 2326 and Z_tau < 2674):", result[1])
|
||||||
|
|
||||||
# Call the TotalFailure-Test
|
# Call the TotalFailure-Test
|
||||||
|
|
||||||
print("Total Failure:")
|
print("Total Failure:")
|
||||||
result = TotOnline.total_failure(binary_data, pattern_length=10)
|
result = TotOnline.total_failure_test(binary_data, 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(binary_data)
|
result = TotOnline.monobit_test(binary_data)
|
||||||
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(binary_data)
|
result = TotOnline.block_frequency_test(binary_data)
|
||||||
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(binary_data)
|
result = TotOnline.run_test(binary_data)
|
||||||
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(binary_data)
|
result = TotOnline.longest_one_block_test(binary_data)
|
||||||
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