init:
This commit is contained in:
104
dsl/ast.go
Normal file
104
dsl/ast.go
Normal file
@@ -0,0 +1,104 @@
|
||||
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() {}
|
||||
Reference in New Issue
Block a user