-
Notifications
You must be signed in to change notification settings - Fork 0
/
submission.go
58 lines (49 loc) · 1.79 KB
/
submission.go
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package stella
import "encoding/json"
type SubmissionInput struct {
Token string `json:"token,omitempty"`
SourceCode string `json:"source_code,omitempty"`
LanguageId int `json:"language_id,omitempty"`
AdditionalFiles string `json:"additional_files,omitempty"`
ExpectedOutput string `json:"expected_output,omitempty"`
TestSourceCode string `json:"test_source_code,omitempty"`
StdIn string `json:"std_in,omitempty"`
}
type TestSubmissionInput struct {
SourceCode string `json:"source_code,omitempty"`
TestSourceCode string `json:"test_source_code,omitempty"`
LanguageId int `json:"language_id,omitempty"`
AdditionalFiles string `json:"additional_files,omitempty"`
FrameworkId int `json:"framework_id,omitempty"`
}
type SubmissionOutput struct {
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Token string `json:"token"`
Memory float32 `json:"memory,omitempty"`
Executed bool `json:"executed"`
OutputMatched bool `json:"output_matched"`
Time float32 `json:"time,string,omitempty"`
}
type TestSubmissionOutput struct {
Token string `json:"token"`
Passed []Test `json:"passed"`
Failed []Test `json:"failed"`
Success bool `json:"success"`
Total int `json:"total"`
}
func (s SubmissionOutput) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s SubmissionInput) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
type SubmissionLanguage struct {
Id int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
type SubmissionService interface {
CreateSubmission(input SubmissionInput) (*SubmissionOutput, error)
GetSubmission(token string) (*SubmissionOutput, error)
}