Files
judge/dsl/ast.go
2026-04-05 18:20:42 +03:00

105 lines
1.8 KiB
Go

package dsl
import "time"
type File struct {
Build string
BuildLinux string
BuildWindows string
BuildDarwin string
Timeout time.Duration
Binary string // executable name produced by build (default: solution)
NormalizeCRLF bool // strip \r before matching stdout/stderr/outFiles
TrimTrailingWS bool // trim trailing whitespace on each line before matching
Groups []*Group
}
type Group struct {
Name string
Weight float64
Timeout time.Duration
Env map[string]string
Scoring ScoringMode
Wrapper string // exec wrapper command (e.g., "valgrind --error-exitcode=1")
Tests []*Test
Pattern *Pattern
}
type ScoringMode int
const (
ScoringPartial ScoringMode = iota // weight * passed/total (default)
ScoringAllOrNone // weight or 0
)
type Pattern struct {
InputGlob string
OutputGlob string
DirsGlob string
InputFile string
OutputFile string
}
func (p *Pattern) IsDirMode() bool {
return p.DirsGlob != ""
}
type Test struct {
Name string
Timeout time.Duration
Env map[string]string
Wrapper string
Stdin *string
Args []string
InFiles map[string]string
ExitCode *int
Stdout Matcher
Stderr Matcher
OutFiles map[string]string
}
type Matcher interface {
matcherNode()
}
type ExactMatcher struct {
Value string
}
func (ExactMatcher) matcherNode() {}
type ContainsMatcher struct {
Substr string
}
func (ContainsMatcher) matcherNode() {}
type RegexMatcher struct {
Pattern string
}
func (RegexMatcher) matcherNode() {}
type NumericEpsMatcher struct {
Epsilon float64
Value string
}
func (NumericEpsMatcher) matcherNode() {}
type AnyOrderMatcher struct {
Lines []string
}
func (AnyOrderMatcher) matcherNode() {}
type NoMatcher struct{}
func (NoMatcher) matcherNode() {}