collect some simluate function
This commit is contained in:
parent
d7e27657f3
commit
f45c4ffa7e
@ -7,6 +7,8 @@
|
|||||||
import random
|
import random
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
from libs.pyglet_rs import Vector2_rs, Vector3_rs, Vector4_rs
|
from libs.pyglet_rs import Vector2_rs, Vector3_rs, Vector4_rs
|
||||||
|
|
||||||
|
|
||||||
@ -20,12 +22,18 @@ def print_test_info(func):
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
def gen_random_vector() -> Tuple[Vector2_rs, Vector3_rs, Vector4_rs]:
|
||||||
|
vec2 = Vector2_rs(random.randint(1, 100), random.randint(1, 100))
|
||||||
|
vec3 = Vector3_rs(random.randint(1, 100), random.randint(1, 100), random.randint(1, 100))
|
||||||
|
vec4 = Vector4_rs(random.randint(1, 100), random.randint(1, 100), random.randint(1, 100), random.randint(1, 100))
|
||||||
|
return vec2, vec3, vec4
|
||||||
|
|
||||||
|
|
||||||
class TestVector(unittest.TestCase):
|
class TestVector(unittest.TestCase):
|
||||||
|
|
||||||
@print_test_info
|
@print_test_info
|
||||||
def test1_create_print_vector(self):
|
def test1_create_print_vector(self):
|
||||||
vec2 = Vector2_rs(1, 2)
|
vec2, vec3, vec4 = gen_random_vector()
|
||||||
vec3 = Vector3_rs(1, 2, 3)
|
|
||||||
vec4 = Vector4_rs(1, 2, 3, 4)
|
|
||||||
|
|
||||||
print(f"{vec2=}")
|
print(f"{vec2=}")
|
||||||
print(f"{vec3=}")
|
print(f"{vec3=}")
|
||||||
@ -33,13 +41,8 @@ class TestVector(unittest.TestCase):
|
|||||||
|
|
||||||
@print_test_info
|
@print_test_info
|
||||||
def test2_calculate_vector(self):
|
def test2_calculate_vector(self):
|
||||||
vec2 = Vector2_rs(random.randint(1, 100), random.randint(1, 100))
|
vec2, vec3, vec4 = gen_random_vector()
|
||||||
vec3 = Vector3_rs(random.randint(1, 100), random.randint(1, 100), random.randint(1, 100))
|
vec2_1, vec3_1, vec4_1 = gen_random_vector()
|
||||||
vec4 = Vector4_rs(random.randint(1, 100), random.randint(1, 100), random.randint(1, 100), random.randint(1, 100))
|
|
||||||
|
|
||||||
vec2_1 = Vector2_rs(random.randint(1, 100), random.randint(1, 100))
|
|
||||||
vec3_1 = Vector3_rs(random.randint(1, 100), random.randint(1, 100), random.randint(1, 100))
|
|
||||||
vec4_1 = Vector4_rs(random.randint(1, 100), random.randint(1, 100), random.randint(1, 100), random.randint(1, 100))
|
|
||||||
|
|
||||||
print(f"{vec2=} {vec2_1=}")
|
print(f"{vec2=} {vec2_1=}")
|
||||||
print(f"{vec3=} {vec3_1=}")
|
print(f"{vec3=} {vec3_1=}")
|
||||||
|
Loading…
Reference in New Issue
Block a user