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 ¶
- type Engine
- type EngineConfig
- type GeneratedTestJSON
- type WorkerPool
- func (wp *WorkerPool) Close()
- func (wp *WorkerPool) ProcessFiles(ctx context.Context, files []*models.SourceFile) []*models.GenerationResult
- func (wp *WorkerPool) Results() <-chan *models.GenerationResult
- func (wp *WorkerPool) Start(ctx context.Context)
- func (wp *WorkerPool) Submit(file *models.SourceFile)
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 ¶
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) 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