Skip to content

Commit

Permalink
#318: update tests/command_download_*.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kmyk committed Feb 28, 2019
1 parent 9ab7a7a commit fa71de9
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 167 deletions.
41 changes: 41 additions & 0 deletions tests/command_download_anarchygolf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import os
import unittest

import tests.command_download


class DownloadAnarchyGolfTest(unittest.TestCase):
def snippet_call_download(self, *args, **kwargs):
tests.command_download.snippet_call_download(self, *args, **kwargs)

def test_call_download_anarchygolf_the_b_programming_language(self):
self.snippet_call_download('http://golf.shinh.org/p.rb?The+B+Programming+Language', {
'sample-3.out': 'fcbee46b3b888607abe720d598c75b17',
'sample-2.in': '810d1189284ef048fc30f80ba7a22c6d',
'sample-2.out': 'd4e62449830b2a986024d914b194f129',
'sample-3.in': '7361217616875a437a3d6b41612dacbb',
'sample-1.in': '3de90f793f16fad76da1527e09b8e528',
'sample-1.out': 'f67b46b3c53308d8a6414b20092a2220',
})

def test_call_download_anarchygolf_simple_language(self):
self.snippet_call_download('http://golf.shinh.org/p.rb?simple+language', {
'sample-3.out': 'c4211571f7a72cfad092b4dac7b15144',
'sample-2.in': '10e10b554ef9bc07d56a514d2f6dab26',
'sample-2.out': '48a24b70a0b376535542b996af517398',
'sample-3.in': 'f201f3f6606e56f561f8452c9a60210b',
'sample-1.in': '9b3c9ece5285bb1bcd1164cec8aa4243',
'sample-1.out': '48a24b70a0b376535542b996af517398',
})

def test_call_download_anarchygolf_hello_world(self):
self.snippet_call_download('http://golf.shinh.org/p.rb?hello+world', {
'sample-1.in': 'd41d8cd98f00b204e9800998ecf8427e',
'sample-1.out': '746308829575e17c3331bbcb00c0898b',
})

def test_call_download_anarchygolf_momomo(self):
self.snippet_call_download('http://golf.shinh.org/p.rb?momomo', {
'sample-1.in': '281e30fff54f179881c67c4d0564633e',
'sample-1.out': 'd67adc236dd84fd82fb4598922d5cf32',
})
16 changes: 8 additions & 8 deletions tests/command_download_aoj.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ def test_call_download_aoj_2394(self):
def test_call_download_aoj_system_ITP1_1_B(self):
self.snippet_call_download(
'http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_B', {
'1.in': 'b026324c6904b2a9cb4b88d6d61c81d1',
'1.out': 'b026324c6904b2a9cb4b88d6d61c81d1',
'2.in': '6d7fce9fee471194aa8b5b6e47267f03',
'2.out': '66a7c1d5cb75ef2542524d888fd32f4a',
'3.in': '9caff0735bc6e80121cedcb98ca51821',
'3.out': 'fef5f767008b27f5c3801382264f46ef',
'4.in': '919d117956d3135c4c683ff021352f5c',
'4.out': 'b39ffd5aa5029d696193c8362dcb1d19',
'test1.in': 'b026324c6904b2a9cb4b88d6d61c81d1',
'test1.out': 'b026324c6904b2a9cb4b88d6d61c81d1',
'test2.in': '6d7fce9fee471194aa8b5b6e47267f03',
'test2.out': '66a7c1d5cb75ef2542524d888fd32f4a',
'test3.in': '9caff0735bc6e80121cedcb98ca51821',
'test3.out': 'fef5f767008b27f5c3801382264f46ef',
'test4.in': '919d117956d3135c4c683ff021352f5c',
'test4.out': 'b39ffd5aa5029d696193c8362dcb1d19',
}, is_system=True)

def test_call_download_aoj_system_1169(self):
Expand Down
41 changes: 41 additions & 0 deletions tests/command_download_codeforces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import os
import unittest

import tests.command_download


class DownloadCodeforcesTest(unittest.TestCase):
def snippet_call_download(self, *args, **kwargs):
tests.command_download.snippet_call_download(self, *args, **kwargs)

def test_call_download_codeforces_problemset_700_b(self):
self.snippet_call_download('http://codeforces.com/problemset/problem/700/B', {
'sample-1.in': '1f38b0f27f4b0005e5409e834ff59166',
'sample-2.out': '7c5aba41f53293b712fd86d08ed5b36e',
'sample-2.in': '8a8c08b2901d4cfca41ad0703dfa718e',
'sample-1.out': '9ae0ea9e3c9c6e1b9b6252c8395efdc1',
})

def test_call_download_codeforces_contest_538_h(self):
self.snippet_call_download('http://codeforces.com/contest/538/problem/H', {
'sample-1.in': 'c8483ca371b414e911ccbecf239beed6',
'sample-2.out': '87a45b8adc25c7bf37eaa25b530de79c',
'sample-2.in': 'afa0c8b2336e798b5f29a200a18432d1',
'sample-1.out': '166a3645f3c31595526624ce003b41fc',
})

def test_call_download_codeforces_gym_101021_a(self):
self.snippet_call_download('http://codeforces.com/gym/101021/problem/A', {
'sample-1.in': '4dfb06c20503a3f0dbe0fb29dd52d304',
'sample-2.out': '614a0c8025f8bbcf46b8ba0ff9fd61d1',
'sample-2.in': 'dcfe1f14721a0e141c2e31adeebe7a53',
'sample-1.out': '45778e8e2d350841cf68711ece5cb9e1',
})

def test_call_download_codeforces_contest_1080_a(self):
self.snippet_call_download('https://codeforces.com/contest/1080/problem/A', {
'sample-1.in': '54d3363c78b5001b1a6f382f47e08b60',
'sample-1.out': '31d30eea8d0968d6458e0ad0027c9f80',
'sample-2.in': 'd33b56dd139d846a5df6eab7cfaf83e8',
'sample-2.out': 'bda81ba88c634b46394ead43aff31ad5',
})
27 changes: 27 additions & 0 deletions tests/command_download_csacademy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import unittest

import tests.command_download


class DownloadCSAcademyTest(unittest.TestCase):
def snippet_call_download(self, *args, **kwargs):
tests.command_download.snippet_call_download(self, *args, **kwargs)

def test_call_download_csacademy_k_swap(self):
self.snippet_call_download('https://csacademy.com/contest/round-39/task/k-swap/', {
'sample-1.in': '2ce34946200aa66529dbc96b411e2450',
'sample-1.out': '78c6d00be497cd50311743df6c8de3ea',
'sample-2.in': '65625b1f27b94fc2c5b6532a18f93070',
'sample-2.out': '16324a714d2c6f4f9feefe65f0784094',
'sample-3.in': '8e92bd4fb348c40f78a13c56a1f5a937',
'sample-3.out': 'c31f209a3d0412a16c4b93e4ee060b54',
})

def test_call_download_csacademy_unfair_game(self):
self.snippet_call_download('https://csacademy.com/contest/archive/task/unfair_game/', {
'sample-1.in': '57cce69a08e8dd833a9f9aa3b6d13a40',
'sample-1.out': '367764329430db34be92fd14a7a770ee',
'sample-2.in': '46b87e796b61eb9b8970e83c93a02809',
'sample-2.out': 'eb844645e8e61de0a4cf4b991e65e63e',
})
45 changes: 22 additions & 23 deletions tests/command_download_hackerrank.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,28 @@ def test_call_download_hackerrank_beautiful_array(self):
})

