69 lines
2.1 KiB
Markdown
69 lines
2.1 KiB
Markdown
## under construction
|
|
|
|
### Like LeetCode
|
|
|
|
but more lightweight
|
|
|
|
run the bash script to start the server.
|
|
|
|
if you want to contribute write tests like this:
|
|
|
|
### FileStructure:
|
|
|
|
In /problems/ create a folder named after the problem.
|
|
|
|
In this folder create ```manifest.json, test.py, description.md```
|
|
|
|
**Manifest.JSON needs to exsist and _needs_ to look like this:**
|
|
```json
|
|
{
|
|
"title": "Title of the Problem",
|
|
"description": "Write a very short description here",
|
|
"description_md": "problems/problempath/description.md",
|
|
"difficulty": "easy || medium || hard",
|
|
"test_code": "problems/problempath/test.py"
|
|
}
|
|
```
|
|
I do know it might be a bit tedious but this is required and its the easiest way.
|
|
|
|
#### After you've decided on how you would name / write your Test write it like this:
|
|
|
|
- It is important to note that you _CAN_ write the Code the User is expected to write firstly. **BUT** after writing the UnitTest and it passing, comment out the written code.
|
|
|
|
It is supposed to look something like this (/sortlist/):
|
|
|
|
```python
|
|
"""
|
|
@TESTSAMPLE.PY / NAME THIS "test.py" in your actual project
|
|
"""
|
|
import unittest
|
|
|
|
" )) First Point from the List "
|
|
# def sortlist(lst = [4,3,2,1]) -> list:
|
|
# return sorted(lst)
|
|
|
|
")) This is a 'easy' Test, if you want you can write more defined ones."
|
|
class TestSolution(unittest.TestCase):
|
|
def test_sort(self):
|
|
self.x = []
|
|
self.assertEqual(sortlist(self.x), sorted(self.x)) # pyright: ignore[reportUndefinedVariable] <- This is only here so that pyright doesnt complain ; NOT NECCESARY!
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|
|
|
|
"""
|
|
PLEASE WRITE TEST ACCORDING TO
|
|
CONVENTION IN NEW TEST
|
|
@regex-phonenumber/test.py
|
|
"""
|
|
```
|
|
#### Writing the description:
|
|
|
|
**Please** by _God_ write simple and easy to understand terms. If you write like Einstein noone is going to understand you.
|
|
|
|
- Syntax:
|
|
- Normal Markdown.
|
|
- Start with "##" instead of "#" ; "##" looks better
|
|
- Use CrossLinks ( something like [W3](https://www.w3schools.com/), or the [PyDocs](https://docs.python.org/3/))
|
|
- Good Formatting is always appreciated
|