-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjudger.go
More file actions
36 lines (30 loc) · 845 Bytes
/
judger.go
File metadata and controls
36 lines (30 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package judger
import (
"github.com/Rabbit-OJ/Rabbit-OJ-Judger/compare"
JudgerModels "github.com/Rabbit-OJ/Rabbit-OJ-Judger/models"
)
const (
StatusOK = "OK"
)
func JudgeOneCase(testResult *JudgerModels.TestResult, stdout, rightStdout, compMode string) *JudgerModels.JudgeResult {
result := &JudgerModels.JudgeResult{}
if testResult.Status != StatusOK {
result.Status = testResult.Status
} else {
isAC := false
if compMode == "STDIN_F" {
isAC, _ = compare.ModeStdinFloat64(stdout, rightStdout)
} else if compMode == "STDIN_S" {
isAC, _ = compare.ModeStdinString(stdout, rightStdout)
} else {
isAC = compare.ModeCMP(stdout, rightStdout)
}
if isAC {
result.Status = "AC"
} else {
result.Status = "WA"
}
}
result.TimeUsed, result.SpaceUsed = testResult.TimeUsed, testResult.SpaceUsed
return result
}