Remove tests and alternative Python implementations

Ad discussed here:
https://github.com/coding-horror/basic-computer-games/issues/548#issuecomment-1081008471
This commit is contained in:
Martin Thoma
2022-03-29 06:56:06 +02:00
parent 6f9cb1bac2
commit 17a75813b1
32 changed files with 1 additions and 2352 deletions

View File

@@ -1,58 +0,0 @@
import io
import pytest
from _pytest.capture import CaptureFixture
from _pytest.monkeypatch import MonkeyPatch
from amazing import build_maze, welcome_header, main
def test_welcome_header(capsys: CaptureFixture[str]) -> None:
capsys.readouterr()
welcome_header()
out, err = capsys.readouterr()
assert out == (
" AMAZING PROGRAM\n"
" CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n\n"
)
assert err == ""
@pytest.mark.parametrize(
("width", "length"),
[
(1, 1),
(1, 0),
(1, -1),
(1, 2),
(2, 1),
],
)
def test_build_maze(width: int, length: int) -> None:
with pytest.raises(AssertionError):
build_maze(width, length)
@pytest.mark.parametrize(
("width", "length"),
[
(3, 3),
(10, 10),
],
)
def test_main(monkeypatch: MonkeyPatch, width: int, length: int) -> None:
monkeypatch.setattr(
"sys.stdin",
io.StringIO(f"{width},{length}"),
)
main()
def test_main_error(monkeypatch: MonkeyPatch) -> None:
width = 1
length = 2
monkeypatch.setattr(
"sys.stdin",
io.StringIO(f"{width},{length}\n3,3"),
)
main()