Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for examples #10

Open
TimmRuppert opened this issue Dec 11, 2024 · 0 comments
Open

Add integration tests for examples #10

TimmRuppert opened this issue Dec 11, 2024 · 0 comments

Comments

@TimmRuppert
Copy link
Collaborator

Describe the feature

It might be a bit too much to add unit test and most of the example code is already just in one main function. But we can add integration tests to ensure they not only build to actually run as well.

Maybe using a little python scripts, e.g.

test/examples/test_convert_osi2mcap.y

import subprocess
import tempfile
import os
from pathlib import Path

def test_convert_osi2mcap():
    with tempfile.TemporaryDirectory() as temp_dir:
        # TODO Create test input OSI file, e.g. using writer 

        # Run converter with different options
        subprocess.run([
            "./convert_osi2mcap",
            str(input_path),
            str(output_path),
            "--compression", "zstd",
            "--chunk_size", "786432"
        ], check=True)

if __name__ == "__main__":
  test_convert_osi2mcap()
        

in the cmake

add_test(
  NAME example_convert_osi2mcap
  COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/examples/test_convert_osi2mcap.py
)

Additionally, this helps to "proof" that the examples are working in case someone new might face a local configuration error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant