From bc259fc992eda7fdbb80a4964a4ce6ce48e9bb10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Freddy=20Rom=C3=A1n?= Date: Fri, 1 Apr 2022 17:53:08 -0700 Subject: [PATCH 1/3] parsing tests --- .../invalid-length.expected-failure | 1 + .../tests/invalid-cases/invalid-length.in | 4 ++ .../tests/invalid-cases/invalid-length.out | 0 .../two-dollars-same-row.expected-failure | 1 + .../invalid-cases/two-dollars-same-row.in | 2 + .../invalid-cases/two-dollars-same-row.out | 0 .../two-dollars.expected-failure | 1 + .../tests/invalid-cases/two-dollars.in | 4 ++ .../tests/invalid-cases/two-dollars.out | 0 .../tests/test-validator.py | 52 ++++++++++--------- Programacion Basica/A+B/.gitignore | 2 + Programacion Basica/A+B/cases/0.out | 1 - Programacion Basica/A+B/cases/1.in | 2 +- Programacion Basica/A+B/cases/1.out | 1 - Programacion Basica/A+B/cases/10.out | 1 - Programacion Basica/A+B/cases/2.out | 1 - Programacion Basica/A+B/cases/3.out | 1 - Programacion Basica/A+B/cases/4.out | 1 - Programacion Basica/A+B/cases/5.out | 1 - Programacion Basica/A+B/cases/6.out | 1 - Programacion Basica/A+B/cases/7.out | 1 - Programacion Basica/A+B/cases/8.out | 1 - Programacion Basica/A+B/cases/9.out | 1 - Programacion Basica/A+B/config.yaml | 28 ---------- Programacion Basica/A+B/examples/sample.in | 1 + Programacion Basica/A+B/examples/sample1.in | 1 + Programacion Basica/A+B/settings.json | 28 ++++++++++ .../es.markdown} | 0 .../A+B/{solution => solutions}/solution.cpp | 0 .../A+B/{solution => solutions}/solution2.cpp | 0 .../A+B/statements/es.markdown | 10 ++-- Programacion Basica/A+B/testplan | 11 ++++ Programacion Basica/A+B/tests/data.in | 1 + .../invalid-char.expected-failure | 1 + .../A+B/tests/invalid-cases/invalid-char.in | 1 + .../A+B/tests/invalid-cases/invalid-char.out | 0 .../out-of-bounds.expected-failure | 1 + .../A+B/tests/invalid-cases/out-of-bounds.in | 1 + .../A+B/tests/invalid-cases/out-of-bounds.out | 0 .../A+B/tests/test-validator.py | 31 +++++++++++ Programacion Basica/A+B/tests/tests.json | 16 ++++++ problems.json | 3 ++ 42 files changed, 144 insertions(+), 70 deletions(-) create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.expected-failure create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.in create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.out create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.expected-failure create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.in create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.out create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.expected-failure create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.in create mode 100644 Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.out create mode 100644 Programacion Basica/A+B/.gitignore delete mode 100644 Programacion Basica/A+B/cases/0.out delete mode 100644 Programacion Basica/A+B/cases/1.out delete mode 100644 Programacion Basica/A+B/cases/10.out delete mode 100644 Programacion Basica/A+B/cases/2.out delete mode 100644 Programacion Basica/A+B/cases/3.out delete mode 100644 Programacion Basica/A+B/cases/4.out delete mode 100644 Programacion Basica/A+B/cases/5.out delete mode 100644 Programacion Basica/A+B/cases/6.out delete mode 100644 Programacion Basica/A+B/cases/7.out delete mode 100644 Programacion Basica/A+B/cases/8.out delete mode 100644 Programacion Basica/A+B/cases/9.out delete mode 100644 Programacion Basica/A+B/config.yaml create mode 120000 Programacion Basica/A+B/examples/sample.in create mode 120000 Programacion Basica/A+B/examples/sample1.in create mode 100644 Programacion Basica/A+B/settings.json rename Programacion Basica/A+B/{statements/tutorial.markdown => solutions/es.markdown} (100%) rename Programacion Basica/A+B/{solution => solutions}/solution.cpp (100%) rename Programacion Basica/A+B/{solution => solutions}/solution2.cpp (100%) create mode 100644 Programacion Basica/A+B/testplan create mode 100644 Programacion Basica/A+B/tests/data.in create mode 100644 Programacion Basica/A+B/tests/invalid-cases/invalid-char.expected-failure create mode 100644 Programacion Basica/A+B/tests/invalid-cases/invalid-char.in create mode 100644 Programacion Basica/A+B/tests/invalid-cases/invalid-char.out create mode 100644 Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.expected-failure create mode 100644 Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.in create mode 100644 Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.out create mode 100644 Programacion Basica/A+B/tests/test-validator.py create mode 100644 Programacion Basica/A+B/tests/tests.json diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.expected-failure b/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.expected-failure new file mode 100644 index 00000000..7c0f475c --- /dev/null +++ b/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.expected-failure @@ -0,0 +1 @@ +expected 'line length to be 3, got 4' at 1:0 diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.in b/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.in new file mode 100644 index 00000000..7d918f40 --- /dev/null +++ b/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.in @@ -0,0 +1,4 @@ +3 3 300 +.#$. +#.. +.$. diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.out b/Busquedas/Derrame de Petroleo/tests/invalid-cases/invalid-length.out new file mode 100644 index 00000000..e69de29b diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.expected-failure b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.expected-failure new file mode 100644 index 00000000..96970291 --- /dev/null +++ b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.expected-failure @@ -0,0 +1 @@ +expected 'eol' at 1:2 diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.in b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.in new file mode 100644 index 00000000..b2b00ed3 --- /dev/null +++ b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.in @@ -0,0 +1,2 @@ +1 5 1 +.$$.. diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.out b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars-same-row.out new file mode 100644 index 00000000..e69de29b diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.expected-failure b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.expected-failure new file mode 100644 index 00000000..6279746c --- /dev/null +++ b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.expected-failure @@ -0,0 +1 @@ +expected 'eol' at 3:1 diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.in b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.in new file mode 100644 index 00000000..2d0e6a20 --- /dev/null +++ b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.in @@ -0,0 +1,4 @@ +3 3 300 +.#$ +#.. +.$. diff --git a/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.out b/Busquedas/Derrame de Petroleo/tests/invalid-cases/two-dollars.out new file mode 100644 index 00000000..e69de29b diff --git a/Busquedas/Derrame de Petroleo/tests/test-validator.py b/Busquedas/Derrame de Petroleo/tests/test-validator.py index d87ae7e0..009084d0 100644 --- a/Busquedas/Derrame de Petroleo/tests/test-validator.py +++ b/Busquedas/Derrame de Petroleo/tests/test-validator.py @@ -7,41 +7,43 @@ import sys import re import unittest +import parsy as p from omegaup.validator import validatortest +import omegaup.validator.parsing as oup -class Test(unittest.TestCase): - - def test(self): - with open('data.in', 'r') as handle: - lines = handle.read().split('\n') +@p.generate +def inputParser(): + R = yield oup.boundedInteger(1, 2000, 'R') + yield oup.space + C = yield oup.boundedInteger(1, 2000, 'C') + yield oup.space + K = yield oup.boundedInteger(1, 10**7, 'K') + yield oup.eol - self.assertEqual(lines[-1], '', "file doesn't end with EOL") - lines.pop() + def evalLineLength(line): + if len(line) != C: + return f'line length to be {C}, got {len(line)}' + return None - first_line_reg = re.compile(r'^(\d+) (\d+) (\d+)$') - self.assertTrue(first_line_reg.match(lines[0]), - "first line incorrectly formatted") - R, C, K = map(int, lines[0].split(' ')) + lineWithoutDollar = oup.label('line without $', p.regex(r'[.#]*') << oup.eol) + lineWithDollar = oup.label('line', p.regex(r'[.#]*\$?[.#]*') << oup.eol) - # Validar R, C, K - self.assertTrue(1 <= R <= 2000, "R out of bounds") - self.assertTrue(1 <= C <= 2000, "C out of bounds") - self.assertTrue(0 <= K <= 10**7, "K out of bounds") + saw_dollar = False + for r in range(R): + parser = lineWithoutDollar if saw_dollar else lineWithDollar + line = yield oup.guard(parser, evalLineLength) + saw_dollar |= '$' in line - # Validar número de lineas - self.assertEqual(len(lines), 1 + R, "line count mismatch") + if not saw_dollar: + return p.fail('$ to be present in map') - saw_dollar = False - map_reg = re.compile(r'^[.#$]+$') - for line in lines[1:]: - self.assertTrue(map_reg.match(line), "invalid character in map") - self.assertEqual(len(line), C, "line width mismatch") - if '$' in line: - self.assertFalse(saw_dollar, "too many $ in map") +class Test(unittest.TestCase): - self.assertFalse(saw_dollar, "no $ in map") + def test(self): + with open('data.in', 'r') as handle: + inputParser.parse(handle.read()) if __name__ == '__main__': diff --git a/Programacion Basica/A+B/.gitignore b/Programacion Basica/A+B/.gitignore new file mode 100644 index 00000000..beabd419 --- /dev/null +++ b/Programacion Basica/A+B/.gitignore @@ -0,0 +1,2 @@ +**/*.out +!tests/invalid-cases/*.out diff --git a/Programacion Basica/A+B/cases/0.out b/Programacion Basica/A+B/cases/0.out deleted file mode 100644 index f599e28b..00000000 --- a/Programacion Basica/A+B/cases/0.out +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/Programacion Basica/A+B/cases/1.in b/Programacion Basica/A+B/cases/1.in index 92880af7..cdda9c01 100644 --- a/Programacion Basica/A+B/cases/1.in +++ b/Programacion Basica/A+B/cases/1.in @@ -1 +1 @@ -1 1 \ No newline at end of file +23 45 diff --git a/Programacion Basica/A+B/cases/1.out b/Programacion Basica/A+B/cases/1.out deleted file mode 100644 index 0cfbf088..00000000 --- a/Programacion Basica/A+B/cases/1.out +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/Programacion Basica/A+B/cases/10.out b/Programacion Basica/A+B/cases/10.out deleted file mode 100644 index d4235836..00000000 --- a/Programacion Basica/A+B/cases/10.out +++ /dev/null @@ -1 +0,0 @@ --233 diff --git a/Programacion Basica/A+B/cases/2.out b/Programacion Basica/A+B/cases/2.out deleted file mode 100644 index d411bb7c..00000000 --- a/Programacion Basica/A+B/cases/2.out +++ /dev/null @@ -1 +0,0 @@ -400 diff --git a/Programacion Basica/A+B/cases/3.out b/Programacion Basica/A+B/cases/3.out deleted file mode 100644 index 573541ac..00000000 --- a/Programacion Basica/A+B/cases/3.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Programacion Basica/A+B/cases/4.out b/Programacion Basica/A+B/cases/4.out deleted file mode 100644 index 60d3b2f4..00000000 --- a/Programacion Basica/A+B/cases/4.out +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/Programacion Basica/A+B/cases/5.out b/Programacion Basica/A+B/cases/5.out deleted file mode 100644 index 37985410..00000000 --- a/Programacion Basica/A+B/cases/5.out +++ /dev/null @@ -1 +0,0 @@ -623 diff --git a/Programacion Basica/A+B/cases/6.out b/Programacion Basica/A+B/cases/6.out deleted file mode 100644 index b1bd38b6..00000000 --- a/Programacion Basica/A+B/cases/6.out +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/Programacion Basica/A+B/cases/7.out b/Programacion Basica/A+B/cases/7.out deleted file mode 100644 index 053d561b..00000000 --- a/Programacion Basica/A+B/cases/7.out +++ /dev/null @@ -1 +0,0 @@ --755 diff --git a/Programacion Basica/A+B/cases/8.out b/Programacion Basica/A+B/cases/8.out deleted file mode 100644 index 697cb3a2..00000000 --- a/Programacion Basica/A+B/cases/8.out +++ /dev/null @@ -1 +0,0 @@ -300 diff --git a/Programacion Basica/A+B/cases/9.out b/Programacion Basica/A+B/cases/9.out deleted file mode 100644 index aa324580..00000000 --- a/Programacion Basica/A+B/cases/9.out +++ /dev/null @@ -1 +0,0 @@ -579 diff --git a/Programacion Basica/A+B/config.yaml b/Programacion Basica/A+B/config.yaml deleted file mode 100644 index 8c9d2b62..00000000 --- a/Programacion Basica/A+B/config.yaml +++ /dev/null @@ -1,28 +0,0 @@ -alias: COMI-a-b - -generate-output: true -solution: solution/solution.cpp -timeout: 0.5 - -admin-groups: [workshop-2017] - -params: - title: A + B - source: Curso OMI (Orac) - - visibility: 1 - - languages: all - - time_limit: 1000 - memory_limit: 32768 - output_limit: 16384 - stack_limit: 10485760 - - overall_wall_time_limit: 60000 - - validator: token-caseless - validator_time_limit: 1000 - extra_wall_time: 0 - - email_clarifications: 0 diff --git a/Programacion Basica/A+B/examples/sample.in b/Programacion Basica/A+B/examples/sample.in new file mode 120000 index 00000000..afc4336d --- /dev/null +++ b/Programacion Basica/A+B/examples/sample.in @@ -0,0 +1 @@ +../cases/0.in \ No newline at end of file diff --git a/Programacion Basica/A+B/examples/sample1.in b/Programacion Basica/A+B/examples/sample1.in new file mode 120000 index 00000000..1e79ba52 --- /dev/null +++ b/Programacion Basica/A+B/examples/sample1.in @@ -0,0 +1 @@ +../cases/1.in \ No newline at end of file diff --git a/Programacion Basica/A+B/settings.json b/Programacion Basica/A+B/settings.json new file mode 100644 index 00000000..019a6f99 --- /dev/null +++ b/Programacion Basica/A+B/settings.json @@ -0,0 +1,28 @@ +{ + "title": "A + B", + "source": "Curso OMI (Orac)", + + "limits": { + "TimeLimit": 1000, + "MemoryLimit": 134217728, + "InputLimit": 134217728, + "OutputLimit": 134217728, + "ExtraWallTime": 3000, + "OverallWallTimeLimit": 60000 + }, + + "validator": { + "name": "token-caseless", + "limits": { + "TimeLimit": 1000 + } + }, + + "misc": { + "alias": "COMI-a-b", + "visibility": 1, + "languages": "all", + "email_clarifications": 0, + "admin-groups": ["workshop-2017"] + } +} diff --git a/Programacion Basica/A+B/statements/tutorial.markdown b/Programacion Basica/A+B/solutions/es.markdown similarity index 100% rename from Programacion Basica/A+B/statements/tutorial.markdown rename to Programacion Basica/A+B/solutions/es.markdown diff --git a/Programacion Basica/A+B/solution/solution.cpp b/Programacion Basica/A+B/solutions/solution.cpp similarity index 100% rename from Programacion Basica/A+B/solution/solution.cpp rename to Programacion Basica/A+B/solutions/solution.cpp diff --git a/Programacion Basica/A+B/solution/solution2.cpp b/Programacion Basica/A+B/solutions/solution2.cpp similarity index 100% rename from Programacion Basica/A+B/solution/solution2.cpp rename to Programacion Basica/A+B/solutions/solution2.cpp diff --git a/Programacion Basica/A+B/statements/es.markdown b/Programacion Basica/A+B/statements/es.markdown index fdb77cbd..f7cb8238 100644 --- a/Programacion Basica/A+B/statements/es.markdown +++ b/Programacion Basica/A+B/statements/es.markdown @@ -1,14 +1,14 @@ Deberás escribir un programa que tome dos números y los sume. -#Entrada +# Entrada La entrada consiste en dos enteros, $a$ y $b$, separados por un espacio en blanco. -#Salida +# Salida -Tu salida debe ser un solo número entero, la suma de $a$ y $b$. +Tu salida debe ser un solo número entero, la suma de $a$ y $b$. -#Ejemplo +# Ejemplo ||input 5 5 ||output @@ -23,6 +23,6 @@ Tu salida debe ser un solo número entero, la suma de $a$ y $b$. 23 + 45 = 68 ||end -#Límites +# Límites * $a$ y $b$ pueden ser enteros desde $1$ hasta $1,000$ diff --git a/Programacion Basica/A+B/testplan b/Programacion Basica/A+B/testplan new file mode 100644 index 00000000..1885748a --- /dev/null +++ b/Programacion Basica/A+B/testplan @@ -0,0 +1,11 @@ +0 9 +1 9 +2 9 +3 9 +4 9 +5 9 +6 9 +7 9 +8 9 +9 9 +10 10 diff --git a/Programacion Basica/A+B/tests/data.in b/Programacion Basica/A+B/tests/data.in new file mode 100644 index 00000000..c9a12dda --- /dev/null +++ b/Programacion Basica/A+B/tests/data.in @@ -0,0 +1 @@ +4 2 diff --git a/Programacion Basica/A+B/tests/invalid-cases/invalid-char.expected-failure b/Programacion Basica/A+B/tests/invalid-cases/invalid-char.expected-failure new file mode 100644 index 00000000..66ea18cd --- /dev/null +++ b/Programacion Basica/A+B/tests/invalid-cases/invalid-char.expected-failure @@ -0,0 +1 @@ +expected 'eol' at 0:3 diff --git a/Programacion Basica/A+B/tests/invalid-cases/invalid-char.in b/Programacion Basica/A+B/tests/invalid-cases/invalid-char.in new file mode 100644 index 00000000..601524cc --- /dev/null +++ b/Programacion Basica/A+B/tests/invalid-cases/invalid-char.in @@ -0,0 +1 @@ +4 5.3 diff --git a/Programacion Basica/A+B/tests/invalid-cases/invalid-char.out b/Programacion Basica/A+B/tests/invalid-cases/invalid-char.out new file mode 100644 index 00000000..e69de29b diff --git a/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.expected-failure b/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.expected-failure new file mode 100644 index 00000000..a3ac413d --- /dev/null +++ b/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.expected-failure @@ -0,0 +1 @@ +expected 'integer between 1 and 1000' diff --git a/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.in b/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.in new file mode 100644 index 00000000..f879177c --- /dev/null +++ b/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.in @@ -0,0 +1 @@ +4 0 diff --git a/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.out b/Programacion Basica/A+B/tests/invalid-cases/out-of-bounds.out new file mode 100644 index 00000000..e69de29b diff --git a/Programacion Basica/A+B/tests/test-validator.py b/Programacion Basica/A+B/tests/test-validator.py new file mode 100644 index 00000000..134bc8ae --- /dev/null +++ b/Programacion Basica/A+B/tests/test-validator.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# no-self-use +# pylint: disable=R0201 + +import sys +import re +import unittest +import parsy as p + +from omegaup.validator import validatortest +import omegaup.validator.parsing as oup + +@p.generate +def inputParser(): + a = yield oup.boundedInteger(1, 1000, 'a') + yield oup.space + b = yield oup.boundedInteger(1, 1000, 'b') + yield oup.eol + return (a, b) + +class Test(unittest.TestCase): + + def test(self): + with open('data.in', 'r') as handle: + (a, b) = inputParser.parse(handle.read()) + + +if __name__ == '__main__': + validatortest.main() diff --git a/Programacion Basica/A+B/tests/tests.json b/Programacion Basica/A+B/tests/tests.json new file mode 100644 index 00000000..0a6954bc --- /dev/null +++ b/Programacion Basica/A+B/tests/tests.json @@ -0,0 +1,16 @@ +{ + "solutions": [ + { + "filename": "../solutions/solution.cpp", + "verdict": "AC" + }, + { + "filename": "../solutions/solution2.cpp", + "verdict": "AC" + } + ], + "inputs": { + "filename": "test-validator.py" + }, + "max_score": 100 +} diff --git a/problems.json b/problems.json index 311bd722..5cdc3daf 100644 --- a/problems.json +++ b/problems.json @@ -8,6 +8,9 @@ }, { "path": "Programacion Basica/Palindromos" + }, + { + "path": "Programacion Basica/A+B" } ] } From 502ed5d3895a2fa47aa87dab7a1192cebc208789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Freddy=20Rom=C3=A1n?= Date: Fri, 1 Apr 2022 17:56:07 -0700 Subject: [PATCH 2/3] lint --- Busquedas/Derrame de Petroleo/tests/test-validator.py | 3 ++- Programacion Basica/A+B/tests/test-validator.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Busquedas/Derrame de Petroleo/tests/test-validator.py b/Busquedas/Derrame de Petroleo/tests/test-validator.py index 009084d0..864a3b39 100644 --- a/Busquedas/Derrame de Petroleo/tests/test-validator.py +++ b/Busquedas/Derrame de Petroleo/tests/test-validator.py @@ -27,7 +27,7 @@ def evalLineLength(line): return f'line length to be {C}, got {len(line)}' return None - lineWithoutDollar = oup.label('line without $', p.regex(r'[.#]*') << oup.eol) + lineWithoutDollar = oup.label('line w/o $', p.regex(r'[.#]*') << oup.eol) lineWithDollar = oup.label('line', p.regex(r'[.#]*\$?[.#]*') << oup.eol) saw_dollar = False @@ -39,6 +39,7 @@ def evalLineLength(line): if not saw_dollar: return p.fail('$ to be present in map') + class Test(unittest.TestCase): def test(self): diff --git a/Programacion Basica/A+B/tests/test-validator.py b/Programacion Basica/A+B/tests/test-validator.py index 134bc8ae..0296142c 100644 --- a/Programacion Basica/A+B/tests/test-validator.py +++ b/Programacion Basica/A+B/tests/test-validator.py @@ -12,6 +12,7 @@ from omegaup.validator import validatortest import omegaup.validator.parsing as oup + @p.generate def inputParser(): a = yield oup.boundedInteger(1, 1000, 'a') @@ -20,6 +21,7 @@ def inputParser(): yield oup.eol return (a, b) + class Test(unittest.TestCase): def test(self): From 32ca9346441f45a2c46e4b349fbe53d170352e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Freddy=20Rom=C3=A1n?= Date: Fri, 1 Apr 2022 18:01:09 -0700 Subject: [PATCH 3/3] grammar --- Busquedas/Derrame de Petroleo/tests/test-validator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Busquedas/Derrame de Petroleo/tests/test-validator.py b/Busquedas/Derrame de Petroleo/tests/test-validator.py index 864a3b39..f6cc0d28 100644 --- a/Busquedas/Derrame de Petroleo/tests/test-validator.py +++ b/Busquedas/Derrame de Petroleo/tests/test-validator.py @@ -24,7 +24,7 @@ def inputParser(): def evalLineLength(line): if len(line) != C: - return f'line length to be {C}, got {len(line)}' + return f'line length {C}, got {len(line)}' return None lineWithoutDollar = oup.label('line w/o $', p.regex(r'[.#]*') << oup.eol)