*** Settings ***
Documentation    Integration tests for semantic validation fixture suites
Library          Process
Library          OperatingSystem
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Suite Loads All Porting Fixtures
    [Documentation]    Verify all language-porting mismatch fixtures load and validate
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    porting_fixtures    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    porting-fixtures-ok

Suite Loads All Dependency Fixtures
    [Documentation]    Verify all dependency graph violation fixtures load and validate
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    dependency_fixtures    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    dependency-fixtures-ok

Suite Loads All API Surface Fixtures
    [Documentation]    Verify all API surface change fixtures load and validate
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    api_fixtures    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    api-fixtures-ok

Suite Loads All Cross-File Fixtures
    [Documentation]    Verify all cross-file symbol resolution fixtures load and validate
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    cross_file_fixtures    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    cross-file-fixtures-ok

Suite Loads All Circular Import Fixtures
    [Documentation]    Verify all circular import detection fixtures load and validate
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    circular_fixtures    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    circular-fixtures-ok

Suite Runs Porting Fixture Through Rules
    [Documentation]    Run a porting fixture through its expected rule and verify result
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    run_porting    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    run-porting-ok

Suite Runs Dependency Fixture Through Rules
    [Documentation]    Run a dependency fixture through its expected rule and verify result
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    run_dependency    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    run-dependency-ok

Suite Runs API Surface Fixture Through Rules
    [Documentation]    Run an API surface fixture through its expected rule and verify result
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    run_api    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    run-api-ok

Suite Runs Cross-File Fixture Through Rules
    [Documentation]    Run a cross-file fixture through its expected rule and verify result
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    run_cross_file    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    run-cross-file-ok

Suite Runs Circular Import Fixture Through Rules
    [Documentation]    Run a circular import fixture through its expected rule and verify result
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    run_circular    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    run-circular-ok

Suite Unknown Command Fails Gracefully
    [Documentation]    Unknown command returns error exit code
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    nonexistent_command    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    1
