*** Settings ***
Documentation    Smoke tests for large-project decomposition service
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER}    ${CURDIR}/helper_large_project_decompose.py

*** Test Cases ***
Decompose Small Project Below Threshold
    [Documentation]    Projects below min_files threshold get a single node
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    below-threshold    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    decompose-below-threshold-ok

Decompose Multi-Level Project
    [Documentation]    Projects with many files produce multi-level decomposition
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    multi-level    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    decompose-multi-level-ok

Dependency Closure Computation
    [Documentation]    Transitive closure should collect reachable nodes
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    closure    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    decompose-closure-ok

Topological Sort
    [Documentation]    Topo sort should produce valid execution order
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    topo-sort    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    decompose-topo-sort-ok

Cycle Detection
    [Documentation]    Cycles in dependency graph should be detected
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    cycle-detect    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    decompose-cycle-detect-ok

Config Validation
    [Documentation]    Invalid config should raise ValueError
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    config-validation    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    decompose-config-ok
