def test_gf2m_div__neg(self):
        """ Negative tests for gf2m_div(a,b,f) """
        # Not meant to be called with other values than int or long
        self.failUnlessRaises(AttributeError, ar.gf2m_div, 0.0, 0b110, 0b10011)
        self.failUnlessRaises(TypeError, ar.gf2m_div, "asdf", 0b110, 0b10011)

        self.failUnlessEqual(ar.gf2m_div(-0b1101, 0b110, 0b10011), 0b101)
        self.failUnlessEqual(ar.gf2m_div(0b1101, -0b110, 0b10011), 0b101)
        self.failUnlessEqual(ar.gf2m_div(0b1101, 0b110, -0b10011), 0b101)
        self.failUnlessEqual(ar.gf2m_div(-0b1101, -0b110, -0b10011), 0b101)
    def test_gf2m_div__neg(self):
        """ Negative tests for gf2m_div(a,b,f) """
        # Not meant to be called with other values than int or long
        self.failUnlessRaises(AttributeError, ar.gf2m_div, 0.0, 0b110, 0b10011)
        self.failUnlessRaises(TypeError, ar.gf2m_div, "asdf", 0b110, 0b10011)
 
        self.failUnlessEqual(ar.gf2m_div(-0b1101, 0b110, 0b10011),0b101)
        self.failUnlessEqual(ar.gf2m_div(0b1101, -0b110, 0b10011),0b101)
        self.failUnlessEqual(ar.gf2m_div(0b1101, 0b110, -0b10011),0b101)
        self.failUnlessEqual(ar.gf2m_div(-0b1101, -0b110, -0b10011),0b101)
    def test_gf2m_div__pos(self):
        """ Positive tests for gf2m_div(a, b, f) 

        Sage test calculations::
            sage: F.<x> = GF(2)[]
            sage: a = x^3 + x^2 + 1         # a = 0b1101
            sage: b = x^2 + x               # b = 0b110
            sage: p = x^4 + x + 1           # f = 0b10011
            sage: bi = b.inverse_mod(p); bi
            x^2 + x + 1
            sage: tmp = a * bi; tmp
            x^5 + x + 1
            sage: tmp.mod(p)
            x^2 + 1
            -------
            sage: FF.<y> = GF(2**4, name='y', modulus=x^4 + x + 1 )
            sage: a = y^3 + y^2 + 1
            sage: b = y^2 + y
            sage: a/b
            y^2 + 1
        """
        self.failUnlessEqual(ar.gf2m_div(0b1101, 0b110, 0b10011), 0b101)
    def test_gf2m_div__pos(self):
        """ Positive tests for gf2m_div(a, b, f) 

        Sage test calculations::
            sage: F.<x> = GF(2)[]
            sage: a = x^3 + x^2 + 1         # a = 0b1101
            sage: b = x^2 + x               # b = 0b110
            sage: p = x^4 + x + 1           # f = 0b10011
            sage: bi = b.inverse_mod(p); bi
            x^2 + x + 1
            sage: tmp = a * bi; tmp
            x^5 + x + 1
            sage: tmp.mod(p)
            x^2 + 1
            -------
            sage: FF.<y> = GF(2**4, name='y', modulus=x^4 + x + 1 )
            sage: a = y^3 + y^2 + 1
            sage: b = y^2 + y
            sage: a/b
            y^2 + 1
        """
        self.failUnlessEqual(ar.gf2m_div(0b1101, 0b110, 0b10011),0b101)