testing

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 2 Imported by: 0

README

Testing

Testing strategy for vecna.

Structure

testing/
├── helpers.go          # Domain-specific test helpers
├── helpers_test.go     # Tests for helpers themselves
├── benchmarks/         # Performance tests
└── integration/        # End-to-end tests

Running Tests

# All tests
make test

# Unit tests only (fast)
make test-unit

# Integration tests
make test-integration

# Benchmarks
make test-bench

Test Helpers

The testing package provides domain-specific helpers:

  • NewTestBuilder(t) - Creates a standard test builder
  • AssertNoError(t, f) - Validates filter has no errors
  • AssertError(t, f) - Validates filter has an error
  • AssertOp(t, f, op) - Validates filter operator
  • AssertField(t, f, name) - Validates filter field name
  • AssertChildCount(t, f, n) - Validates child filter count

Conventions

  1. All helpers call t.Helper() for clean stack traces
  2. All helpers accept *testing.T as first parameter
  3. Helpers are domain-specific to vecna, not generic utilities

Documentation

Overview

Package testing provides test helpers for vecna.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertChildCount

func AssertChildCount(t *testing.T, f *vecna.Filter, expected int)

AssertChildCount fails the test if the filter doesn't have the expected number of children.

func AssertError

func AssertError(t *testing.T, f *vecna.Filter)

AssertError fails the test if the filter does not have an error.

func AssertField

func AssertField(t *testing.T, f *vecna.Filter, expected string)

AssertField fails the test if the filter field doesn't match expected.

func AssertNoError

func AssertNoError(t *testing.T, f *vecna.Filter)

AssertNoError fails the test if the filter has an error.

func AssertOp

func AssertOp(t *testing.T, f *vecna.Filter, expected vecna.Op)

AssertOp fails the test if the filter operator doesn't match expected.

func NewTestBuilder

func NewTestBuilder(t *testing.T) *vecna.Builder[DocumentMetadata]

NewTestBuilder creates a Builder[DocumentMetadata] for testing. Fails the test if builder creation fails.

Types

type DocumentMetadata

type DocumentMetadata struct {
	Category string   `json:"category"`
	Score    float64  `json:"score"`
	Active   bool     `json:"active"`
	Tags     []string `json:"tags"`
	Count    int      `json:"count"`
}

DocumentMetadata is a standard test schema for vecna tests.

Jump to

Keyboard shortcuts

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