From 6f0408e7b8b0784ffecd36202b453ece433db8a0 Mon Sep 17 00:00:00 2001 From: Gideon Regehr <2023558@stud.hs-mannheim.de> Date: Tue, 9 May 2023 11:48:17 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9ETets=5FPython/Main.py=E2=80=9C=20?= =?UTF-8?q?=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tets_Python/Main.py | 116 ++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/Tets_Python/Main.py b/Tets_Python/Main.py index 7cda937..d22cae3 100644 --- a/Tets_Python/Main.py +++ b/Tets_Python/Main.py @@ -1,58 +1,58 @@ -from TotOnline import TotOnline -from StartUpTest import StartUPTest - - -class Main: - - def __init__(self): - print("Main class instantiated") - - -if __name__ == "__main__": - filename = "resources/SmallTest.txt" - with open(filename, "rb") as f: - binary_data = f.read().strip() - - filename = "resources/data2.txt" - with open(filename, "rb") as f: - binary_data2 = f.read().strip() - - # Call the StarUpTest - print("StartUp:") - result = StartUPTest.monobit_test(binary_data2) - print("p_value:", result[0]) - print("test passed (p_value >= 0.01):", result[1]) - - result = StartUPTest.test5(binary_data2) - print("Z_tau:", result[0]) - print("test passed (Z_tau > 2326 and Z_tau < 2674):", result[1]) - -# Call the TotalFailure-Test - - print("Total Failure:") - result = TotOnline.total_failure(binary_data, pattern_length=10) - print("p_value:", result[0]) - print("test passed (p_value >= 0.01):", result[1]) - -# Call the Online Test - print("Monobit:") - result = TotOnline.monobit_test(binary_data) - print("p_value:", result[0]) - print("test passed (p_value >= 0.01):", result[1]) - - print("Block Frequency:") - result = TotOnline.block_frequency(binary_data) - print("p_value:", result[0]) - print("test passed (p_value >= 0.01):", result[1]) - - print("Run:") - result = TotOnline.run_test(binary_data) - print("p_value:", result[0]) - print("test passed (p_value >= 0.01):", result[1]) - - print("Longest Run:") - result = TotOnline.longest_one_block_test(binary_data) - print("p_value:", result[0]) - print("test passed (p_value >= 0.01):", result[1]) - - +from TotOnline import TotOnline +from StartUpTest import StartUPTest + + +class Main: + + def __init__(self): + print("Main class instantiated") + + +if __name__ == "__main__": + filename = "resources/Pi_ausgabe_2mal_TimeInSeconds_0_40_asTXT (1).txt" + with open(filename, "rb") as f: + binary_data = f.read().strip() + + filename = "resources/Pi_ausgabe_2mal_TimeInSeconds_0_40_asTXT (1).txt" + with open(filename, "rb") as f: + binary_data2 = f.read().strip() + + # Call the StarUpTest + print("StartUp:") + result = StartUPTest.monobit_test(binary_data2) + print("p_value:", result[0]) + print("test passed (p_value >= 0.01):", result[1]) + + result = StartUPTest.autocorrelation_test(binary_data2) + print("Z_tau:", result[0]) + print("test passed (Z_tau > 2326 and Z_tau < 2674):", result[1]) + +# Call the TotalFailure-Test + + print("Total Failure:") + result = TotOnline.total_failure_test(binary_data, pattern_length=10) + print("p_value:", result[0]) + print("test passed (p_value >= 0.01):", result[1]) + +# Call the Online Test + print("Monobit:") + result = TotOnline.monobit_test(binary_data) + print("p_value:", result[0]) + print("test passed (p_value >= 0.01):", result[1]) + + print("Block Frequency:") + result = TotOnline.block_frequency_test(binary_data) + print("p_value:", result[0]) + print("test passed (p_value >= 0.01):", result[1]) + + print("Run:") + result = TotOnline.run_test(binary_data) + print("p_value:", result[0]) + print("test passed (p_value >= 0.01):", result[1]) + + print("Longest Run:") + result = TotOnline.longest_one_block_test(binary_data) + print("p_value:", result[0]) + print("test passed (p_value >= 0.01):", result[1]) + +