-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
28 lines (24 loc) · 886 Bytes
/
test.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
from subprocess import check_output
from tqdm import tqdm
from random import shuffle
def test1():
data = list(range(100))
for a in "abc":
shuffle(data)
for i in tqdm(data):
check_output(f"python3 minidb.py test.db set key{i} test{i}{a}", shell=True)
shuffle(data)
for i in tqdm(data):
x = check_output(f"python3 minidb.py test.db get key{i}", shell=True).decode().strip()
y = f"test{i}{a}"
assert x == y
shuffle(data)
for i in tqdm(data):
check_output(f"python3 minidb.py test.db set key{i} ho{i}{a}", shell=True)
shuffle(data)
for i in tqdm(data):
x = check_output(f"python3 minidb.py test.db get key{i}", shell=True).decode().strip()
y = f"ho{i}{a}"
assert x == y
if __name__ == "__main__":
test1()