{ "info": { "author": "Lukasz Balcerzak", "author_email": "lukaszbalcerzak@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "=======\nporunga\n=======\n\n.. image:: https://secure.travis-ci.org/lukaszb/porunga.png?branch=master\n :target: http://travis-ci.org/lukaszb/porunga\n\n\n``porunga`` is a tool for algorithms testing.\n\n\nInstallation\n------------\n\nIn order to install ``porunga`` simply run::\n\n pip install porunga\n\nUsage\n-----\n\nBasically we need specific files structure to test our algorithms::\n\n ./foobar/\n ./foobar/foobar.py\n ./foobar/testdata/\n ./foobar/testdata/test01.in\n ./foobar/testdata/test01.out\n ./foobar/testdata/test02.in\n ./foobar/testdata/test02.out\n ./foobar/testdata/test03.in\n ./foobar/testdata/test03.out\n\nHere, ``foobar`` is our problem *name* - it should be same for parent the\ndirectory and coded solution (here we have ``foobar.py`` but it can be other\nlanguage - see supported languages below; i.e. for Java we would create\n``foobar.java`` file)\n\nAt ``./foobar/`` directory we would run::\n\n $ porunga test --lang python\n\nSee help for more options (you can see supported languages there too)::\n\n $ porunga test -h\n\nIf we want to set time constraints for tests we can use ``--timeout`` switch. In\nexample, if we need tests to run below 2.5 seconds we can run::\n\n $ porunga test --timeout 2.5\n\nPlease note that very low timeout value is not supported. Moreover, \n\nSupported languages\n-------------------\n\nCurrently ``porunga`` supports following languages:\n\n- `C `_\n- `C++ `_\n- `Objective C `_\n- `Python `_\n- `Ruby `_\n- `Java `_\n\nJava\n----\n\nJava source file should be named same as parent directory and should contain\npublic class with same name. So if our problem is called ``foobar`` we would\ncreate ``foobar.java`` file with ``foobar`` named public class.\n\nTutorial\n--------\n\nLet's say we have a following problem to solve:\n\nProblem\n~~~~~~~\n\nAt input we get two integers: ``n``, ``m``, where ``1 <= n < m <= 100000``.\nYour program should write to output all `Fibonacci numbers\n`_ between ``n`` and ``m``\n(including both). Numbers at output should be space separated.\n\nExamples::\n\n INPUT 1: 3 5\n OUTPUT 1: 2 3 5\n\n INPUT 2: 6 10\n OUTPUT 2: 8 13 21 34 55\n\nFirstly, let's make a directory for our solution::\n\n $ mkdir fibs\n $ cd fibs\n\nLet's also create a ``testdata`` directory (exact name should be used) and put\nthere some test cases::\n\n $ mkdir testdata\n $ echo '3 5' > testdata/test01.in\n $ echo '2 3 5' > testdata/test01.out\n $ echo '6 10' > testdata/test02.in\n $ echo '8 13 21 34 55' > testdata/test02.out\n\nNote that test inputs and outputs should have ``.in`` and ``.out`` extensions\nrespectively.\n\nNow let's create our solution - we can pick any of the supported languages but\nfor sake of this tutorial let it be Python module. Create one (empty for now)::\n\n $ touch fibs.py\n\nWe should have following files created by now::\n\n ./fibs/\n ./fibs/fibs.py\n ./fibs/testdata/\n ./fibs/testdata/test01.in\n ./fibs/testdata/test01.out\n ./fibs/testdata/test02.in\n ./fibs/testdata/test02.out\n\nThat's it. We can now run ``porunga`` inside ``fibs`` directory and see our\nsolution being tested against created test cases::\n\n $ porunga test\n Testing ./fibs\n ==============\n\n => Binary: python /Users/lukasz/temp/fibs/fibs.py\n\n => Testing ./fibs/testdata/test01.in ... Fail\n => Testing ./fibs/testdata/test02.in ... Fail\n\n => Total time: 0.058s\n => 2 out of 2 tests failed\n\nWell, we get 2 tests failed but we haven't actually coded anything yet. Just put\nfollowing code into ``fibs.py``::\n\n import fileinput\n import re\n import sys\n\n\n def fib(n):\n if n in (1, 2):\n return 1\n a = b = 1\n for x in range(3, n + 1):\n a, b = b, a + b\n return b\n\n def main():\n fin = fileinput.input()\n n, m = map(int, re.findall(r'\\d+', fin.readline()))\n fibs = [str(fib(num)) for num in range(n, m + 1)]\n result = ' '.join(fibs)\n sys.stdout.write(result)\n\n\n if __name__ == '__main__':\n main()\n\n(this is not optimal code as we compute Fibonacci numbers each time but it can\nbe easily upgraded)\n\nLet's run tests again::\n\n $ porunga test\n Testing ./fibs\n ==============\n\n => Binary: python ./fibs/fibs.py\n\n => Testing ./fibs/testdata/test01.in ... OK [0.030]s\n => Testing ./fibs/testdata/test02.in ... OK [0.033]s\n\n => Total time: 0.063s\n => All 2 tests passed", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lukaszb/porunga", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "porunga", "package_url": "https://pypi.org/project/porunga/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/porunga/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/lukaszb/porunga" }, "release_url": "https://pypi.org/project/porunga/0.9.3/", "requires_dist": null, "requires_python": null, "summary": "porunga is a test framework for simple algorithms", "version": "0.9.3" }, "last_serial": 926969, "releases": { "0.8.1": [ { "comment_text": "", "digests": { "md5": "e0f7b5367b62cf92ea714dc46663e017", "sha256": "29b04d5ba4cd5568662d34629d5954a23f102a44ad03e9c5bed449abc2805d9f" }, "downloads": -1, "filename": "porunga-0.8.1.tar.gz", "has_sig": false, "md5_digest": "e0f7b5367b62cf92ea714dc46663e017", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11410, "upload_time": "2012-12-06T22:53:14", "url": "https://files.pythonhosted.org/packages/fe/67/ec9678cba9966ce6d9fec23c767b1e0329be1cfd3da04427ec3aeb4bab5d/porunga-0.8.1.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "9d21a0cb1908280482cd5f0a89390e8f", "sha256": "c53ed52c7531cdd3185c67b8012d085a3c112874e378e986f0de72719e8e5170" }, "downloads": -1, "filename": "porunga-0.9.0.tar.gz", "has_sig": false, "md5_digest": "9d21a0cb1908280482cd5f0a89390e8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11660, "upload_time": "2013-05-20T20:04:19", "url": "https://files.pythonhosted.org/packages/73/75/9c3371d304f5ab696d8325fcad48ec1b705ae1ee219c94c30f3151091eae/porunga-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "64a4c9ea92980a5fe67f4ba2d31f0ae4", "sha256": "0a4224da7405009d6b5a1106089e72b9010e5d2bd72e0baa0282c3d71777aa64" }, "downloads": -1, "filename": "porunga-0.9.1.tar.gz", "has_sig": false, "md5_digest": "64a4c9ea92980a5fe67f4ba2d31f0ae4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11909, "upload_time": "2013-05-23T22:42:23", "url": "https://files.pythonhosted.org/packages/ef/1e/a76500db7c22588a8d9c4262ef8a68f02acb01b99d921dd3c221fff5bf7e/porunga-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "05f79b42a2334ea6e4301be0ab6cd03f", "sha256": "99b68e9fa426a0a79771c8bf98a1ea548ec0192fd7cfb786be51ecddd417e585" }, "downloads": -1, "filename": "porunga-0.9.2.tar.gz", "has_sig": false, "md5_digest": "05f79b42a2334ea6e4301be0ab6cd03f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11906, "upload_time": "2013-05-23T22:46:08", "url": "https://files.pythonhosted.org/packages/cb/1a/ee60e92f67386a3ef75ee9c791fa85a9eb863f1669d666b9cf1a66011f65/porunga-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "082b44bab4d33a649ba61f2edf8a545e", "sha256": "cbcea7deae9f1302cf02b94c0a5f609107bf0bfe56ebd5980873bd51b389b6ad" }, "downloads": -1, "filename": "porunga-0.9.3-py27-none-any.whl", "has_sig": false, "md5_digest": "082b44bab4d33a649ba61f2edf8a545e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20147, "upload_time": "2013-11-22T23:09:12", "url": "https://files.pythonhosted.org/packages/ab/8e/4228cc310649c2f238ce0ece5d90712b1e3b232ca5b4ba1e62aff11ce850/porunga-0.9.3-py27-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f31483581a9946bd0a7dda7a59f75549", "sha256": "669b3b0a289f309b8740877f7d7faec315ac2e4f39dfef99d9bb567fd7e515c6" }, "downloads": -1, "filename": "porunga-0.9.3.tar.gz", "has_sig": false, "md5_digest": "f31483581a9946bd0a7dda7a59f75549", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13620, "upload_time": "2013-11-22T23:09:10", "url": "https://files.pythonhosted.org/packages/bf/3b/c9326823e75afc8952f09df97c85c0975b9de5759498a335adf00a671568/porunga-0.9.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "082b44bab4d33a649ba61f2edf8a545e", "sha256": "cbcea7deae9f1302cf02b94c0a5f609107bf0bfe56ebd5980873bd51b389b6ad" }, "downloads": -1, "filename": "porunga-0.9.3-py27-none-any.whl", "has_sig": false, "md5_digest": "082b44bab4d33a649ba61f2edf8a545e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20147, "upload_time": "2013-11-22T23:09:12", "url": "https://files.pythonhosted.org/packages/ab/8e/4228cc310649c2f238ce0ece5d90712b1e3b232ca5b4ba1e62aff11ce850/porunga-0.9.3-py27-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f31483581a9946bd0a7dda7a59f75549", "sha256": "669b3b0a289f309b8740877f7d7faec315ac2e4f39dfef99d9bb567fd7e515c6" }, "downloads": -1, "filename": "porunga-0.9.3.tar.gz", "has_sig": false, "md5_digest": "f31483581a9946bd0a7dda7a59f75549", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13620, "upload_time": "2013-11-22T23:09:10", "url": "https://files.pythonhosted.org/packages/bf/3b/c9326823e75afc8952f09df97c85c0975b9de5759498a335adf00a671568/porunga-0.9.3.tar.gz" } ] }