예제 #1
0
class TestMapCache(unittest.TestCase):
    def setUp(self):
        maproute = MapRoute(levels=4, gsize=256, me=[8, 19, 82, 84])
        self.map = MapCache(maproute)

    def test_node_add(self):
        '''Test adding a new node'''
        self.failUnlessEqual(self.map.node_nb[2], 0)
        self.map.node_add(lvl=2, id=8)
        self.failUnlessEqual(self.map.node_nb[2], 1)

    def test_node_del(self):
        '''Test adding a new node'''
        self.failUnlessEqual(self.map.node_nb[2], 0)
        self.map.node_add(lvl=2, id=8)
        self.failUnlessEqual(self.map.node_nb[2], 1)

    def test_tmp_deleted_add(self):
        '''Test adding an entry in tmp_deleted cache'''
        self.test_node_add()
        self.map.tmp_deleted_add(lvl=2, id=8)
        self.failUnless(self.map.tmp_deleted != {})

    def test_tmp_deleted_del(self):
        '''Test deleting an entry from tmp_deleted cache'''
        self.test_tmp_deleted_add()
        self.map.tmp_deleted_del(lvl=2, id=8)
        self.failUnlessEqual(self.map.tmp_deleted, {})
예제 #2
0
class TestMapCache(unittest.TestCase):

    def setUp(self):
        maproute = MapRoute(levels=4, gsize=256, me=[8, 19, 82, 84])
        self.map = MapCache(maproute)

    def test_node_add(self):
        '''Test adding a new node'''
        self.failUnlessEqual(self.map.node_nb[2], 0)
        self.map.node_add(lvl=2, id=8)
        self.failUnlessEqual(self.map.node_nb[2], 1)

    def test_node_del(self):
        '''Test adding a new node'''
        self.failUnlessEqual(self.map.node_nb[2], 0)
        self.map.node_add(lvl=2, id=8)
        self.failUnlessEqual(self.map.node_nb[2], 1)

    def test_tmp_deleted_add(self):
        '''Test adding an entry in tmp_deleted cache'''
        self.test_node_add()
        self.map.tmp_deleted_add(lvl=2, id=8)
        self.failUnless(self.map.tmp_deleted != {})

    def test_tmp_deleted_del(self):
        '''Test deleting an entry from tmp_deleted cache'''
        self.test_tmp_deleted_add()
        self.map.tmp_deleted_del(lvl=2, id=8)
        self.failUnlessEqual(self.map.tmp_deleted, {})
예제 #3
0
 def setUp(self):
     maproute = MapRoute(levels=4, gsize=256, me=[8, 19, 82, 84])
     self.map = MapCache(maproute)
예제 #4
0
 def setUp(self):
     maproute = MapRoute(levels=4, gsize=256, me=[8, 19, 82, 84])
     self.map = MapCache(maproute)