예제 #1
0
    def test_inf(self):
        inf = G1Py.inf()
        elem = G1Py()
        elem2 = elem * 10

        self.assertEqual(inf + elem, elem)
        self.assertEqual(inf + elem2, elem2)
예제 #2
0
    def test_addition(self):
        g1 = G1Py()
        g2 = G1Py()

        self.assertEqual(g1 + g1, g2 + g2)

        self.assertNotEqual(g1, g2 + g2)
예제 #3
0
    def test_hash(self):
        g1 = G1Py()
        g2 = G1Py()
        g3 = g1 * 2

        self.assertEqual(hash(g1), hash(g2))

        self.assertNotEqual(hash(g1), hash(g3))
예제 #4
0
    def test_sub(self):
        g1 = G1Py()
        g2 = G1Py()
        g3 = g1 * 2 # == g2 * 2

        self.assertEqual(g3 - g1, g3 - g2)
        self.assertEqual(g1 - g3, g2 - g3)
        self.assertNotEqual(g3 - g1, g2)
예제 #5
0
    def test_mul_with_int(self):
        g1 = G1Py()
        g2 = G1Py()

        self.assertEqual(g1 * 2, g2 * 2)
예제 #6
0
    def test_mul_with_window_table(self):
        g1 = G1Py()
        g1.initWindowTable(MAX)

        self.mul_test(g1)
예제 #7
0
    def test_mul_without_window_table(self):
        # get generator
        g1 = G1Py()

        self.mul_test(g1)
예제 #8
0
 def get_infs(self):
     inf1 = G1Py.inf()
     inf2 = G2Py.inf()
     return inf1, inf2