crestdsl.model.systemcheck module

class crestdsl.model.SystemCheck(model)

Bases: object

Check whether an Entity object satisfies the basic structure (CREST syntax) checks.

check_action_sanity()

Check that each action is properly named, has a transition and from the same entity and a target port that is in the “targets” of the entity. Also verifies the signature of the action function.

check_all(exit_on_error=False)

Runs a series of system checks on the model and writes eventual errors to the log.

Parameters

exit_on_error (bool) – True: checking is aborted with an exception as soon as the first error is found? False: continue until the end, even if an error is found

Returns

True if all checks passed, False otherwise.

Return type

bool

Raises

AssertionError – If exit_on_error is True and an error is discovered, the method raises an AssertionError with information about the respective problem.

check_all_objects_have_names()

Assert that each entity has a name defined.

check_current_states()

Assert that each entity has a current state that is one of the states of the entity.

check_influence_sanity()

Check that each influence is properly named, has a source from the “sources” of an entity and a target port that is in the “targets” of the same entity. Also verifies the signature of the influence function.

check_objects_have_parents_and_are_not_referenced_twice()
  • check that ports, states, updates, influences and transitions have a parent specificaiton each.

  • Test that they also are only used once (i.e. they only appear once in the list)

check_port_connections()

Verify that a port has maximum one influence OR one update per state writing to it. when an influence is defined, no action can write to that port.

check_transition_sanity()

Check that the transitions are properly named, the states are from the same entity and that the guard has the correct signature.

check_update_sanity()

Check that each update is properly named, has a state and from the same entity and a target port that is in the “targets” of the entity. Also verifies the signature of the update function.

test_entity_hierarchy()

Assert that - each entity has only appears once in the children of another entity - there is exactly one entity - the root - that has no parent