Skip to content

Commit dc2b629

Browse files
committed
separate python and cpp test files
1 parent 94aaa2a commit dc2b629

13 files changed

+18
-63
lines changed

CMakeLists.txt

+10-13
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
66
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
77

8-
option(BUILD_PY "Build the python binding of symusic" OFF)
9-
option(BUILD_TEST "Build the test target" OFF)
8+
option(BUILD_SYMUSIC_PY "Build the python binding of symusic" OFF)
9+
option(BUILD_SYMUSIC_EXAMPLE "Build the test target" OFF)
1010
option(ENABLE_LTO "Enables link-time optimization, requires compiler support." ON)
1111
option(VTUNE "Compile Options for Intel VTune" Off)
1212

@@ -40,7 +40,7 @@ target_link_libraries(symusic minimidi)
4040
target_link_libraries(symusic prestosynth)
4141
target_link_libraries(symusic pyvec)
4242

43-
if(BUILD_PY)
43+
if(BUILD_SYMUSIC_PY)
4444
message("Building python binding.")
4545
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
4646
# set symusic target to O3 and release mode because nanobind use minisize
@@ -63,23 +63,20 @@ if(BUILD_PY)
6363
install(TARGETS abc2midi midi2abc DESTINATION symusic/bin)
6464
endif()
6565

66-
if(BUILD_TEST)
66+
if(BUILD_SYMUSIC_EXAMPLE)
6767
add_subdirectory(./3rdparty/nanobench EXCLUDE_FROM_ALL)
6868

69-
add_executable(note_count tests/note_count.cpp)
70-
add_executable(dump tests/dump.cpp)
71-
add_executable(io_bench tests/io_bench.cpp)
72-
add_executable(synth tests/synth.cpp)
73-
add_executable(sequence tests/sequence.cpp)
74-
add_executable(adjust_time tests/adjust_time.cpp)
69+
add_executable(note_count examples/cpp/note_count.cpp)
70+
add_executable(dump examples/cpp/dump.cpp)
71+
add_executable(io_bench examples/cpp/io_bench.cpp)
72+
add_executable(synth examples/cpp/synth.cpp)
73+
add_executable(adjust_time examples/cpp/adjust_time.cpp)
7574

7675
target_link_libraries(note_count PRIVATE symusic)
7776
target_link_libraries(dump PRIVATE symusic)
7877
target_link_libraries(io_bench PRIVATE symusic nanobench)
7978
target_link_libraries(synth PUBLIC symusic)
80-
target_link_libraries(sequence PUBLIC symusic)
8179
target_link_libraries(adjust_time PUBLIC symusic)
82-
8380
endif()
8481

8582
if (ENABLE_LTO)
@@ -92,7 +89,7 @@ if (ENABLE_LTO)
9289
endif ()
9390
message(STATUS "Link-time optimization (LTO) enabled")
9491
set_property(TARGET symusic PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
95-
if(BUILD_PY)
92+
if(BUILD_SYMUSIC_PY)
9693
set_property(TARGET core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
9794
endif ()
9895
else()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/test_adjust_time.py tests/py/test_adjust_time.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
from symusic import Note, Score, Track
9-
from tests.utils import MIDI_PATHS
9+
from tests.py.utils import MIDI_PATHS
1010

1111
# as tuples (original notes, original times, new times, expected notes)
1212
NOTES_OG = [Note(0, 4, 72, 72), Note(4, 6, 72, 72), Note(8, 4, 72, 72)]

tests/test_read_dump.py tests/py/test_read_dump.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
from symusic import Score
7-
from tests.utils import MIDI_PATHS
7+
from tests.py.utils import MIDI_PATHS
88

99

1010
@pytest.mark.parametrize("midi_path", MIDI_PATHS, ids=attrgetter("name"))

tests/test_second_conversion.py tests/py/test_second_conversion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
from symusic import Score
9-
from tests.utils import MIDI_PATHS
9+
from tests.py.utils import MIDI_PATHS
1010

1111

1212
class ScoreTimeMapper:

tests/py/utils.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pathlib import Path
2+
3+
HERE = Path(__file__).parent
4+
5+
MIDI_PATHS = sorted((HERE.parent / "testcases").rglob("*.mid"))

tests/sequence.cpp

-42
This file was deleted.

tests/utils.py

-5
This file was deleted.

0 commit comments

Comments
 (0)