def test_insert_data(self): Tarea4.c = 33 Tarea4.a = 55 hash_table = [-1] * hash_len for i in range(500): hash_table[randint(0, hash_len - 1)] = 1 hash_table[153] = -1 self.assertEqual(1, Tarea4.insertar(hash_table, hash_len, 3984))
def test_insert_correction(self): Tarea4.c = 343402 Tarea4.a = 600482 hash_table = [-1] * hash_len hash_table[402] = 1 for i in range(890): hash_table[randint(0, hash_len - 1)] = 1 hash_table[900] = -1 self.assertEqual(2, Tarea4.insertar(hash_table, hash_len, 3000000))
def test_insert_last_position(self): Tarea4.c = 10 Tarea4.a = 10 hash_table = [-1] * 1000 hash_table[100] = 1 self.assertEqual(0, Tarea4.insertar(hash_table, 101, 9))
def test_insert_empty(self): Tarea4.c = randint(1, 1000) Tarea4.a = randint(1, 1000) hash_table = [-1] * 1000 self.assertEqual( 1, Tarea4.insertar(hash_table, hash_len, randint(1, 1000)))