Home > matpower6.0 > t > t_feval_w_path.m

t_feval_w_path

PURPOSE ^

T_FEVAL_W_PATH Tests for FEVAL_W_PATH.

SYNOPSIS ^

function t_feval_w_path(quiet)

DESCRIPTION ^

T_FEVAL_W_PATH  Tests for FEVAL_W_PATH.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t_feval_w_path(quiet)
0002 %T_FEVAL_W_PATH  Tests for FEVAL_W_PATH.
0003 
0004 %   MATPOWER
0005 %   Copyright (c) 2016, Power Systems Engineering Research Center (PSERC)
0006 %   by Ray Zimmerman, PSERC Cornell
0007 %
0008 %   This file is part of MATPOWER.
0009 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0010 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0011 
0012 if nargin < 1
0013     quiet = 0;
0014 end
0015 
0016 n_tests = 20;
0017 
0018 t_begin(n_tests, quiet);
0019 
0020 t = '$MATPOWER/t/t_feval_w_path must not be in path';
0021 t_ok(exist('rithmaticker') ~= 2, t);
0022 
0023 % find path to this test file
0024 cwd = pwd;
0025 [p, n, e] = fileparts(which('t_feval_w_path'));
0026 
0027 t = 'ab = feval_w_path(<absolute path>, fname, a, b)';
0028 rv = feval_w_path(fullfile(p, 't_feval_w_path'), 'rithmaticker', 3, 4);
0029 t_ok(strcmp(cwd, pwd), [t ' : cwd unchanged']);
0030 t_is(rv, 12, 15, t);
0031 
0032 t = 'abc = feval_w_path(<absolute path>, fname, a, b, c)';
0033 rv = feval_w_path(fullfile(p, 't_feval_w_path'), 'rithmaticker', 3, 4, 5);
0034 t_ok(strcmp(cwd, pwd), [t ' : cwd unchanged']);
0035 t_is(rv, 60, 15, t);
0036 
0037 t = 'abcd = feval_w_path(<absolute path>, fname, a, b, c, d)';
0038 rv = feval_w_path(fullfile(p, 't_feval_w_path'), 'rithmaticker', 3, 4, 5, 6);
0039 t_ok(strcmp(cwd, pwd), [t ' : cwd unchanged']);
0040 t_is(rv, 360, 15, t);
0041 
0042 t = '[ab, a_b] = feval_w_path(<absolute path>, fname, a, b)';
0043 [rv, rv2] = feval_w_path(fullfile(p, 't_feval_w_path'), 'rithmaticker', 3, 4);
0044 t_ok(strcmp(cwd, pwd), [t ' : cwd unchanged']);
0045 t_is(rv, 12, 15, t);
0046 t_is(rv2, 7, 15, t);
0047 
0048 %% switch dir to be able to use relative path
0049 cd(p);
0050 cwd2 = pwd;
0051 
0052 t = 'ab = feval_w_path(<relative path>, fname, a, b)';
0053 rv = feval_w_path('t_feval_w_path', 'rithmaticker', 3, 4);
0054 t_ok(strcmp(cwd2, pwd), [t ' : cwd unchanged']);
0055 t_is(rv, 12, 15, t);
0056 
0057 t = 'abc = feval_w_path(<relative path>, fname, a, b, c)';
0058 rv = feval_w_path('t_feval_w_path', 'rithmaticker', 3, 4, 5);
0059 t_ok(strcmp(cwd2, pwd), [t ' : cwd unchanged']);
0060 t_is(rv, 60, 15, t);
0061 
0062 t = 'abcd = feval_w_path(<relative path>, fname, a, b, c, d)';
0063 rv = feval_w_path('t_feval_w_path', 'rithmaticker', 3, 4, 5, 6);
0064 t_ok(strcmp(cwd2, pwd), [t ' : cwd unchanged']);
0065 t_is(rv, 360, 15, t);
0066 
0067 t = '[ab, a_b] = feval_w_path(<relative path>, fname, a, b)';
0068 [rv, rv2] = feval_w_path('t_feval_w_path', 'rithmaticker', 3, 4);
0069 t_ok(strcmp(cwd2, pwd), [t ' : cwd unchanged']);
0070 t_is(rv, 12, 15, t);
0071 t_is(rv2, 7, 15, t);
0072 
0073 
0074 cd(cwd);
0075 t = 'successful switch to original working directory';
0076 t_ok(strcmp(cwd, pwd), t);
0077 
0078 t_end;

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005