-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_compile.py
71 lines (56 loc) · 1.25 KB
/
test_compile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Test File
from SmartDataStructure import *
import itertools, random, threading, LiveGraph
from sarr import *
from minheap import *
from maxheap import *
from bst import *
def clear():
s_data.len = 0
def addTest():
s_data.len = 0
for x in range(100000):
y = random.randint(0, 1000000)
s_data.add(y)
if s_data.len != 100000:
print "Add FAILED"
else:
print "Add PASSED"
def containsTest():
test = []
for x in range(10):
y = random.randint(0, 1000000)
s_data.add(y)
test.append(y)
def cont(arr, key):
toReturn = False
for x in arr:
if x == key:
return True
return False
for x in range(s_data.len):
if not s_data.contains(x) and cont(test, x):
print "Contains FAILED"
print "Contains PASSED"
def removeTest():
test = []
for x in range(10):
y = random.randint(0, 1000000)
test.append(y)
s_data.add(y)
for x in range(10):
s_data.remove(test[x])
if s_data.len:
print "Remove FAILED"
else:
print "Remove PASSED"
s_data = SD()
s_data.add(1)
s_data.add(3)
print "done"
#addTest()
#clear()
#containsTest()
#clear()
#removeTest()
#clear()