]> www.wagner.pp.ru Git - oss/ctypescrypto.git/commitdiff
Some tests for rand module.
authorVictor Wagner <wagner@atlas-card.ru>
Thu, 5 Jun 2014 10:32:18 +0000 (14:32 +0400)
committerVictor Wagner <wagner@atlas-card.ru>
Thu, 5 Jun 2014 10:32:18 +0000 (14:32 +0400)
tests/testrand.py [new file with mode: 0644]

diff --git a/tests/testrand.py b/tests/testrand.py
new file mode 100644 (file)
index 0000000..ec861ba
--- /dev/null
@@ -0,0 +1,28 @@
+from ctypescrypto.rand import *
+import unittest
+
+class TestRand(unittest.TestCase):
+       def test_bytes(self):
+               b=bytes(100)
+               self.assertEqual(len(b),100)
+               b2=bytes(100)
+               self.assertNotEqual(b,b2)
+       def test_pseudo_bytes(self):
+               b=pseudo_bytes(100)
+               self.assertEqual(len(b),100)
+               b2=pseudo_bytes(100)
+               self.assertNotEqual(b,b2)
+       def test_seed(self):
+               b="aaqwrwfsagdsgdsfgdsfgdfsgdsfgdsgfdsfgdsfg"
+               seed(b)
+               # Check if no segfault here
+       def test_entropy(self):
+               b="aaqwrwfsagdsgdsfgdsfgdfsgdsfgdsgfdsfgdsfg"
+               seed(b,2.25)
+               # Check if no segfault here
+       def test_Status(self):
+               i=status()
+               self.assertEqual(i,1)
+
+if __name__ == '__main__':
+       unittest.main()