generator

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package generator implements the core test generation engine.

This package orchestrates the test generation process by coordinating language adapters, LLM providers, and output formatting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine orchestrates test generation

func NewEngine

func NewEngine(config EngineConfig) (*Engine, error)

NewEngine creates a new generation engine

func (*Engine) Generate

func (e *Engine) Generate(sourceFile *models.SourceFile, adapter adapters.LanguageAdapter) (*models.GenerationResult, error)

Generate generates tests for a source file

func (*Engine) GetCacheStats

func (e *Engine) GetCacheStats() (size int, hits int, misses int, hitRate float64)

GetCacheStats returns cache statistics

func (*Engine) GetUsage

func (e *Engine) GetUsage() *llm.UsageMetrics

GetUsage returns LLM usage metrics

type EngineConfig

type EngineConfig struct {
	DryRun      bool
	Validate    bool
	OutputDir   string
	TestTypes   []string
	Framework   string
	BatchSize   int
	Parallelism int
	Provider    string // "anthropic" or "openai"
}

EngineConfig contains configuration for the generation engine

type GeneratedTestJSON

type GeneratedTestJSON struct {
	TestName     string   `json:"test_name"`
	TestCode     string   `json:"test_code"`
	Imports      []string `json:"imports"`
	EdgeCases    []string `json:"edge_cases_covered"`
	Dependencies []string `json:"mocked_dependencies"`
}

GeneratedTestJSON represents the expected JSON structure from LLM

type WorkerPool

type WorkerPool struct {
	// contains filtered or unexported fields
}

WorkerPool manages parallel test generation

func NewWorkerPool

func NewWorkerPool(engine *Engine, workers int) *WorkerPool

NewWorkerPool creates a worker pool with the specified number of workers

func (*WorkerPool) Close

func (wp *WorkerPool) Close()

Close shuts down the worker pool

func (*WorkerPool) ProcessFiles

func (wp *WorkerPool) ProcessFiles(ctx context.Context, files []*models.SourceFile) []*models.GenerationResult

ProcessFiles processes multiple files in parallel

func (*WorkerPool) Results

func (wp *WorkerPool) Results() <-chan *models.GenerationResult

Results returns the results channel

func (*WorkerPool) Start

func (wp *WorkerPool) Start(ctx context.Context)

Start launches the worker goroutines

func (*WorkerPool) Submit

func (wp *WorkerPool) Submit(file *models.SourceFile)

Submit adds a file to the processing queue

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL