Skip to content

Commit cc69671

Browse files
committed
Returned tests
1 parent fd227b7 commit cc69671

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

common/db/models/models_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"testing"
1111
"testing_system/common/constants/verdict"
1212
"testing_system/lib/customfields"
13+
"time"
1314
)
1415

1516
func fixtureDb(t *testing.T) *gorm.DB {
@@ -62,11 +63,29 @@ memory: 5m
6263
func TestTestResultsDB(t *testing.T) {
6364
t.Run("sqlite", func(t *testing.T) {
6465
db := fixtureDb(t)
66+
oneSec := customfields.Time(1 * time.Second)
67+
tenMB := customfields.Memory(10 * 1024 * 1024)
6568
submission := Submission{
6669
ProblemID: 1,
6770
Language: "cpp",
6871
Score: 1,
6972
Verdict: verdict.TL,
73+
TestResults: []*TestResult{
74+
{
75+
TestNumber: 1,
76+
Points: nil,
77+
Verdict: verdict.OK,
78+
Time: &oneSec,
79+
Memory: &tenMB,
80+
},
81+
{
82+
TestNumber: 0,
83+
Points: nil,
84+
Verdict: "",
85+
Time: &oneSec,
86+
Memory: &tenMB,
87+
},
88+
},
7089
}
7190
tx := db.Create(&submission)
7291
require.Nil(t, tx.Error)

0 commit comments

Comments
 (0)