コード例 #1
0
ファイル: duptreaptest.py プロジェクト: proper337/pyalgo
def negative_find_test():
	ok = True
	t = duptreap.duptreap()
	for i in xrange(0, n, 2):
		t[i] = i
	for i in xrange(1, n, 2):
		myut.require_exceptions(functools.partial(t.find, i), ( exceptions.LookupError, ))
コード例 #2
0
ファイル: duptreaptest.py プロジェクト: proper337/pyalgo
def reremoval_test():
	t = duptreap.duptreap()
	# fill the treap with 0..n
	for i in xrange(n):
		t[i] = i
	# remove all the odd values
	for i in xrange(1,n,2):
		del t[i]
	# check that we have nothing but even values left
	ordered_values = list(t.iterator())
	for i in [ 1, 3, 7 ]:
		myut.require_exceptions(functools.partial(t.remove, i), ( exceptions.LookupError, ))
コード例 #3
0
ファイル: duptreaptest.py プロジェクト: proper337/pyalgo
def empty_max_test():
	t = duptreap.duptreap()
	myut.require_exceptions(t.find_max, (exceptions.LookupError, ))
コード例 #4
0
ファイル: duptreaptest.py プロジェクト: proper337/pyalgo
def failed_removal_from_one_test():
	t = duptreap.duptreap()
	t[5] = 5
	myut.require_exceptions(functools.partial(t.remove, 10), ( exceptions.LookupError, ))
コード例 #5
0
ファイル: duptreaptest.py プロジェクト: proper337/pyalgo
def removal_from_empty_test():
	t = duptreap.duptreap()
	for i in [ 1, 3, 7 ]:
		myut.require_exceptions(functools.partial(t.remove, i), ( exceptions.LookupError, ))
コード例 #6
0
ファイル: treap_catall.py プロジェクト: proper337/pyalgo
def empty_min_test():
	t = treap.treap()
	myut.require_exceptions(t.find_min, (exceptions.LookupError, ))