Skip to content

Commit

Permalink
Improve test files to be compatible with Sequoia
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelson-numerical-software committed Oct 20, 2024
1 parent bf1711c commit b7b004b
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ jobs:
python $GITHUB_WORKSPACE/tools/update_version/update_version.py
- name: CMake
run: |
cmake -DCMAKE_BUILD_TYPE=Release -DWITHOUT_SLICOT_MODULE=ON -G "Unix Makefiles" .
cmake -DCMAKE_BUILD_TYPE=Release -DWITHOUT_SLICOT_MODULE=ON -DWITHOUT_FFTW_MODULE=ON -G "Unix Makefiles" .
- name: make
run: cmake --build . -- -j$(nproc)
- name: get module skeleton
Expand Down
3 changes: 2 additions & 1 deletion modules/control_system/tests/test_zero.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
sys = ss(A, B, C, D);
[z, gain] = zero(sys);
assert_isequal(z, zeros(0, 1));
assert_isequal(gain, 500);
assert_isequal(real(gain), 500);
assert_istrue(imag(gain) < 100*eps);
%=============================================================================
13 changes: 11 additions & 2 deletions modules/graphics/tests/test_axis.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@
axis([0 2*pi -1.5 1.5]);
lim = axis();
REF = [0 6.2832 -1.5000 1.5000];
assert_isapprox(lim, REF, 1e-4);
assert_isapprox(lim(1), REF(1), 1e-4);
assert_isapprox(lim(2), REF(2), 1e-4);
assert_isapprox(lim(3), REF(3), 1e-4);
assert_isapprox(lim(4), REF(4), 1e-4);
%=============================================================================
f = figure();
x = linspace(-10, 10, 200);
y = sin(4 * x) ./ exp(0.1 * x);
plot(x, y);
axis([-10 10 0 inf])
axis([-10 10 0 inf]);
lim = axis();
REF = [-10 10 0 inf];
assert_isapprox(lim(1), REF(1), 1e-4);
assert_isapprox(lim(2), REF(2), 1e-4);
assert_isapprox(lim(3), REF(3), 1e-4);
assert_istrue(isinf(lim(4)));
%=============================================================================
14 changes: 9 additions & 5 deletions modules/gui/src/cpp/NelsonMinimized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// LICENCE_BLOCK_END
//=============================================================================
#include <QtCore/QTimer>
#include "NelsonMinimized.hpp"
#include "NelSon_engine_mode.h"
#include "QtMainWindow.h"
Expand All @@ -17,14 +18,17 @@ setNelsonMinimized(bool minimize)
{
if (NELSON_ENGINE_MODE::GUI == Nelson::NelsonConfiguration::getInstance()->getNelsonEngineMode()
&& Nelson::NelsonConfiguration::getInstance()->getMainGuiObject()) {
QtMainWindow* NelSonQtMainWindow
= (QtMainWindow*)Nelson::NelsonConfiguration::getInstance()->getMainGuiObject();
QtMainWindow* nelsonQtMainWindow = static_cast<QtMainWindow*>(
Nelson::NelsonConfiguration::getInstance()->getMainGuiObject());
if (minimize) {
NelSonQtMainWindow->setWindowState(Qt::WindowMinimized);
QTimer::singleShot(0, nelsonQtMainWindow, [nelsonQtMainWindow]() {
nelsonQtMainWindow->setWindowState(Qt::WindowMinimized);
});
} else {
NelSonQtMainWindow->setWindowState(Qt::WindowNoState);
QTimer::singleShot(0, nelsonQtMainWindow,
[nelsonQtMainWindow]() { nelsonQtMainWindow->setWindowState(Qt::WindowNoState); });
}
NelSonQtMainWindow->setVisible(true);
nelsonQtMainWindow->setVisible(true);
return true;
}
return false;
Expand Down
10 changes: 7 additions & 3 deletions modules/ipc/tests/test_ipc_minimize.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
% <--SEQUENTIAL TEST REQUIRED-->
%=============================================================================
% Gnome and some others platforms do not have 'minimize' concept
% macOs do not have 'minimize' concept too
%=============================================================================
if ~ismac()
ipc(getpid, 'minimize', true);
R = ipc(getpid, 'minimize');
assert_isequal(R, true)
end
%=============================================================================
ipc(getpid, 'minimize', true);
R = ipc(getpid, 'minimize');
assert_isequal(R, true)
ipc(getpid, 'minimize', false);
R = ipc(getpid, 'minimize');
assert_isequal(R, false)
Expand Down
1 change: 1 addition & 0 deletions modules/parallel/tests/bench_rand_parallel.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
%=============================================================================
% <--SEQUENTIAL TEST REQUIRED-->
%=============================================================================
A = [];
p = str2func('rand');
b = backgroundPool();
NumWorkers = b.NumWorkers;
Expand Down
53 changes: 35 additions & 18 deletions modules/webtools/tests/test_repo.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,41 @@
REF_TAGS = {'v0.0.1'; 'v0.0.2'};
assert_isequal(TAGS, REF_TAGS);
%=============================================================================
GIT_REPOSITORY = 'https://github.com/nelson-lang/repo_builtin_tests.git';
LOCAL_DIRECTORY = [tempdir(), 'test_repo', '_', createGUID()];
if isdir(LOCAL_DIRECTORY)
rmdir(LOCAL_DIRECTORY, 's');
end
mkdir(LOCAL_DIRECTORY);
repo('clone', GIT_REPOSITORY, LOCAL_DIRECTORY, "", "")
R = dir(LOCAL_DIRECTORY);
assert_isequal(length(R), 6);
REF_NAMES = {'.', '..', '.git', 'LICENSE', 'README.md', 'repo_test.nlf'};
for k = 1:length(R)
assert_isequal(R(k).name, REF_NAMES{k});
end
%=============================================================================
if isdir(LOCAL_DIRECTORY)
rmdir(LOCAL_DIRECTORY, 's');
end
%=============================================================================
% libgit on mac supports less features than libgit2.
if ismac()
return
end
%=============================================================================
GIT_REPOSITORY = 'https://github.com/nelson-lang/repo_builtin_tests.git';
LOCAL_DIRECTORY = [tempdir(), 'test_repo', '_', createGUID()];
if isdir(LOCAL_DIRECTORY)
rmdir(LOCAL_DIRECTORY, 's');
end
mkdir(LOCAL_DIRECTORY);
try
repo('clone', GIT_REPOSITORY, LOCAL_DIRECTORY)
catch ex
skip_testsuite(ex.message)
end
%=============================================================================
BRANCHES = repo('branch', LOCAL_DIRECTORY);
REF_BRANCHES = {'master'; 'origin/branch_dev'; 'origin/master'};
assert_istrue(any(contains(BRANCHES, REF_BRANCHES)));
Expand Down Expand Up @@ -69,21 +104,3 @@
rmdir(LOCAL_DIRECTORY, 's');
end
%=============================================================================
GIT_REPOSITORY = 'https://github.com/nelson-lang/repo_builtin_tests.git';
LOCAL_DIRECTORY = [tempdir(), 'test_repo', '_', createGUID()];
if isdir(LOCAL_DIRECTORY)
rmdir(LOCAL_DIRECTORY, 's');
end
mkdir(LOCAL_DIRECTORY);
repo('clone', GIT_REPOSITORY, LOCAL_DIRECTORY, "", "")
R = dir(LOCAL_DIRECTORY);
assert_isequal(length(R), 6);
REF_NAMES = {'.', '..', '.git', 'LICENSE', 'README.md', 'repo_test.nlf'};
for k = 1:length(R)
assert_isequal(R(k).name, REF_NAMES{k});
end
%=============================================================================
if isdir(LOCAL_DIRECTORY)
rmdir(LOCAL_DIRECTORY, 's');
end
%=============================================================================

0 comments on commit b7b004b

Please sign in to comment.