Skip to content

Commit

Permalink
Refactor build and test functions, introduce developer mode.
Browse files Browse the repository at this point in the history
- Added a parameter to the build function
- Updated library path in build function
- Removed redundant code in the test function
- Introduced developer_mode flag and adjusted paths based on it
  • Loading branch information
BJCaasenbrood committed Mar 6, 2024
1 parent d025c60 commit 8207fcb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions @sorotoki/private/buildSorotokiMex.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function buildSorotokiMex(installPath)
function buildSorotokiMex(installPath, base)

global auto_approve

log = Log();
log.options.isDebug = true;
library = '/lib/';
library = base;

if ~auto_approve
disp('Build Sorotoki .mex executables?');
Expand Down
11 changes: 1 addition & 10 deletions @sorotoki/private/runSorotokiTest.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
function out = runSorotokiTest(prompt, installPath, base, testsuite)
flag = [];
% base = 'src/Sorotoki';
% testsuite = {'Sdf'; 'Mesh'; 'Fem'};
% if isempty(base)
% base = 'lib/sorotoki';
% end

% if isempty(testsuite)
% testsuite = {'sdf'; 'mesh'; 'fem'};
% end

% eliminate suites not in prompt
if ~isempty( prompt )
Expand All @@ -25,7 +16,7 @@
warning on;

if all(flag == 1)
fprintf('All tests passed!\n ');
fprintf('All tests passed!\n');
out = true;
else
out = false;
Expand Down
17 changes: 15 additions & 2 deletions @sorotoki/sorotoki.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,21 @@
cd(installPath);
if sum(ismember(prompt,'--approve'))
auto_approve = true;
elseif sum(ismember(prompt,'--developer'))
developer_mode = true;
prompt = strrep(prompt,'--developer',''); % remove developer prompt
elseif sum(ismember(prompt,'--dev'))
developer_mode = true;
prompt = strrep(prompt,'--dev',''); % remove developer prompt
end
buildSorotokiMex(installPath);

if developer_mode
base = '/src/';
else
base = '/lib/';
end

buildSorotokiMex(installPath, base);
cd(installPath);
return
end
Expand All @@ -139,7 +152,7 @@
prompt = strrep(prompt,'--dev',''); % remove developer prompt
end

testsuite = {'sdf'; 'mesh'; 'fem'};
testsuite = {'sdf'; 'mesh'; 'fem'; 'shapes'; 'model'; 'control'};

if developer_mode
base = 'src/sorotoki';
Expand Down

0 comments on commit 8207fcb

Please sign in to comment.