-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Basic CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
tags: "*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
strategy: | ||
matrix: | ||
python-version: ["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 Python interface | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install numpy pytest | ||
pip install . | ||
- name: Run unit tests | ||
run: python -m pytest test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Test latest pip version | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
tags: "*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
strategy: | ||
matrix: | ||
python-version: ["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 Python interface from pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install numpy pytest | ||
pip install pdaqp | ||
- name: Run unit tests | ||
run: python -m pytest test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Test pdaqp | ||
""" | ||
import unittest | ||
import numpy | ||
from pdaqp import MPQP | ||
|
||
class Testing(unittest.TestCase): | ||
"""Testing class for pdaqp.""" | ||
|
||
def test_python_demo(self): | ||
H = numpy.array([[1.5064, 0.4838], [0.4838, 1.5258]]) | ||
f = numpy.zeros((2,1)) | ||
F = numpy.array([[9.6652, 5.2115], [7.0732, -7.0879]]) | ||
A = numpy.array([[1.0, 0], [-1, 0], [0, 1], [0, -1]]) | ||
b = 2*numpy.ones((4,1)); | ||
B = numpy.zeros((4,2)); | ||
|
||
thmin = -1.5*numpy.ones(2) | ||
thmax = 1.5*numpy.ones(2) | ||
|
||
# Setup mpQP and solve it | ||
mpQP = MPQP(H,f,F,A,b,B,thmin,thmax) | ||
mpQP.solve() | ||
|
||
self.assertEqual(len(mpQP.CRs), 9) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |