added exercise 4
All checks were successful
Python unit tests / unittests (push) Successful in 5s

This commit is contained in:
2025-01-24 15:51:12 +01:00
parent c7c36f7717
commit 307c46d86a
2 changed files with 259 additions and 0 deletions

51
tests/test_ex4.py Normal file
View File

@ -0,0 +1,51 @@
import unittest
from src.ex4_furniture import minimumMoves
class MyTestCase(unittest.TestCase):
def test_simple1(self):
current_plan = [
[0, 0, 0, 0],
[2, 0, 1, 0],
[0, 0, 1, 0]
]
target_plan = [
[0, 0, 2, 0],
[0, 1, 0, 0],
[0, 1, 0 ,0]
]
self.assertEqual(
minimumMoves(current_plan, target_plan),
[
[
[0, 0, 0, 0],
[2, 0, 1, 0],
[0, 0, 1, 0]
],
[
[2, 0, 0, 0],
[0, 0, 1, 0],
[0, 0, 1, 0]
],
[
[0, 2, 0, 0],
[0, 0, 1, 0],
[0, 0, 1, 0]
],
[
[0, 0, 2, 0],
[0, 0, 1, 0],
[0, 0, 1, 0]
],
[
[0, 0, 2, 0],
[0, 1, 0, 0],
[0, 1, 0, 0]
],
]
)
if __name__ == '__main__':
unittest.main()