def test_call_download_hackerrank_hourrank_30_a_system(self):
# TODO: these file names should "00.in", "00.out", ..., "10.out"
self.snippet_call_download(
'https://www.hackerrank.com/contests/hourrank-30/challenges/video-conference', {
'1.in': 'b138a1282e79697057d5eca993a29414',
'1.out': 'de044533ac6d30ed89eb5b4e10ff105b',
'2.in': '0e64d38accc35d4b8ac4fc0df3b5b969',
'2.out': '3362cf9066bba541387e5b6787b13e6e',
'3.in': '7df575910d94fecb93861eaf414d86dd',
'3.out': 'eb68db6a13e73b093d620f865e4cc098',
'4.in': 'd87880f0cd02ee106a8cadc5ccd97ed0',
'4.out': 'a24f9580a3701064cb49534689b50b60',
'5.in': 'f5981eb3068da7d2d2c1b84b23ea8710',
'5.out': 'df0a3dfc2217cbc8e8828e423933206b',
'6.in': 'b1387e51b1f9c4e16713647b36e8341b',
'6.out': 'ac14c5fed571104401167dd04fdcf417',
'7.in': 'ba080fc7b89b2aed00fcf03a5db29f8a',
'7.out': '3a365fc4aec7cad9536c598b7d892e7a',
'8.in': '9d3f2cfb7b6412ef40a8b5ef556c3a46',
'8.out': '8e7a02d5c6bdd9358c589b3e400bacb8',
'9.in': '8409f37413e40f3baee0314bcacfc0a4',
'9.out': 'fe2d333498a3bdebaa0f4c88803566ff',
'10.in': '6f3e4c84441ae56e141a600542cc8ec8',
'10.out': '66e67dc4e8edbf66ed9ae2c9a0862f2b',
'11.in': 'fe24b76ea70e0a44213d7f22d183a33b',
'11.out': '8b8ba206ea7bbb02f0361341cb8da7c7',
'00.in': 'b138a1282e79697057d5eca993a29414',
'00.out': 'de044533ac6d30ed89eb5b4e10ff105b',
'01.in': '0e64d38accc35d4b8ac4fc0df3b5b969',
'01.out': '3362cf9066bba541387e5b6787b13e6e',
'02.in': '7df575910d94fecb93861eaf414d86dd',
'02.out': 'eb68db6a13e73b093d620f865e4cc098',
'03.in': 'd87880f0cd02ee106a8cadc5ccd97ed0',
'03.out': 'a24f9580a3701064cb49534689b50b60',
'04.in': 'f5981eb3068da7d2d2c1b84b23ea8710',
'04.out': 'df0a3dfc2217cbc8e8828e423933206b',
'05.in': 'b1387e51b1f9c4e16713647b36e8341b',
'05.out': 'ac14c5fed571104401167dd04fdcf417',
'06.in': 'ba080fc7b89b2aed00fcf03a5db29f8a',
'06.out': '3a365fc4aec7cad9536c598b7d892e7a',
'07.in': '9d3f2cfb7b6412ef40a8b5ef556c3a46',
'07.out': '8e7a02d5c6bdd9358c589b3e400bacb8',
'08.in': '8409f37413e40f3baee0314bcacfc0a4',
'08.out': 'fe2d333498a3bdebaa0f4c88803566ff',
'09.in': '6f3e4c84441ae56e141a600542cc8ec8',
'09.out': '66e67dc4e8edbf66ed9ae2c9a0862f2b',
'10.in': 'fe24b76ea70e0a44213d7f22d183a33b',
'10.out': '8b8ba206ea7bbb02f0361341cb8da7c7',
}, is_system=True, is_silent=True)
3 changes: 3 additions & 0 deletions tests/command_download_kattis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ def test_call_download_kattis_8queens(self):
self.snippet_call_download(
'https://open.kattis.com/contests/asiasg15prelwarmup/problems/8queens', [
{
"name": "example00",
"input": "*.......\n..*.....\n....*...\n......*.\n.*......\n.......*\n.....*..\n...*....\n",
"output": "invalid\n"
},
{
"name": "example01",
"input": "*.......\n......*.\n....*...\n.......*\n.*......\n...*....\n.....*..\n..*.....\n",
"output": "valid\n"
},
Expand All @@ -25,6 +27,7 @@ def test_call_download_kattis_hanoi18_a(self):
self.snippet_call_download(
'https://hanoi18.kattis.com/problems/amazingadventures', [
{
"name": "1",
"input": "3 3\n1 1\n3 3\n2 1\n2 2\n\n3 4\n1 1\n3 4\n2 1\n1 2\n\n2 2\n2 1\n2 2\n1 2\n1 1\n\n0 0\n",
"output": "YES\nRRUULLD\nNO\nYES\nRD\n"
},
Expand Down
136 changes: 0 additions & 136 deletions tests/command_download_others.py

This file was deleted.

42 changes: 42 additions & 0 deletions tests/command_download_poj.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os
import unittest

import tests.command_download


class DownloadPOJTest(unittest.TestCase):
def snippet_call_download(self, *args, **kwargs):
tests.command_download.snippet_call_download(self, *args, **kwargs)

def test_call_download_poj_1000(self):
self.snippet_call_download(
'http://poj.org/problem?id=1000', [
{
"name": "sample",
"input": "1 2\r\n",
"output": "3\r\n"
},
], type='json')

def test_call_download_poj_2104(self):
self.snippet_call_download(
'http://poj.org/problem?id=2104', [
{
"name": "sample",
"input": "7 3\r\n1 5 2 6 3 7 4\r\n2 5 3\r\n4 4 1\r\n1 7 3\r\n",
"output": "5\r\n6\r\n3\r\n"
},
], type='json')

def test_call_download_poj_3150(self):
self.snippet_call_download(
'http://poj.org/problem?id=3150', [
{
"input": "5 3 1 1\r\n1 2 2 1 2\r\n",
"output": "2 2 2 2 1\r\n"
},
{
"input": "5 3 1 10\r\n1 2 2 1 2\r\n",
"output": "2 0 0 2 2\r\n"
},
], type='json')
Loading

0 comments on commit fa71de9

Please sign in to comment.