Пример #1
0
def write_hash_into_reduced_can_workspace(state, workspace, partial_type=None):
    """
    Writes the state hash into a reduced can workspace.

    @param state: a SANSState object.
    @param workspace: a reduced can workspace
    @param partial_type: if it is a partial type, then it needs to be specified here.
    """
    hashed_state = get_state_hash_for_can_reduction(state, partial_type=partial_type)
    set_hash(REDUCED_CAN_TAG, hashed_state, workspace)
Пример #2
0
def write_hash_into_reduced_can_workspace(state, workspace, reduction_mode, partial_type=None):
    """
    Writes the state hash into a reduced can workspace.

    :param state: a SANSState object.
    :param workspace: a reduced can workspace
    :param reduction_mode: the reduction mode
    :param partial_type: if it is a partial type, then it needs to be specified here.
    """
    hashed_state = get_state_hash_for_can_reduction(state, reduction_mode, partial_type=partial_type)
    set_hash(REDUCED_CAN_TAG, hashed_state, workspace)
Пример #3
0
    def test_that_can_read_and_write_hash_in_sample_log(self):
        # Arrange
        ws1 = self._provide_sample_workspace()
        tag1 = "test"
        value1 = "tested"
        value2 = "tested2"

        # Act + Assert
        self.assertFalse(has_hash(tag1, value1, ws1))
        set_hash(tag1, value1, ws1)
        self.assertTrue(has_hash(tag1, value1, ws1))
        self.assertFalse(has_hash(tag1, value2, ws1))
Пример #4
0
    def test_that_can_read_and_write_hash_in_sample_log(self):
        # Arrange
        ws1 = self._provide_sample_workspace()
        tag1 = "test"
        value1 = "tested"
        value2 = "tested2"

        # Act + Assert
        hashed_value_1 = get_hash_value(value1)
        hashed_value_2 = get_hash_value(value2)
        self.assertFalse(has_hash(tag1, hashed_value_1, ws1))
        set_hash(tag1, hashed_value_1, ws1)
        self.assertTrue(has_hash(tag1, hashed_value_1, ws1))
        self.assertFalse(has_hash(tag1, hashed_value_2, ws1))