[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Add unittest for daphn3 mutator.



commit 045751341cb75819907f21eb6ce75791482b6875
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Mon Nov 12 20:13:31 2012 +0100

    Add unittest for daphn3 mutator.
---
 tests/test_mutate.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tests/test_mutate.py b/tests/test_mutate.py
new file mode 100644
index 0000000..7e30586
--- /dev/null
+++ b/tests/test_mutate.py
@@ -0,0 +1,15 @@
+import unittest
+from ooni.kit import daphn3
+
+class TestDaphn3(unittest.TestCase):
+    def test_mutate_string(self):
+        original_string = '\x00\x00\x00'
+        mutated = daphn3.daphn3MutateString(original_string, 1)
+        self.assertEqual(mutated, '\x00\x01\x00')
+    def test_mutate_daphn3(self):
+        original_dict = [{'client': '\x00\x00\x00'},
+                {'server': '\x00\x00\x00'}]
+        mutated_dict = daphn3.daphn3Mutate(original_dict,  1, 1)
+        self.assertEqual(mutated_dict, [{'client': '\x00\x00\x00'},
+            {'server': '\x00\x01\x00'}])
+



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits