diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 78d7b57..3634fc5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,12 @@ - - - - - - + + + - - - - - - - - - - + + + + + + + - - + + - + @@ -276,6 +262,13 @@ + + + + + + + @@ -291,7 +284,7 @@ - + @@ -313,7 +306,7 @@ - + - - - - - - - - - - + + + + + + + + + + - - - + + + + - + - - - - + + + @@ -494,19 +466,46 @@ + + + + + + + + + + + + + + + + + + + + - + - + @@ -560,7 +559,8 @@ - @@ -693,33 +693,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -730,5 +703,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/Aufg4_VerwendungVonUnittest.py b/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/Aufg4_VerwendungVonUnittest.py deleted file mode 100644 index c5c2eee..0000000 --- a/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/Aufg4_VerwendungVonUnittest.py +++ /dev/null @@ -1,2 +0,0 @@ -import unittest - diff --git a/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/__init__.py b/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/krypto/hashes.py b/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/krypto/hashes.py index f92151c..4d35317 100644 --- a/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/krypto/hashes.py +++ b/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/krypto/hashes.py @@ -8,7 +8,7 @@ def hashMod(bytes): result += byte return result % sys.maxsize -if __name__ != "__main__": +if __name__ == "__main__": myByteArray = bytearray("Schokopraline", encoding='utf-8') hashvalue = hashMod(myByteArray) print("Ohne importierten Aufruf lautet der Hashwert zu 'Schokopraline': ", hashvalue) \ No newline at end of file diff --git a/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/test_hashMod.py b/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/test_hashMod.py new file mode 100644 index 0000000..1ca16f2 --- /dev/null +++ b/mEIM-Praktikum_Webentwicklung/Tag2_22.10.2018/test_hashMod.py @@ -0,0 +1,16 @@ +from unittest import TestCase + +from krypto import hashes + + +class TestHashMod(TestCase): + def test_hashMod(self): + firstCall = hashes.hashMod("Sahnetorte".encode('utf-8')) + secondCall = hashes.hashMod("Sahnetorte".encode('utf-8')) + straingeCall = hashes.hashMod("Kirschkuchen".encode('utf-8')) + + self.assertEqual(firstCall, secondCall, "Die Werte sind gleich! -> Test geglückt") # firstCall and secondCall are Equal so test should finish with OK + + self.assertNotEqual(firstCall, straingeCall, "Die Werte sind ungleich, Test ebenfalls geglückt!") # firstCall and straingeCall are not equal so test should finish with OK + + #self.assertEqual(firstCall, straingeCall, "Die Werte sind gleich! -> Test geglückt") # firstCall and Strainge call are not equal but equality is tested. Test should finish with FAILED diff --git a/mEIM-Praktikum_Webentwicklung/__init__.py b/mEIM-Praktikum_Webentwicklung/__init__.py new file mode 100644 index 0000000..e69de29