Skip to content

Commit 5c37c04

Browse files
committed
Add more tests
1 parent 36651b1 commit 5c37c04

2 files changed

Lines changed: 67 additions & 21 deletions

File tree

Cargo.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pytest.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from random import randrange
12
from time import time_ns
23

34
from rlbot_flatbuffers import *
@@ -8,6 +9,31 @@ def __add__(self, other):
89
return MyVector(self.x + other.x, self.y + other.y, self.z + other.z)
910

1011

12+
def random_string():
13+
return "".join(chr(randrange(32, 127)) for _ in range(64))
14+
15+
16+
def random_player_config():
17+
return PlayerConfiguration(
18+
variety=PlayerClass(Psyonix(1.)),
19+
name=random_string(),
20+
location=random_string(),
21+
run_command=random_string(),
22+
loadout=PlayerLoadout(
23+
loadout_paint=LoadoutPaint(),
24+
primary_color_lookup=Color(),
25+
secondary_color_lookup=Color(),
26+
)
27+
)
28+
29+
30+
def random_script_config():
31+
return ScriptConfiguration(
32+
location=random_string(),
33+
run_command=random_string(),
34+
)
35+
36+
1137
if __name__ == "__main__":
1238
vec1 = MyVector(1, 2, 3)
1339
vec2 = Vector3(4, 5, 6)
@@ -71,6 +97,26 @@ def __add__(self, other):
7197
except InvalidFlatbuffer as e:
7298
print(e)
7399

100+
match_settings = MatchSettings(
101+
game_path=random_string(),
102+
game_map_upk=random_string(),
103+
player_configurations=[random_player_config() for _ in range(128)],
104+
script_configurations = [random_script_config() for _ in range(8)],
105+
mutator_settings=MutatorSettings()
106+
)
107+
108+
data = match_settings.pack()
109+
print(f"MatchSettings size: {len(data)} bytes")
110+
111+
renderPolyLine = RenderMessage(RenderType(PolyLine3D(
112+
[Vector3() for _ in range(2048)],
113+
)))
114+
115+
data = renderPolyLine.pack()
116+
print(f"RenderMessage size: {len(data)} bytes")
117+
118+
print()
119+
74120
print("Running quick benchmark...")
75121

76122
num_trials = 100_000

0 commit comments

Comments
 (0)