JOJ3/internal/parsers/dummy/parser.go
张泊明518370910136 f5b6b3cc9a
All checks were successful
continuous-integration/drone/push Build is passing
feat: multiple cmds each stage
2024-03-05 01:38:16 -05:00

35 lines
659 B
Go

package dummy
import (
"fmt"
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
)
type Config struct {
Score int
Comment string
}
type Dummy struct{}
func (e *Dummy) Run(results []stage.ExecutorResult, configAny any) (
[]stage.ParserResult, error,
) {
config, err := stage.DecodeConfig[Config](configAny)
if err != nil {
return nil, err
}
var res []stage.ParserResult
for _, result := range results {
res = append(res, stage.ParserResult{
Score: config.Score,
Comment: fmt.Sprintf(
"%s, executor status: run time: %d ns, memory: %d bytes",
config.Comment, result.RunTime, result.Memory,
),
})
}
return res, nil
}