Skip to content

Add DMF test module covering dm_sw_ring public API#3

Merged
JohnAmadis merged 7 commits into
masterfrom
copilot/add-tests-module
Jun 3, 2026
Merged

Add DMF test module covering dm_sw_ring public API#3
JohnAmadis merged 7 commits into
masterfrom
copilot/add-tests-module

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 3, 2026

Issue required a dedicated tests/ DMF module that executes dm_sw_ring through its exported API surface. This PR adds that module and integrates it into the repository build so test DMF is produced alongside the main module.

  • Build wiring

    • Added add_subdirectory(tests) in root CMakeLists.txt.
    • Added tests/CMakeLists.txt defining test_dm_sw_ring as a DMOD executable and linking against dm_sw_ring_if.
  • New API-level test module

    • Added tests/test_dm_sw_ring.c.
    • The test module exercises all public APIs:
      • lifecycle: create, destroy
      • data path: write, read, peek, discard, clear
      • state/introspection: capacity, size, available_space, is_full, is_empty
    • Refactored execution into separate test steps per API function, with shared setup/teardown for deterministic isolation.
    • Uses deterministic flags (non-blocking behavior) and explicit assertions with actual/expected diagnostics, including NULL-buffer error-path checks.
  • Manifest and release metadata

    • Updated manifest.dmm to include test_dm_sw_ring module entry.
    • Updated release workflow generation of versions.dmm to include $version-available test_dm_sw_ring ....
  • Resulting artifact behavior

    • Build now generates test_dm_sw_ring.dmf from the new tests/ module, matching expected module layout for API test execution.
dm_sw_ring_t ring = dm_sw_ring_create(4, dm_sw_ring_flags_drop_old_data | dm_sw_ring_flags_mutex_sync);

EXPECT_EQ_U32(dm_sw_ring_write(ring, test_data_overflow, 5), 5);
EXPECT_EQ_I32(dm_sw_ring_peek(ring, io_buffer, 4), 4);
EXPECT_EQ_U8(io_buffer[0], 12); // oldest byte dropped as expected

dm_sw_ring_destroy(ring);

Copilot AI linked an issue Jun 3, 2026 that may be closed by this pull request
@JohnAmadis JohnAmadis marked this pull request as ready for review June 3, 2026 13:10
Copilot AI changed the title [WIP] Add tests module for API dm_sw_ring Add DMF test module covering dm_sw_ring public API Jun 3, 2026
Copilot AI requested a review from JohnAmadis June 3, 2026 13:16
@JohnAmadis
Copy link
Copy Markdown
Contributor

@copilot zrób osobne stepy dla każdej testowanej funkcji, przygotuj setup i teardown, postaraj się osiągnąć z 80% code coverage, zaktualizuj manifest o ten moduł testowy,

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 3, 2026

@copilot zrób osobne stepy dla każdej testowanej funkcji, przygotuj setup i teardown, postaraj się osiągnąć z 80% code coverage, zaktualizuj manifest o ten moduł testowy,

Gotowe w commitcie 3ae8980.

Wprowadziłem osobne kroki testowe dla każdej funkcji publicznego API (create, destroy, write, read, capacity, size, available_space, peek, discard, clear, is_full, is_empty) oraz wspólne setup/teardown uruchamiane dla kroków wymagających pierścienia. Dodatkowo zaktualizowałem manifest.dmm o wpis test_dm_sw_ring i dodałem generowanie $version-available test_dm_sw_ring w workflow release, żeby manifest był spójny z modułem testowym.

@JohnAmadis JohnAmadis merged commit d51fb30 into master Jun 3, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

Dodać moduł testów

2 participants