Skip to content

Commit

Permalink
fix bug when comparing empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisVilches committed Nov 2, 2024
1 parent 11e3ef3 commit 057605a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .metadata/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.13
2.0.14
12 changes: 8 additions & 4 deletions cmp/empty.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ func (Empty) ShortDisplay(int) string {
}

func (Empty) compare(
Comparable,
bool,
big.Decimal,
c Comparable,
_ bool,
_ big.Decimal,
) ([]verdictRange, big.Decimal) {
return []verdictRange{{Value: Verdicts.Correct}}, big.Decimal{}
if _, ok := c.(Empty); ok {
return []verdictRange{{Value: Verdicts.Correct}}, big.Decimal{}
}

return []verdictRange{{Value: Verdicts.Incorrect}}, big.Decimal{}
}
3 changes: 3 additions & 0 deletions integration/data/7/ans
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
2
3
1 change: 1 addition & 0 deletions integration/data/7/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
7 changes: 7 additions & 0 deletions integration/verdicts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ func TestWrongAnswer(t *testing.T) {
expectEq(t, lines[len(lines)-1], res)
}

func TestEmptyWrongAnswer(t *testing.T) {
lines := getLines(7)
res := "\033[31;1mWrong Answer\033[0;22m\033[31;1;22m 1/3\033[0;22;0m"

expectEq(t, lines[len(lines)-1], res)
}

func TestApprox(t *testing.T) {
lines := getLines(3)
res := "\033[32;1mAccepted\033[0;22m\033[32;1;22m 1/1\033[0;22;0m"
Expand Down

0 comments on commit 057605a

Please sign in to comment.