diff --git a/inputs/originalInputs.txt b/inputs/originalInputs.txt new file mode 100644 index 0000000000000000000000000000000000000000..82f4becf2abcdf2c979182f28831729b60b7a3ec --- /dev/null +++ b/inputs/originalInputs.txt @@ -0,0 +1,2000 @@ +7 +12 +16 +11 +4 +15 +0 +4 +10 +20 +17 +8 +20 +18 +17 +9 +2 +3 +0 +9 +11 +3 +20 +14 +5 +12 +16 +11 +15 +10 +15 +10 +16 +11 +13 +9 +8 +6 +18 +0 +4 +18 +4 +2 +2 +18 +14 +8 +14 +16 +12 +10 +18 +13 +10 +1 +12 +4 +14 +0 +13 +14 +16 +8 +10 +15 +12 +17 +13 +7 +7 +13 +5 +0 +15 +3 +18 +8 +1 +20 +9 +2 +17 +5 +19 +20 +16 +4 +3 +16 +2 +16 +17 +2 +7 +20 +9 +12 +11 +6 +2 +0 +19 +16 +6 +11 +5 +0 +20 +14 +20 +16 +17 +19 +14 +8 +1 +1 +15 +3 +17 +0 +19 +3 +5 +12 +14 +2 +20 +14 +15 +13 +3 +12 +13 +10 +5 +7 +17 +7 +18 +0 +1 +4 +11 +15 +7 +14 +12 +4 +13 +5 +1 +7 +18 +11 +19 +7 +8 +4 +10 +0 +15 +11 +5 +1 +5 +7 +6 +17 +14 +16 +3 +8 +8 +13 +11 +0 +12 +8 +19 +4 +1 +3 +5 +6 +19 +4 +0 +2 +9 +5 +17 +3 +4 +15 +12 +10 +1 +8 +3 +11 +15 +9 +16 +14 +8 +15 +13 +8 +10 +17 +14 +1 +20 +5 +10 +5 +7 +3 +13 +4 +11 +12 +9 +5 +6 +15 +20 +19 +2 +1 +7 +14 +9 +19 +14 +20 +0 +10 +18 +16 +3 +14 +9 +18 +9 +15 +14 +4 +13 +16 +14 +13 +10 +6 +9 +17 +1 +19 +9 +8 +4 +17 +11 +18 +1 +6 +15 +11 +7 +13 +5 +14 +13 +5 +16 +5 +9 +18 +17 +4 +5 +16 +6 +3 +17 +4 +4 +9 +7 +0 +2 +12 +8 +4 +6 +9 +17 +7 +7 +6 +15 +8 +4 +10 +8 +14 +13 +11 +18 +11 +12 +1 +12 +3 +20 +10 +13 +11 +11 +20 +2 +14 +5 +14 +7 +13 +17 +15 +10 +6 +17 +2 +20 +7 +16 +19 +9 +16 +14 +15 +4 +3 +17 +19 +20 +0 +0 +20 +13 +3 +14 +1 +3 +0 +11 +2 +17 +16 +16 +11 +11 +7 +11 +7 +14 +5 +0 +19 +9 +9 +13 +13 +7 +18 +5 +7 +17 +20 +19 +1 +10 +1 +1 +11 +19 +14 +12 +13 +9 +13 +11 +4 +17 +11 +12 +3 +17 +18 +0 +16 +14 +14 +18 +18 +1 +18 +8 +13 +16 +0 +4 +6 +12 +8 +1 +9 +18 +4 +17 +14 +4 +6 +5 +6 +0 +14 +15 +16 +11 +1 +13 +19 +6 +8 +8 +3 +13 +15 +7 +8 +9 +14 +8 +4 +20 +6 +5 +18 +2 +12 +6 +11 +2 +2 +5 +11 +7 +2 +8 +19 +20 +2 +1 +9 +15 +10 +8 +11 +5 +8 +3 +16 +19 +5 +9 +7 +20 +4 +5 +8 +5 +6 +12 +0 +11 +12 +6 +14 +17 +6 +19 +19 +14 +2 +19 +1 +4 +18 +12 +20 +14 +13 +2 +16 +19 +5 +4 +8 +13 +6 +13 +4 +13 +11 +18 +3 +10 +6 +11 +13 +9 +5 +4 +20 +3 +14 +4 +11 +11 +0 +5 +2 +15 +17 +4 +9 +7 +1 +10 +18 +6 +4 +13 +12 +10 +17 +2 +12 +2 +15 +12 +20 +11 +18 +12 +12 +12 +11 +4 +13 +20 +18 +15 +7 +20 +1 +7 +2 +17 +0 +7 +6 +13 +14 +16 +14 +6 +3 +9 +16 +12 +10 +6 +11 +11 +4 +19 +2 +18 +17 +5 +15 +0 +3 +11 +5 +11 +18 +19 +20 +16 +8 +19 +9 +1 +14 +13 +0 +3 +15 +17 +14 +5 +1 +20 +1 +20 +15 +12 +8 +11 +17 +4 +9 +9 +18 +10 +18 +6 +6 +10 +0 +15 +14 +4 +6 +11 +5 +15 +8 +0 +9 +17 +2 +2 +13 +18 +11 +0 +18 +15 +15 +17 +12 +1 +20 +20 +0 +9 +6 +20 +14 +6 +4 +19 +11 +13 +19 +17 +10 +2 +14 +4 +7 +12 +8 +8 +2 +1 +8 +4 +10 +17 +0 +17 +2 +18 +0 +1 +6 +3 +1 +4 +11 +9 +6 +4 +15 +19 +12 +1 +14 +19 +19 +12 +12 +7 +6 +10 +12 +11 +13 +8 +7 +5 +20 +13 +2 +10 +15 +16 +5 +5 +4 +8 +8 +10 +19 +14 +16 +18 +4 +0 +18 +19 +5 +3 +5 +19 +16 +9 +6 +3 +7 +7 +6 +20 +5 +10 +9 +1 +15 +8 +15 +20 +16 +20 +9 +5 +6 +1 +14 +19 +16 +13 +20 +0 +19 +15 +14 +2 +13 +5 +1 +2 +8 +1 +18 +6 +19 +18 +12 +1 +12 +17 +5 +10 +3 +20 +7 +0 +9 +10 +14 +6 +19 +8 +7 +4 +15 +20 +4 +3 +6 +6 +4 +12 +18 +18 +8 +17 +18 +14 +19 +6 +5 +12 +11 +5 +7 +14 +17 +3 +0 +1 +18 +5 +9 +16 +8 +9 +14 +9 +8 +4 +14 +12 +13 +19 +4 +8 +8 +3 +17 +8 +15 +11 +6 +8 +12 +9 +0 +1 +10 +6 +16 +13 +3 +8 +14 +13 +14 +15 +3 +12 +7 +2 +16 +19 +15 +15 +4 +9 +14 +10 +4 +17 +11 +4 +5 +13 +2 +4 +12 +4 +13 +8 +3 +15 +10 +11 +9 +5 +9 +9 +5 +13 +13 +13 +16 +16 +18 +17 +3 +2 +14 +2 +20 +3 +11 +18 +5 +0 +6 +16 +15 +8 +11 +11 +14 +4 +7 +9 +18 +15 +8 +1 +1 +5 +10 +18 +2 +17 +0 +8 +17 +9 +10 +9 +5 +17 +5 +7 +8 +0 +11 +11 +6 +1 +6 +9 +14 +3 +16 +8 +14 +7 +7 +20 +2 +18 +14 +0 +16 +19 +7 +18 +10 +9 +6 +9 +4 +14 +10 +15 +5 +7 +10 +7 +14 +13 +16 +9 +11 +4 +15 +4 +8 +6 +0 +3 +20 +7 +14 +17 +10 +5 +7 +3 +12 +10 +20 +20 +17 +12 +11 +16 +1 +5 +2 +11 +3 +9 +3 +12 +5 +8 +15 +12 +16 +20 +5 +5 +17 +8 +15 +10 +1 +0 +2 +10 +16 +12 +12 +2 +10 +8 +9 +9 +4 +14 +19 +15 +9 +10 +7 +7 +12 +2 +10 +2 +16 +15 +5 +4 +6 +2 +2 +7 +5 +6 +5 +0 +6 +6 +9 +20 +1 +12 +17 +12 +20 +17 +18 +14 +0 +17 +11 +10 +18 +6 +8 +3 +1 +0 +20 +18 +2 +12 +1 +14 +2 +3 +13 +7 +7 +6 +0 +6 +1 +18 +9 +15 +14 +2 +8 +15 +0 +12 +11 +8 +19 +9 +8 +14 +0 +9 +7 +1 +5 +14 +4 +8 +3 +19 +7 +7 +3 +19 +11 +20 +5 +4 +17 +9 +19 +19 +15 +20 +5 +10 +13 +18 +2 +4 +12 +10 +0 +3 +18 +15 +12 +8 +19 +1 +16 +14 +2 +11 +15 +18 +1 +20 +8 +3 +7 +9 +19 +15 +13 +13 +17 +14 +20 +14 +2 +11 +17 +1 +17 +19 +0 +10 +11 +3 +18 +8 +20 +1 +12 +10 +5 +14 +19 +14 +12 +18 +20 +3 +16 +8 +14 +2 +19 +13 +5 +6 +6 +3 +12 +13 +7 +6 +7 +4 +14 +15 +10 +1 +0 +0 +15 +16 +1 +18 +12 +20 +12 +13 +7 +19 +0 +3 +17 +15 +9 +5 +4 +15 +8 +9 +15 +2 +19 +9 +18 +10 +0 +4 +6 +20 +17 +4 +0 +12 +3 +20 +9 +5 +15 +10 +7 +19 +2 +5 +3 +0 +0 +19 +1 +8 +15 +9 +3 +3 +18 +6 +12 +15 +14 +20 +1 +0 +2 +7 +0 +5 +9 +6 +1 +17 +15 +6 +8 +16 +8 +9 +13 +13 +8 +19 +17 +3 +20 +5 +11 +6 +13 +20 +18 +9 +1 +8 +20 +19 +13 +6 +1 +15 +9 +14 +11 +7 +7 +1 +8 +12 +4 +9 +0 +13 +20 +15 +17 +3 +19 +4 +0 +13 +8 +9 +0 +11 +13 +1 +1 +8 +11 +9 +2 +0 +10 +10 +18 +17 +12 +17 +15 +6 +17 +17 +13 +0 +7 +18 +13 +11 +11 +2 +10 +14 +18 +11 +15 +2 +3 +17 +12 +0 +8 +18 +12 +14 +4 +14 +20 +0 +18 +2 +11 +10 +16 +13 +20 +17 +5 +9 +12 +5 +19 +9 +10 +12 +3 +17 +19 +6 +16 +2 +1 +16 +11 +13 +4 +5 +2 +3 +11 +9 +4 +15 +10 +12 +16 +3 +19 +18 +20 +8 +9 +18 +9 +0 +14 +2 +0 +14 +17 +16 +7 +14 +14 +12 +3 +0 +10 +2 +12 +14 +6 +2 +5 +5 +0 +10 +16 +5 +1 +4 +3 +17 +2 +8 +8 +18 +3 +14 +18 +15 +19 +8 +14 +6 +13 +4 +15 +13 +9 +18 +6 +1 +20 +13 +18 +11 +9 +6 +7 +11 +20 +18 +4 +4 +12 +3 +4 +7 +16 +8 +1 +2 +8 +9 +12 +12 +19 +13 +14 +20 +15 +1 +14 +18 +16 +2 +6 +6 +6 +13 +2 +15 +12 +17 +20 +16 +8 +16 +4 +6 +7 +7 +1 +11 +9 +6 +3 +1 +13 +15 +20 +0 +12 +9 +6 +19 +1 +6 +8 +12 +9 +1 +10 +19 +13 +11 +13 +12 +16 +15 +7 +3 +15 +14 +10 +17 +20 +7 +4 +17 +16 +14 +7 +9 +9 +5 +8 +17 +17 +1 +1 +17 +14 +6 +0 +11 +10 +14 +1 +5 +17 +3 +5 +8 +20 +14 +16 +19 +18 +1 +13 +1 +4 +6 +2 +9 +1 +12 +14 +2 +5 +17 +12 +4 +13 +6 +13 +6 +11 +12 +10 +16 +16 +5 +13 +11 +16 +4 +1 +10 +4 +19 +13 +7 +15 +5 +4 +14 +17 +5 +3 +16 +14 +16 +7 +11 +4 +4 +3 +11 +8 +15 +2 +4 +17 +6 +7 +1 +13 +0 +2 +2 +2 +6 +1 +2 +11 +3 +12 +4 +14 +18 +11 +2 +11 +13 +9 +14 +1 +4 +10 +15 +16 +7 +15 +1 +20 +10 +14 +13 +1 +11 +9 +6 +3 +0 +7 +5 +14 +8 +3 +13 +8 +15 +13 +17 +5 +6 +16 +3 +20 +0 +13 +6 +4 +4 +11 +3 +9 +6 +13 +12 +13 +9 +18 +12 +1 +1 +11 +16 +17 +1 +7 +5 +6 +20 +8 +20 +2 +13 +0 +1 +12 +17 +18 +18 +17 +19 +0 +18 +12 +2 +17 +15 +15 +5 +5 +14 +8 +15 +20 +8 +5 +5 +10 +19 +2 +17 +2 +15 +12 +9 +9 +16 +1 +10 +7 +12 +17 +12 +15 +3 +14 +19 +5 +9 +11 +8 +12 +5 +14 +15 +1 +7 +19 +6 +17 +14 +14 +16 +15 +17 +3 +12 +15 +14 +13 +10 +17 +6 +8 +8 +10 +10 +0 +6 +3 +16 +7 +20 +19 +0 +6 +13 +1 +3 +7 +19 +1 +1 +16 +14 +2 +7 +5 +3 +18 +6 +11 +3 +12 +20 +13 +10 +16 +13 +7 +10 +20 +14 +3 +15 +1 +4 +5 +16 +9 +1 +11 +19 +6 +1 +19 +7 +11 +0 +7 +16 +20 +3 +0 +18 +4 +1 +15 +18 +15 +2 +4 +18 +0 +11 +15 +4 +13 +0 +8 +11 +6 +2 +18 +5 +10 +7 +15 +14 +7 +8 +10 +20 +6 +6 +20 +8 +11 +8 +13 +18 +12 +19 +6 +17 +16 +8 +14 +4 +17 +3 +16 +18 +1 +18 +9 +5 +14 +17 +16 +8 +2 +0 +10 +6 +17 +20 +6 +6 +17 +16 +20 +3 +8 +4 +3 +1 +8 +13 +3 +0 +12 +4 +1 +7 +20 +10 +16 +16 +8 +2 +4 +12 +11 +0 +19 +2 +1 +11 +15 +17 +8 +18 +12 +11 +11 +17 +3 +7 +9 +5 +3 +8 +0 +1 +14 +18 +13 +16 +15 +15 +11 +15 +20 +12 +19 +8 +11 +7 +2 +2 +12 diff --git a/main.py b/main.py index 5d19361177ddd1f448d989a5ed098a46533e19c5..663d3b84d108fcfcd526abdc19ee0ad7fa8059a7 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ import numberGenerator import outputModule import yaml +import test from pathlib import Path def getParameters() -> dict: @@ -31,4 +32,6 @@ if __name__ == '__main__': output = outputModule.computeValues(numbers,min,max) saveInput(numbers) - saveOutput(output) \ No newline at end of file + saveOutput(output) + + test.runTests() \ No newline at end of file diff --git a/outputs/originalHistogram.png b/outputs/originalHistogram.png new file mode 100644 index 0000000000000000000000000000000000000000..01ff33ba575e18a91fd54dec04dbf06588dc5923 Binary files /dev/null and b/outputs/originalHistogram.png differ diff --git a/outputs/originalOutputs.txt b/outputs/originalOutputs.txt new file mode 100644 index 0000000000000000000000000000000000000000..61b893605a52062cb38ceb030df9a78457059d39 --- /dev/null +++ b/outputs/originalOutputs.txt @@ -0,0 +1 @@ +9.8735 \ No newline at end of file diff --git a/parameters.yaml b/parameters.yaml index eafc3458ea93e378858e8b8bd7a698f48db6da40..768b1db91687fe16140ea0765605ccb966a55f88 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -1,4 +1,4 @@ -numbers_to_generate : 100 -seed : #if no value the seed will be random +numbers_to_generate : 2000 +seed : 128 #if no value the seed will be random min_value : 0 #included -max_value : 10 #included \ No newline at end of file +max_value : 20 #included \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000000000000000000000000000000000000..52a498e40ba1e70366e1fa2cf7b18607d4d8e596 --- /dev/null +++ b/test.py @@ -0,0 +1,33 @@ +import hashlib + +def getOriginalInput(): + inputs = [] + with open("inputs/originalInputs.txt","r") as file : + for line in file : + inputs.append(int(line)) + return inputs + +def getNewInput(): + inputs = [] + with open("inputs/inputs.txt","r") as file : + for line in file : + inputs.append(int(line)) + return inputs + +def getOriginalOutput(): + with open("outputs/originalOutputs.txt","r") as file : + return float(file.read()) + +def getNewOutput(): + with open("outputs/outputs.txt","r") as file : + return float(file.read()) + +def getChecksum(file): + with open(file,"rb") as f: + return hashlib.md5(f.read()).hexdigest() + +def runTests(): + assert getOriginalInput() == getNewInput() + assert getOriginalOutput() == getNewOutput() + assert getChecksum("outputs/originalHistogram.png") == getChecksum("outputs/histogram.png") + print ("All tests passed!") \ No newline at end of file