Help us shape the future of Go! Take the 2026 Go Developer Survey

comparator

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareResponses

func CompareResponses(records1, records2 <-chan respreader.RespRecord, numComparisons int, comparator Comparator, workers int) <-chan RespDiff

CompareResponses compares responses from the given channels using the specified response comparator.

Types

type Comparator

type Comparator interface {
	Compare(resp1, resp2 sender.Response) (map[string][]diffmatchpatch.Diff, error)
}

Comparator is responsible for performing comparison of two responses.

type DefaultComparator

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

func NewDefaultComparator

func NewDefaultComparator(ignoreOrder bool) DefaultComparator

func (DefaultComparator) Compare

func (c DefaultComparator) Compare(x, y sender.Response) (map[string][]diffmatchpatch.Diff, error)

type RespDiff

type RespDiff struct {
	Rec1  respreader.RespRecord
	Rec2  respreader.RespRecord
	Diffs map[string][]diffmatchpatch.Diff
}

RespDiff is the result of comparing two response records.

type ScriptComparator

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

func NewScriptComparator

func NewScriptComparator(script string, ignoreOrder bool) (ScriptComparator, error)

NewScriptComparator creates a new response comparator from the given JavaScript code. The script must have a function called 'compare' that accepts two responses and returns a map of comparison definitions.

func (*ScriptComparator) Compare

func (c *ScriptComparator) Compare(x, y sender.Response) (map[string][]diffmatchpatch.Diff, error)

Jump to

Keyboard shortcuts

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