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 c059f25
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 22 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)));
%=============================================================================
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 c059f25

Please sign in to comment.