-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from online-judge-tools/feature/improve-sample…
…-guessing Update simple_patterns.py to recognize output formats which depend variables in input formats
- Loading branch information
Showing
5 changed files
with
189 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import unittest | ||
|
||
import onlinejudge_template.analyzer.combined as analyzer | ||
from onlinejudge_template.types import * | ||
|
||
|
||
class TestAnalyzerCombined(unittest.TestCase): | ||
"""TestAnalyzerCombinedCodeforces is a class for integration tests about analyzers (without network access). | ||
""" | ||
def test_output_format_depending_input_format(self) -> None: | ||
resources = AnalyzerResources( | ||
url='https://atcoder.jp/contests/arc093/tasks/arc093_a', | ||
html=b'...skipped...', | ||
input_format_string='N\r\nA_1 A_2 ... A_N\r\n', | ||
output_format_string=None, | ||
sample_cases=[ | ||
SampleCase(input=b'3\n3 5 -1\n', output=b'12\n8\n10\n'), | ||
SampleCase(input=b'5\n1 1 1 2 0\n', output=b'4\n4\n4\n2\n4\n'), | ||
SampleCase(input=b'6\n-679 -2409 -3258 3095 -3291 -4462\n', output=b'21630\n21630\n19932\n8924\n21630\n19288\n'), | ||
], | ||
) | ||
|
||
input_format = SequenceNode(items=[ | ||
ItemNode(indices=[], name='N'), | ||
NewlineNode(), | ||
LoopNode(body=ItemNode(indices=['i + 1'], name='A'), name='i', size='N'), | ||
NewlineNode(), | ||
]) | ||
output_format = LoopNode(body=SequenceNode(items=[ | ||
ItemNode(indices=['i'], name='ans'), | ||
NewlineNode(), | ||
]), name='i', size='N') | ||
|
||
analyzed = analyzer.run(resources) | ||
self.assertEqual(str(analyzed.input_format), str(input_format)) | ||
self.assertEqual(str(analyzed.output_format), str(output_format)) |