From b74daa8240ea0bc040d8972842d4c0d072de49f0 Mon Sep 17 00:00:00 2001 From: Ahmed Hesham Date: Mon, 13 Oct 2025 19:42:43 +0300 Subject: [PATCH] intial commit --- .github/workflows/main.yaml | 17 +++++++++++++++++ main.py | 6 ++++++ test_main.py | 16 ++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 .github/workflows/main.yaml create mode 100644 main.py create mode 100644 test_main.py diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..d710bc5 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,17 @@ +name: Ghaymah Deploy + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + + test: + steps: + - name: Checkout repository + uses: actions/checkout@v5.0.0 + + - name: Run tests + run: python3 test_main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..3b474e9 --- /dev/null +++ b/main.py @@ -0,0 +1,6 @@ +def add(a, b): + return a + b + + +def subtract(a, b): + return a - b diff --git a/test_main.py b/test_main.py new file mode 100644 index 0000000..24ba461 --- /dev/null +++ b/test_main.py @@ -0,0 +1,16 @@ +import unittest +from main import add, subtract + + +class TestCalculator(unittest.TestCase): + def test_add(self): + self.assertEqual(add(2, 3), 5) + self.assertEqual(add(-1, 1), 0) + + def test_subtract(self): + self.assertEqual(subtract(5, 2), 3) + self.assertEqual(subtract(0, 1), -1) + + +if __name__ == "__main__": + unittest.main()