From 347ee56d2d2d8e032bd55bb07447f78e9b349abe Mon Sep 17 00:00:00 2001 From: krande Date: Tue, 3 Sep 2024 16:18:42 +0200 Subject: [PATCH] chore: update tests --- tests/profiling/test_ifc_creation.py | 45 ++++++++++++++++++++++++ tests/profiling/test_large_ifc_models.py | 14 -------- 2 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 tests/profiling/test_ifc_creation.py delete mode 100644 tests/profiling/test_large_ifc_models.py diff --git a/tests/profiling/test_ifc_creation.py b/tests/profiling/test_ifc_creation.py new file mode 100644 index 000000000..4e5b2e692 --- /dev/null +++ b/tests/profiling/test_ifc_creation.py @@ -0,0 +1,45 @@ +import pytest + +import ada + + +@pytest.mark.benchmark +def test_build_big_ifc_beams(): + # create beams and write it to ifc + beams = [] + for i in range(0, 100): + bm = ada.Beam(f"bm{i}", (i, 0, 0), (i + 1, 0, 0), "IPE300") + beams.append(bm) + a = ada.Assembly() / beams + a.to_ifc(file_obj_only=True) + + +@pytest.mark.benchmark +def test_build_big_ifc_plates(): + objects = [] + points = [(0, 0), (1, 0), (1, 1), (0, 1)] + for i in range(0, 100): + bm = ada.Plate(f"pl{i}", points, 0.01, origin=(0, 0, i)) + objects.append(bm) + a = ada.Assembly() / objects + a.to_ifc(file_obj_only=True) + + +@pytest.mark.benchmark +def test_build_big_ifc_box(): + objects = [] + for i in range(0, 100): + bm = ada.PrimBox(f"obj{i}", (0, 0, i), (0.5, 0.5, i + 0.5)) + objects.append(bm) + a = ada.Assembly() / objects + a.to_ifc(file_obj_only=True) + + +@pytest.mark.benchmark +def test_build_big_ifc_sphere(): + objects = [] + for i in range(0, 100): + bm = ada.PrimSphere(f"obj{i}", (0, 0, i), 0.2) + objects.append(bm) + a = ada.Assembly() / objects + a.to_ifc(file_obj_only=True) diff --git a/tests/profiling/test_large_ifc_models.py b/tests/profiling/test_large_ifc_models.py deleted file mode 100644 index ce6406046..000000000 --- a/tests/profiling/test_large_ifc_models.py +++ /dev/null @@ -1,14 +0,0 @@ -import pytest - -import ada - - -@pytest.mark.benchmark -def test_build_big_ifc(): - # create beams and write it to ifc - beams = [] - for i in range(0, 1_000): - bm = ada.Beam(f"bm{i}", (i, 0, 0), (i + 1, 0, 0), "IPE300") - beams.append(bm) - a = ada.Assembly() / beams - a.to_ifc(file_obj_only=True)