-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add cc files for testing oct files
Fixes Issue #181.
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
%% -*- texinfo -*- | ||
%% @defun test_all () | ||
%% tests | ||
%% | ||
%% @example | ||
%% 42 | ||
%% @result{} ans = 42 | ||
%% @end example | ||
%% | ||
%% Note its not possible to call doctest from a doctest [1]. | ||
%% Instead, we use octave BIST mechanism. | ||
%% | ||
%% [1] https://github.com/catch22/octave-doctest/issues/184 | ||
%% | ||
%% @end defun | ||
|
||
function test_all() | ||
|
||
end | ||
|
||
%!test | ||
%! [numpass, numtests, ~] = doctest ('test_octfile_single_fcn'); | ||
%! assert (numtests, 2) | ||
%! assert (numpass, 2) | ||
|
||
%!test | ||
%! % different behaviour with or without extension | ||
%! [dir, ~, ~] = fileparts (which ('test_octfile_multi.oct')); | ||
%! autoload ('test_subfcn1', fullfile (dir, 'test_octfile_multi.oct')); | ||
%! [numpass, numtests, ~] = doctest ('test_octfile_multi'); | ||
%! assert (numtests, 1) | ||
%! assert (numpass, 1) | ||
%! [numpass, numtests, ~] = doctest ('test_octfile_multi.oct'); | ||
%! assert (numtests, 4) | ||
%! assert (numpass, 4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <octave/oct.h> | ||
|
||
DEFUN_DLD (test_octfile_multi, args, , | ||
"-*- texinfo -*-\n\ | ||
@deftypefn {} {} test_octfile_multi ()\n\ | ||
Testing\n\ | ||
\n\ | ||
@example\n\ | ||
a = 42\n\ | ||
@result{} a = 42\n\ | ||
@end example\n\ | ||
@end deftypefn") | ||
{ | ||
return ovl (0); | ||
} | ||
|
||
DEFUN_DLD (test_subfcn1, args, , | ||
"-*- texinfo -*-\n\ | ||
@deftypefn {} {} test_subfcn1 ()\n\ | ||
Testing\n\ | ||
\n\ | ||
@example\n\ | ||
a = 43\n\ | ||
@result{} a = 43\n\ | ||
@end example\n\ | ||
@end deftypefn") | ||
{ | ||
return ovl (0); | ||
} | ||
|
||
DEFUN_DLD (test_subfcn2, args, , | ||
"-*- texinfo -*-\n\ | ||
@deftypefn {} {} test_subfcn2 ()\n\ | ||
Testing\n\ | ||
\n\ | ||
@example\n\ | ||
a = 44\n\ | ||
@result{} a = 44\n\ | ||
a = a + 1\n\ | ||
@result{} a = 45\n\ | ||
@end example\n\ | ||
@end deftypefn") | ||
{ | ||
return ovl (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <octave/oct.h> | ||
|
||
DEFUN_DLD (test_octfile_single_fcn, args, , | ||
"-*- texinfo -*-\n\ | ||
@deftypefn {} {} test_octfile_single_fcn ()\n\ | ||
Testing\n\ | ||
\n\ | ||
@example\n\ | ||
b = 42\n\ | ||
@result{} b = 42\n\ | ||
b = b + 1\n\ | ||
@result{} b = 43\n\ | ||
@end example\n\ | ||
@end deftypefn") | ||
{ | ||
return ovl (0); | ||
} |