diff

package
v0.0.0-...-078a93b Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package diff implements string comparison functionality for the specific output files, comparing then with expected answers and assigning scores based on results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LCS

func LCS(a, b []string, equal func(a, b string) bool) [][2]int

LCS computes the longest common subsequence of two string slices and returns the index pairs of the LCS.

Types

type Conf

type Conf struct {
	PassComment       string `default:"🥳Passed!\n"`
	FailComment       string `default:"🧐Failed...\n"`
	FailOnNotAccepted bool   `default:"true"`
	ForceQuitOnFailed bool   `default:"false"`
	Cases             []struct {
		Outputs []struct {
			Score            int
			FileName         string
			AnswerPath       string
			CompareSpace     bool
			AlwaysHide       bool
			ForceQuitOnDiff  bool
			MaxDiffLength    int `default:"2048"` // just for reference
			MaxDiffLines     int `default:"50"`   // just for reference
			HideCommonPrefix bool
		}
	}
}

type Diff

type Diff struct{}

func (*Diff) Run

func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
	[]stage.ParserResult, bool, error,
)

type DiffLine

type DiffLine struct {
	Text string
	Type DiffType
}

DiffLine represents a single line and its diff type.

type DiffType

type DiffType int8

DiffType defines the type of a diff element.

const (
	// Delete represents a diff delete operation.
	Delete DiffType = -1
	// Insert represents a diff insert operation.
	Insert DiffType = 1
	// Equal represents no diff.
	Equal DiffType = 0
)

Jump to

Keyboard shortcuts

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