# test-design-org/general-predicate-testing architecture

> Architecture diagram of the GitHub repository test-design-org/general-predicate-testing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/test-design-org/general-predicate-testing
- Repository: https://github.com/test-design-org/general-predicate-testing

## Overview

##### Main Components

a. Core Components:
- GPT Common Library (Core Logic)
- Parser Module
- IR (Intermediate Representation) Module
- Graph Reduction Module
- Test Case Generation System
- BVA (Boundary Value Analysis) Module

b. Interface Components:
- CLI Interface
- Web Frontend (WASM-based)
- Documentation System (Docusaurus)

##### Component Relationships

Top Layer:
- User Interfaces (CLI and Web Frontend)
- Documentation System

Middle Layer:
- Parser System
- IR System
- Test Generation System

Bottom Layer:
- Graph Reduction Algorithms
- Core Utilities and Common Functions

##### Detailed Component Breakdown

GPT Common (Core):
**┌─ Parser Module**
- AST
- Condition Parser
- Feature Parser
- If Statement Parser

- IR Module
- AST to IR Converter
- IR to N-tuple Converter

- Graph Reduction
- Least Losing Components
- Least Losing Edges
- Monke Algorithm

- Test Generation
- Test Case Generator
- Test Value Generator

##### Key Interactions to Highlight

- How the GPT language files (.gpt) flow through the system:
1. Input through CLI/Web Frontend
2. Parsing into AST
3. Conversion to IR
4. Graph reduction processing
5. Test case generation
6. Results display

##### Additional Elements

- Version/build workflow indicators
- Integration with external tools (cargo-instruments for profiling)
- WASM compilation boundary for web frontend

##### Technical Details to Note

- Rust-based architecture
- WASM compilation for frontend
- Documentation generation pipeline
- CI/CD workflow integration

Remember to include:
- File format support (.gpt)
- Algorithm selection options
- Test case visualization components
- Error handling flow
- Documentation generation pipeline

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Interfaces
        CLI["CLI Interface"]:::ui
        WEB["Web Frontend (WASM)"]:::ui
        DOC["Documentation System"]:::docs
    end

    subgraph "Core Processing"
        subgraph "Parser System"
            PARSER[("Parser Module")]:::core
            AST["AST"]:::component
            COND["Condition Parser"]:::component
            FEAT["Feature Parser"]:::component
            IF["If Statement Parser"]:::component
        end

        subgraph "IR System"
            IR[("IR Module")]:::core
            AST2IR["AST to IR Converter"]:::component
            IR2NT["IR to N-tuple Converter"]:::component
        end

        subgraph "Test Generation"
            TESTGEN[("Test Generation System")]:::core
            TCG["Test Case Generator"]:::component
            TVG["Test Value Generator"]:::component
            BVA["BVA Module"]:::component
        end

        subgraph "Graph Reduction"
            GR[("Graph Reduction")]:::core
            LLC["Least Losing Components"]:::component
            LLE["Least Losing Edges"]:::component
            MONKE["Monke Algorithm"]:::component
        end
    end

    %% Relationships
    CLI --> PARSER
    WEB --> PARSER
    PARSER --> AST
    AST --> IR
    IR --> GR
    GR --> TESTGEN
    TESTGEN --> CLI
    TESTGEN --> WEB

    %% Component Details
    PARSER --- AST
    PARSER --- COND
    PARSER --- FEAT
    PARSER --- IF
    IR --- AST2IR
    IR --- IR2NT
    GR --- LLC
    GR --- LLE
    GR --- MONKE
    TESTGEN --- TCG
    TESTGEN --- TVG
    TESTGEN --- BVA

    %% Click Events
    click PARSER "https://github.com/test-design-org/general-predicate-testing/tree/main/gpt-common/src/parser/"
    click AST "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/parser/ast.rs"
    click COND "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/parser/condition.rs"
    click FEAT "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/parser/feature.rs"
    click IF "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/parser/if_statement.rs"
    click IR "https://github.com/test-design-org/general-predicate-testing/tree/main/gpt-common/src/ir/"
    click AST2IR "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/ir/ast_to_ir.rs"
    click IR2NT "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/ir/ir_to_ntuple.rs"
    click GR "https://github.com/test-design-org/general-predicate-testing/tree/main/gpt-common/src/graph_reduction/"
    click LLC "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/graph_reduction/least_losing_components.rs"
    click LLE "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/graph_reduction/least_losing_edges.rs"
    click MONKE "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/graph_reduction/monke.rs"
    click TCG "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/test_case_generator.rs"
    click TVG "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/test_value_generator.rs"
    click BVA "https://github.com/test-design-org/general-predicate-testing/blob/main/gpt-common/src/bva.rs"
    click CLI "https://github.com/test-design-org/general-predicate-testing/tree/main/gpt-cli/"
    click WEB "https://github.com/test-design-org/general-predicate-testing/tree/main/gpt-frontend/"
    click DOC "https://github.com/test-design-org/general-predicate-testing/tree/main/docusaurus/"

    %% Styling
    classDef ui fill:#90EE90,stroke:#333,stroke-width:2px
    classDef docs fill:#FFD700,stroke:#333,stroke-width:2px
    classDef core fill:#4169E1,stroke:#333,stroke-width:2px,color:#fff
    classDef component fill:#F0F8FF,stroke:#333,stroke-width:1px
```
