]> www.wagner.pp.ru Git - oss/ctypescrypto.git/blob - tests/testrand.py
ec861ba201cc3963745a83fe755db7a48c5a00cc
[oss/ctypescrypto.git] / tests / testrand.py
1 from ctypescrypto.rand import *
2 import unittest
3
4 class TestRand(unittest.TestCase):
5         def test_bytes(self):
6                 b=bytes(100)
7                 self.assertEqual(len(b),100)
8                 b2=bytes(100)
9                 self.assertNotEqual(b,b2)
10         def test_pseudo_bytes(self):
11                 b=pseudo_bytes(100)
12                 self.assertEqual(len(b),100)
13                 b2=pseudo_bytes(100)
14                 self.assertNotEqual(b,b2)
15         def test_seed(self):
16                 b="aaqwrwfsagdsgdsfgdsfgdfsgdsfgdsgfdsfgdsfg"
17                 seed(b)
18                 # Check if no segfault here
19         def test_entropy(self):
20                 b="aaqwrwfsagdsgdsfgdsfgdfsgdsfgdsgfdsfgdsfg"
21                 seed(b,2.25)
22                 # Check if no segfault here
23         def test_Status(self):
24                 i=status()
25                 self.assertEqual(i,1)
26
27 if __name__ == '__main__':
28         unittest.main()