*** Settings ***
Documentation    Smoke tests for ChangeSet models and invocation tracking
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_change_tracking.py

*** Test Cases ***
ChangeType Alias
    [Documentation]    ChangeType is an alias for ChangeOperation
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    changetype    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    changetype-ok

ChangeEntry Validator
    [Documentation]    Per-operation hash field validation
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    validator    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    validator-ok

Sorted Entries
    [Documentation]    SpecChangeSet sorted_entries deterministic ordering
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    sorted    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    sorted-ok

Invocation Tracker
    [Documentation]    InMemoryInvocationTracker tracking and retrieval
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    tracker    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tracker-ok

Normalize Path
    [Documentation]    normalize_change_path strips repo root
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    normalize    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    normalize-ok
