Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/matlab-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
test-results-junit: test-results/results.xml
code-coverage-cobertura: code-coverage/coverage.xml
source-folder: src/octave
select-by-folder: tests/octave
select-by-folder: tests/matlab
strict: false
use-parallel: false
generate-summary: true
Expand All @@ -54,3 +54,22 @@ jobs:
with:
name: matlab-code-coverage
path: code-coverage/coverage.xml

- name: Checkout code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0

- name: Install system deps
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"
sudo apt-get update
sudo apt-get install -y octave

- name: Run Octave tests
run: |
cd tests/octave
octave --quiet --eval "oruntests('.')"
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ For documentation build requirements, please refer to the [Documentation Guide](

```bash
# Install all required packages
sudo apt install cmake libopenblas-dev libeigen3-dev
sudo apt update
sudo apt install octave make cmake libopenblas-dev libeigen3-dev
```

#### macOS Systems
Expand Down Expand Up @@ -125,10 +126,40 @@ make run_tests

Octave equivalent of the C++ test suite. We recommend running these tests before using MOLE to ensure proper setup.

First, verify the installation:

```bash
octave --version
make --version
```

GNU Octave is the supported open-source environment for running the tests. MATLAB is not required. The general contribution guidelines list GNU Octave as an accepted environment for MATLAB/Octave development.

```matlab
cd tests/octave
make run_octave_tests
```

The test suite includes tests for:
- 1D, 2D, and 3D gradient operators;
- 1D, 2D, and 3D divergence operators;
- 1D, 2D, and 3D Laplacian operators;
- polynomial exactness and convergence;
- boundary-condition operators;
- Poisson-solution accuracy;
- curvilinear-grid operators;
- Jacobian orientation and degeneracy detection; and
- transfinite and elliptic grid generation.

If GNU Make is unavailable, run the complete test directory directly:

```bash
cd tests/octave
octave --quiet --eval "addpath(pwd()); oruntests(pwd())"
```

A successful test produces no test failed message. A failed test reports the test block and the associated assertion message.

## Examples

Many of the examples require 'gnuplot' to visualize the results. You can get gnuplot on macOSX with
Expand Down
25 changes: 25 additions & 0 deletions tests/matlab/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Find all GNU Octave test files (test*.m)
file(GLOB TEST_SOURCES test*.m)

# Enable testing
enable_testing()

# Loop through all GNU Octave test files and register them as tests
foreach(TEST_SOURCE ${TEST_SOURCES})
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)

add_test(
NAME ${TEST_NAME}
COMMAND matlab
-nojvm
-batch
"addpath('${CMAKE_CURRENT_SOURCE_DIR}'); addpath('${CMAKE_SOURCE_DIR}/src/octave'); assertSuccess(runtests('${TEST_NAME}'))"
Comment on lines +13 to +16
)
endforeach()

# Custom target to run all GNU Octave tests using CTest
add_custom_target(run_octave_tests
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
COMMENT "Running all GNU Octave unit tests..."
)

Loading
Loading