1 % Automatic
test procedure - based on EQuUs v4.8
2 % Copyright (C) 2015 Peter Rakyta, Ph.D.
4 % This program is free software: you can redistribute it and/or modify
5 % it under the terms of the GNU General Public License as published by
6 % the Free Software Foundation, either version 3 of the License, or
7 % (at your option) any later version.
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 % GNU General Public License
for more details.
14 % You should have received a copy of the GNU General Public License
15 % along with
this program. If not, see http:
18 %> @brief Launches the automatic
test procedure. First, source code functionalities are checked by processing the unit tests in directory
'UnitTests' and then larger computational tasks are performed via examples in directory
'Examples' 20 %> EQuUs v4.9 or later
22 %> @brief Launches the automatic
test procedure. First, source code functionalities are checked by processing the unit tests in directory
'UnitTests' and then larger computational tasks are performed via examples in directory
'Examples' 25 filename = mfilename(
'fullpath');
26 root = fileparts( filename );
31 %% performing larger computational tasks
34 fncnames = {
'magnetic_ribbon', ...
35 'MinimalConductivity', ...
36 'Graphene_Conductivity', ...
37 'magnetic_barrier', ...
38 'Differential_conductance', ...
39 'Graphene_QAD_eig', ...
40 'Graphene_antidot_transport', ...
41 'JosephsonCurrent', ...
42 'SpectralDensity', ...
47 Dirs = {
'magnetic_ribbon', ... 1
48 'Graphene_Minimal_Conductivity', ... 2
49 'Graphene_Conductivity', ... 3
50 'magnetic_barrier_0B0', ... 4
51 'Differential_conductance', ... 5
52 'Graphene_antidot_eigenstate', ... 6
53 'Graphene_antidot_transport', ... 7
54 'SNS_Josephson', ... 8
55 'SpectralDensity', ... 9
56 'SSH_transport', ... 10
57 'SSH_Josephson' ... 11
60 % These tests are skipped during the
test procedure
63 % the filename of the output to be exported in
64 output_file =
'automatic_test_results.txt';
68 % removing previous debug files
69 delete( [root, filesep,
'Examples', filesep,
'*', filesep,
'debug.txt'] );
71 test_results =
false(size(fncnames));
73 for jdx = 1:length(fncnames)
75 if ~isempty( find(jdx == skip_tests, 1) )
79 test_results(jdx) =
runTest( fncnames{jdx}, Dirs{jdx});
82 fid = fopen(output_file,
'a');
83 fprintf(fid, [
'Test ', fncnames{jdx},
' finished succesfully. Check the results.\n']);
86 fid = fopen(output_file,
'a');
87 fprintf(fid, [
'Test ', fncnames{jdx},
' failed due to coding error.\n']);
95 if norm(
true(size(test_results)) - test_results ) <= 1e-6
96 disp(
'*************************');
97 disp(
'*************************');
98 disp(
'All tests passed.')
99 disp('*************************');
101 for jdx = 1:length(fncnames)
102 if test_results( jdx )
105 failed_fncname = fncnames{ jdx };
106 failed_Dir = Dirs{jdx};
107 disp([
'Test ', fullfile(root,
'Examples', failed_Dir, failed_fncname),
' failed.']);
115 %> @brief Runs the
test for a specific example
116 %> @
param fncname The name of the exmaple to be started.
117 %> @
param directory The absolut path to the directory containing the
test case.
118 function ret =
runTest( fncname, directory)
120 disp(
'**************************************' )
121 disp( ['starting
test: ', fncname] )
122 disp( '**************************************' )
124 directory = fullfile( root, 'Examples', directory);
127 feval( fncname, filenum );
139 %> @brief Determines the up-comming 'filenum' input.
140 %> @
param directory The absolut path to the directory containing the test case.
141 %> @return Returns with the next filenum value to run the test case.
145 numerics = {
'1' '2' '3' '4' '5' '6' '7' '8' '9' '0'};
151 list = dir( fullfile( directory,
'results',
'*.mat') );
163 for kdx = 1:length(list)
164 filename_tmp = list(kdx).name;
165 for idx = 1:length(filename_tmp)
166 character = filename_tmp(idx);
167 comp = find(strcmp( character, numerics ));
170 if isempty( start_idx )
174 if isempty( end_idx ) && ~isempty( start_idx )
180 if ~isempty( start_idx ) && ~isempty(end_idx )
181 number_tmp = str2double( filename_tmp(start_idx:end_idx-1) );
function test(arg1, arg2)
Brief description of the function.
Fortran compatible complex type.
function runTest(fncname, directory)
Runs the test for a specific example.
Structure param contains data structures describing the physical parameters of the scattering center ...
function getFilenum(directory)
Determines the up-comming 'filenum' input.
function automatic_test()
Launches the automatic test procedure. First, source code functionalities are checked by processing t...