From 1a08710dea03ade7c5f93b770631805fb15ff21e Mon Sep 17 00:00:00 2001 From: Andrei Rusanescu Date: Tue, 28 Apr 2026 16:43:11 +0300 Subject: [PATCH 1/4] Added tests Signed-off-by: Andrei Rusanescu --- laboratories/cicd-documentation/tree.py | 29 ++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/laboratories/cicd-documentation/tree.py b/laboratories/cicd-documentation/tree.py index 2639fcd1..e399b7bc 100644 --- a/laboratories/cicd-documentation/tree.py +++ b/laboratories/cicd-documentation/tree.py @@ -1,5 +1,5 @@ from node import Node - +import unittest class Tree: """ Tree class for binary tree """ @@ -76,10 +76,33 @@ def _printInorderTree(self, node): def _printPreorderTree(self, node): # TODO - pass + if node is not None: + print(str(node.data) + ' ') + self._printPreorderTree(node.left) + self._printPostorderTree(node.right) def _printPostorderTree(self, node): # TODO - pass + if node is not None: + self._printPreorderTree(node.left) + self._printPostorderTree(node.right) + print(str(node.data) + ' ') + + +class TestTreeFind(unittest.TestCase): + def setUp(self): + self.tree = Tree() + values = [50, 30, 70, 20, 40] + for v in values: + self.tree.add(v) + + def test_find_non_existing_element(self): + result = self.tree.find(100) + self.assertIsNone(result, "Should be none") + def test_find_root(self): + result = self.tree.find(50) + self.assertEqual(result, self.tree.getRoot(), "Root was not found.") +if __name__ == '__main__': + unittest.main() From c1b3af6ed86e027d674c69c12d7c2c67ca6cf6f3 Mon Sep 17 00:00:00 2001 From: Andrei Rusanescu Date: Tue, 28 Apr 2026 16:48:10 +0300 Subject: [PATCH 2/4] Added tests.yml Signed-off-by: Andrei Rusanescu --- .github/workflows/tests.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..cad80195 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,21 @@ +name: Unit Tests + +on: + # pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Run tests + run: python -m unittest discover \ No newline at end of file From 968df83c5b92ba2317e4fadf4e43c7935b86f6b0 Mon Sep 17 00:00:00 2001 From: Andrei Rusanescu Date: Tue, 28 Apr 2026 16:48:44 +0300 Subject: [PATCH 3/4] Added tests.yml Signed-off-by: Andrei Rusanescu --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cad80195..cc95d0d5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,9 +1,9 @@ name: Unit Tests on: - # pull_request: - branches: - - main + pull_request: + branches: + - main jobs: test: From 17a4b500b8d3ba395eff49f9bcf98859fa8e9cf1 Mon Sep 17 00:00:00 2001 From: Andrei Rusanescu Date: Tue, 28 Apr 2026 16:51:23 +0300 Subject: [PATCH 4/4] Added gigel Signed-off-by: Andrei Rusanescu --- laboratories/cicd-documentation/gigel.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 laboratories/cicd-documentation/gigel.md diff --git a/laboratories/cicd-documentation/gigel.md b/laboratories/cicd-documentation/gigel.md new file mode 100644 index 00000000..41dc3560 --- /dev/null +++ b/laboratories/cicd-documentation/gigel.md @@ -0,0 +1 @@ +# HI \ No newline at end of file