# Path: ldaptor/dns.py
# def aton_octets(ip):
# def aton_numbits(num):
# def aton(ip):
# def ntoa(n):
# def netmaskToNumbits(netmask):
# def ptrSoaName(ip, netmask):


from twisted.trial import unittest
from ldaptor import dns
        self.assertEquals(dns.netmaskToNumbits('255.255.255.0'), 24)

    def test_host(self):
        self.assertEquals(dns.netmaskToNumbits('255.255.255.255'), 32)

    def test_numbits(self):
        for i in range(0, 33):
            self.assertEquals(dns.netmaskToNumbits(str(i)), i)

    def test_CIDR(self):
        for i in range(0, 33):
            mask = dns.ntoa(dns.aton(i))
            self.assertEquals(dns.netmaskToNumbits(mask), i)

class PtrSoaName(unittest.TestCase):
    def test_classA(self):
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '255.0.0.0'),
                          '1.in-addr.arpa.')
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '8'),
                          '1.in-addr.arpa.')

    def test_classB(self):
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '255.255.0.0'),
                          '2.1.in-addr.arpa.')
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '16'),
                          '2.1.in-addr.arpa.')

    def test_classC(self):
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '255.255.255.0'),
                          '3.2.1.in-addr.arpa.')

# Path: ldaptor/dns.py
# def aton_octets(ip):
# def aton_numbits(num):
# def aton(ip):
# def ntoa(n):
# def netmaskToNumbits(netmask):
# def ptrSoaName(ip, netmask):


# Path: ldaptor/test/test_dns.py
from twisted.trial import unittest
from ldaptor import dns

        self.assertEquals(dns.netmaskToNumbits('255.255.255.0'), 24)

    def test_host(self):
        self.assertEquals(dns.netmaskToNumbits('255.255.255.255'), 32)

    def test_numbits(self):
        for i in range(0, 33):
            self.assertEquals(dns.netmaskToNumbits(str(i)), i)

    def test_CIDR(self):
        for i in range(0, 33):
            mask = dns.ntoa(dns.aton(i))
            self.assertEquals(dns.netmaskToNumbits(mask), i)

class PtrSoaName(unittest.TestCase):
    def test_classA(self):
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '255.0.0.0'),
                          '1.in-addr.arpa.')
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '8'),
                          '1.in-addr.arpa.')

    def test_classB(self):
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '255.255.0.0'),
                          '2.1.in-addr.arpa.')
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '16'),
                          '2.1.in-addr.arpa.')

    def test_classC(self):
        self.assertEquals(dns.ptrSoaName('1.2.3.4', '255.255.255.0'),
                          '3.2.1.in-addr.arpa.')

        self.assertEquals(dns.ptrSoaName('1.2.3.4', '24'),