1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
7 # As a special exception, if other files instantiate templates or use macros
8 # or inline functions from this file, or you compile this file and link it
9 # with other works to produce a work based on this file, this file
10 # does not by itself cause the resulting work to be covered
11 # by the GNU General Public License.
13 # However the source code for this file must still be made available
14 # in accordance with section (3) of the GNU General Public License.
16 # This exception does not invalidate any other reasons why a work based
17 # on this file might be covered by the GNU General Public License.
19 """ test_iter_helpers.py: unit tests for iter_helpers
21 Tests classes and functions in iter_helpers
23 Should be able run from python2 and python3!
25 For help see :py:mod:`unittest`
27 .. codeauthor:: Intra2net
32 # relative import of tested module ensures we do not test installed version
33 from src import iter_helpers
36 class IterHelperTester(unittest.TestCase):
37 """ only test case in this module, see module doc for more help """
39 def test_interesting_repetition(self):
40 """ tests interesting_repetition """
41 self.assertTrue (iter_helpers.interesting_repetition(0))
42 self.assertTrue (iter_helpers.interesting_repetition(1))
43 self.assertTrue (iter_helpers.interesting_repetition(2))
44 self.assertTrue (iter_helpers.interesting_repetition(3))
45 self.assertFalse(iter_helpers.interesting_repetition(4))
46 self.assertTrue (iter_helpers.interesting_repetition(5))
47 self.assertFalse(iter_helpers.interesting_repetition(6))
48 self.assertTrue (iter_helpers.interesting_repetition(7))
49 self.assertFalse(iter_helpers.interesting_repetition(8))
50 self.assertFalse(iter_helpers.interesting_repetition(9))
51 self.assertTrue (iter_helpers.interesting_repetition(10))
52 self.assertFalse(iter_helpers.interesting_repetition(11))
53 self.assertTrue (iter_helpers.interesting_repetition(150))
54 self.assertFalse(iter_helpers.interesting_repetition(151))
55 self.assertTrue (iter_helpers.interesting_repetition(2000))
56 self.assertFalse(iter_helpers.interesting_repetition(2001))
57 self.assertTrue (iter_helpers.interesting_repetition(30000))
58 self.assertFalse(iter_helpers.interesting_repetition(30001))
59 self.assertTrue (iter_helpers.interesting_repetition(500000))
60 self.assertFalse(iter_helpers.interesting_repetition(500001))
61 self.assertTrue (iter_helpers.interesting_repetition(7500000))
62 self.assertFalse(iter_helpers.interesting_repetition(7500001))
63 self.assertTrue (iter_helpers.interesting_repetition(10000000))
64 self.assertFalse(iter_helpers.interesting_repetition(10000001))
65 self.assertTrue (iter_helpers.interesting_repetition(150000000))
66 self.assertFalse(iter_helpers.interesting_repetition(150000001))
67 self.assertTrue (iter_helpers.interesting_repetition(2000000000))
68 self.assertFalse(iter_helpers.interesting_repetition(2000000001))
69 self.assertTrue (iter_helpers.interesting_repetition(30000000000))
70 self.assertFalse(iter_helpers.interesting_repetition(30000000001))
73 if __name__ == '__main__':