summaryrefslogtreecommitdiff
path: root/inst/misc/test/stk_test_dfbinaryop.m
blob: 8e5880f4a447e49c149da7b34b2b6bf708844fea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% STK_TEST_DFBINARYOP ...

% Copyright Notice
%
%    Copyright (C) 2013 SUPELEC
%
%    Author:  Julien Bect  <julien.bect@centralesupelec.fr>

% Copying Permission Statement
%
%    This file is part of
%
%            STK: a Small (Matlab/Octave) Toolbox for Kriging
%               (http://sourceforge.net/projects/kriging)
%
%    STK is free software: you can redistribute it and/or modify it under
%    the terms of the GNU General Public License as published by the Free
%    Software Foundation,  either version 3  of the License, or  (at your
%    option) any later version.
%
%    STK is distributed  in the hope that it will  be useful, but WITHOUT
%    ANY WARRANTY;  without even the implied  warranty of MERCHANTABILITY
%    or FITNESS  FOR A  PARTICULAR PURPOSE.  See  the GNU  General Public
%    License for more details.
%
%    You should  have received a copy  of the GNU  General Public License
%    along with STK.  If not, see <http://www.gnu.org/licenses/>.

function stk_test_dfbinaryop (F, a1, a2)

try

    x1  = stk_dataframe (a1);
    x2  = stk_dataframe (a2);
    res = feval (F, a1, a2);

    x3 = feval (F, x1, x2);
    assert (isa (x3, 'stk_dataframe') && isequal (double (x3), res));

    x3 = feval (F, x1, a2);
    assert (isa (x3, 'stk_dataframe') && isequal (double (x3), res));

    x3 = feval (F, a1, a2);
    assert (isequal (x3, res));

catch

    err = lasterror ();

    if strcmp (err.message, ['octave_base_value::array_value(): ' ...
                             'wrong type argument `class'''])

        warning (msg.message);

    else
    
        rethrow (err);

    end

end % try

end % function