def container_deletion_successful_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.93) vector_double.__delitem__(0) equals(vector_double.__len__(), 0) tests += 1
def container_clear_successful_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.1) vector_double.append(2.2) vector_double.append(3.3) vector_double.clear() equals(vector_double.__len__(), 0) tests += 1
def container_deletion2_successful_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.1) vector_double.append(2.2) vector_double.append(3.3) vector_double.__delitem__(1) equals(vector_double[0], 1.1) equals(vector_double[1], 3.3) tests += 1
def container_sort_correct_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(3.3) vector_double.append(1.1) vector_double.append(2.2) vector_double.sort() equals(vector_double[0], 1.1) equals(vector_double[1], 2.2) equals(vector_double[2], 3.3) tests += 1
def container_stress_append_and_delete_correct_double(): global tests vector_double = libStlContainers.vector_double() i = 0 while i < 10000: vector_double.append(i + 1.1) i += 1 equals(vector_double.__len__(), 10000) i = 5000 while i > 0: vector_double.__delitem__(i) i -= 1 equals(vector_double.__len__(), 5000) vector_double.clear() equals(vector_double.__len__(), 0) tests += 1
# Autor: Michal Andrzejewski # # # print 'Now running tests from Python_test.py..' import libStlContainers map_int_string = libStlContainers.map_int_string() vector_int = libStlContainers.vector_int() set_int = libStlContainers.set_int() vector_double = libStlContainers.vector_double() vector_string = libStlContainers.vector_string() set_double = libStlContainers.set_double() set_string = libStlContainers.set_string() map_int_string[0] = "a" map_int_string[1] = "b" map_int_string[6] = "c" if map_int_string[6] != "c": print "Error" vector_int.append(0) vector_int.append(0) vector_int.append(1) vector_int.append(2) vector_int.append(3) if vector_int.__len__() != 5:
def container_index_operator_works_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.93) equals(vector_double[0], 1.93) tests += 1
def container_append_successful_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.93) equals(vector_double.__len__(), 1) tests += 1
def container_creation_successful_double(): global tests vector_double = libStlContainers.vector_double() equals(vector_double.__len__(), 0) tests += 1
def container_count_correct_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.1) equals(vector_double.count(1.1), 1) tests += 1
def container_indexing_correct_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.1) equals(vector_double.index(1.1), 0) tests += 1
def container_contains_correct_double(): global tests vector_double = libStlContainers.vector_double() vector_double.append(1.1) equals(vector_double.__contains__(1.1), True) tests += 1