-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* format Convertidor * Fixed /hook_tools/lint.py lints * admin-group 2020 * .gitignore y quitar outs Co-authored-by: Janque <[email protected]> Co-authored-by: Freddy Román <[email protected]>
- Loading branch information
1 parent
d1a0d55
commit 6d76e5b
Showing
13 changed files
with
44 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.out |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,29 +1,33 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
import logging | ||
import unittest | ||
import sys | ||
import os | ||
import re | ||
|
||
from ctest import * | ||
from omegaup.validator import validatortest | ||
|
||
class Test(CTest): | ||
def test(self): | ||
if 'encode' in self.caseName: | ||
regex = re.compile(r'0\n(\d+)\n$') | ||
results = re.match(regex, self.input).groups() | ||
self.assertEqual(len(results), 1) | ||
number = int(results[0]) | ||
self.assertTrue(1 <= number < 2**63) | ||
elif 'decode' in self.caseName: | ||
regex = re.compile(r'1\n([A-Z]+)\n$') | ||
results = re.match(regex, self.input).groups() | ||
self.assertEqual(len(results), 1) | ||
limit = "CRPXNLSKVLJFHG" | ||
testStr = results[0] | ||
self.assertTrue(len(testStr) >= 1) | ||
self.assertTrue(len(testStr) < len(limit) or testStr <= limit) | ||
else: | ||
raise TestFailure('invalid case name') | ||
class MyTest(unittest.TestCase): | ||
def test_input(self): | ||
with open('data.in', 'r') as f: | ||
original_input = f.read() | ||
|
||
caseName = sys.argv[1] | ||
if 'encode' in caseName: | ||
regex = re.compile(r'^0\n(\d+)\n$') | ||
results = re.match(regex, original_input).groups() | ||
self.assertEqual(len(results), 1) | ||
number = int(results[0]) | ||
self.assertTrue(1 <= number < 2**63) | ||
elif 'decode' in caseName: | ||
regex = re.compile(r'^1\n([A-Z]+)\n$') | ||
results = re.match(regex, original_input).groups() | ||
self.assertEqual(len(results), 1) | ||
limit = "CRPXNLSKVLJFHG" | ||
self.assertTrue(len(results[0]) >= 1) | ||
self.assertTrue(len(results[0]) < len(limit) or results[0] <= limit) | ||
else: | ||
self.fail(f"Invalid case name: {caseName}") | ||
|
||
Test().run() | ||
if __name__ == '__main__': | ||
validatortest.main() |
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