*** Settings ***
Documentation    Edge-case validation tests for fixtures and error paths
Library          Process
Library          OperatingSystem
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Validation Edge Load All Fixtures
    [Documentation]    Load all validation fixture files and verify structure
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    load_fixtures    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    fixtures-loaded-ok

Validation Edge Malformed Output Detection
    [Documentation]    Detect malformed tool output via fixture data
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    malformed_output    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    malformed-output-ok

Validation Edge Missing Resource Error Paths
    [Documentation]    Validate missing resource reference detection
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    missing_resources    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    missing-resources-ok

Validation Edge Timeout Simulation
    [Documentation]    Validate timeout simulation fixture data
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    timeout_simulation    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    timeout-simulation-ok

Validation Edge Schema Validation Errors
    [Documentation]    Validate schema transform fixture error detection
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    schema_validation    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    schema-validation-ok

Validation Edge Unknown Command Returns Error
    [Documentation]    Running with unknown command exits with code 1
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    nonexistent_cmd    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    1
    Should Contain    ${result.stderr}    Unknown command
