Repository: pberkes/big_O (language: python)

Issue:
use github actions to run tests
- add `.github/workflows/run-test.yml`
- define config in `yml` file and run tests
- remove `.travis.yml`


Discussion / hints:

Fix patch:
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 4ea1396..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: python
-python:
-  - "2.7"
-  - "3.4"
-  - "3.5"
-  - "3.6"
-install: "pip install -r requirements.txt"
-script: "python -m unittest discover -v"


Test patch:
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
new file mode 100644
index 0000000..c12553b
--- /dev/null
+++ b/.github/workflows/run-tests.yml
@@ -0,0 +1,23 @@
+name: Run Unit tests
+run-name: test-runner
+on: [push]
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: ["3.8", "3.9", "3.10"]
+    steps:
+      - uses: actions/checkout@v3
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install pytest
+          pip install -r requirements.txt
+      - name: Run tests
+        run: |
+          pytest big_o/test/
diff --git a/big_o/test/test_big_o.py b/big_o/test/test_big_o.py
index 7c657d8..ff8f66c 100755
--- a/big_o/test/test_big_o.py
+++ b/big_o/test/test_big_o.py
@@ -43,6 +43,21 @@ def dummy_quadratic_function(n):
     return x // 20
 
 
+def dummy_linearithmic_function(n):
+    # Dummy operation with linearithmic complexity.
+
+    # Constant component of linearithmic function
+    dummy_constant_function(n)
+
+    x = 0
+    log_n = int(np.log(n))
+    for i in range(n):
+        for j in range(log_n):
+            for k in range(20):
+                x += 1
+    return x // 20
+
+
 class TestBigO(unittest.TestCase):
 
     def test_measure_execution_time(self):
@@ -105,8 +120,7 @@ def test_big_o(self):
             (dummy_constant_function, compl.Constant, (1000, 10000)),
             (dummy_linear_function, compl.Linear, (100, 5000)),
             (dummy_quadratic_function, compl.Quadratic, (1, 100)),
-            (lambda n: np.sort(random_array[:n], kind='heapsort'),
-             compl.Linearithmic, (100, random_array.shape[0])),
+            (dummy_linearithmic_function, compl.Linearithmic, (10, 5000)),
         ]
         for func, class_, n_range in desired:
             res_class, fitted = big_o.big_o(
@@ -114,7 +128,7 @@ def test_big_o(self):
                 min_n=n_range[0],
                 max_n=n_range[1],
                 n_measures=25,
-                n_repeats=10,
+                n_repeats=1,
                 n_timings=10,
                 return_raw_data = True)