diff options
Diffstat (limited to 'rtemsspec')
-rw-r--r-- | rtemsspec/tests/test_validation.py | 9 | ||||
-rw-r--r-- | rtemsspec/validation.py | 7 |
2 files changed, 14 insertions, 2 deletions
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py index 5a0f165b..032b531f 100644 --- a/rtemsspec/tests/test_validation.py +++ b/rtemsspec/tests/test_validation.py @@ -27,7 +27,7 @@ import os import pytest -from rtemsspec.validation import generate +from rtemsspec.validation import generate, TransitionMap from rtemsspec.items import EmptyItemCache, Item, ItemCache from rtemsspec.tests.util import create_item_cache_config_and_copy_spec @@ -40,7 +40,12 @@ def test_validation(tmpdir): item_cache_config = create_item_cache_config_and_copy_spec( tmpdir, "spec-validation", with_spec_types=True) - generate(validation_config, ItemCache(item_cache_config)) + item_cache = ItemCache(item_cache_config) + + transition_map = TransitionMap(item_cache["/action2"]) + assert transition_map.post_co_idx_st_idx_to_st_name(0, 0) == "A0" + + generate(validation_config, item_cache) with open(os.path.join(base_directory, "ts.c"), "r") as src: content = """/* SPDX-License-Identifier: BSD-2-Clause */ diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py index 05bb2bcd..a36aa19b 100644 --- a/rtemsspec/validation.py +++ b/rtemsspec/validation.py @@ -679,6 +679,13 @@ class TransitionMap: """ return self._pre_co_idx_st_idx_to_st_name[co_idx][st_idx] + def post_co_idx_st_idx_to_st_name(self, co_idx: int, st_idx: int) -> str: + """ + Maps the post-condition name and state index to the associated state + name. + """ + return self._post_co_idx_st_idx_to_st_name[co_idx][st_idx] + def pre_co_idx_st_name_to_st_idx(self, co_idx: int, st_name: str) -> int: """ Maps the pre-condition index and state name to the associated state |