|
1 | | -% (C) Copyright 2020 CPP_PTB developpers |
| 1 | +% (C) Copyright 2020 CPP_PTB developers |
2 | 2 |
|
3 | 3 | function templateFunctionExample() |
4 | | - % This function illustrates a documentation test defined for MOdox. |
5 | | - % Other than that it does absolutely nothinghort description of what |
6 | | - % the function does goes here. |
7 | | - % |
8 | | - % Examples: |
9 | | - % a=2; |
10 | | - % disp(a) |
11 | | - % % Expected output is prefixed by '%||' as in the following line: |
12 | | - % %|| 2 |
13 | | - % % |
14 | | - % % The test continues because no interruption through whitespace, |
15 | | - % % as the previous line used a '%' comment character; |
16 | | - % % thus the 'a' variable is still in the namespace and can be |
17 | | - % % accessed. |
18 | | - % b=3+a; |
19 | | - % disp(a+[3 4]) |
20 | | - % %|| [5 6] |
21 | | - % |
22 | | - % % A new test starts here because the previous line was white-space |
23 | | - % % only. Thus the 'a' and 'b' variables are not present here anymore. |
24 | | - % % The following expression raises an error because the 'b' variable |
25 | | - % % is not defined (and does not carry over from the previous test). |
26 | | - % % Because the expected output indicates an error as well, |
27 | | - % % the test passes |
28 | | - % disp(b) |
29 | | - % %|| error('Some error') |
30 | | - % |
31 | | - % % A set of expressions is ignored if there is no expected output |
32 | | - % % (that is, no lines starting with '%||'). |
33 | | - % % Thus, the following expression is not part of any test, |
34 | | - % % and therefore does not raise an error. |
35 | | - % error('this is never executed) |
36 | | - % |
37 | | - % |
38 | | - % % tests end here because test indentation has ended |
| 4 | + % This function illustrates a documentation test defined for MOdox. |
| 5 | + % Other than that it does absolutely nothinghort description of what |
| 6 | + % the function does goes here. |
| 7 | + % |
| 8 | + % Examples: |
| 9 | + % a=2; |
| 10 | + % disp(a) |
| 11 | + % % Expected output is prefixed by '%||' as in the following line: |
| 12 | + % %|| 2 |
| 13 | + % % |
| 14 | + % % The test continues because no interruption through whitespace, |
| 15 | + % % as the previous line used a '%' comment character; |
| 16 | + % % thus the 'a' variable is still in the namespace and can be |
| 17 | + % % accessed. |
| 18 | + % b=3+a; |
| 19 | + % disp(a+[3 4]) |
| 20 | + % %|| [5 6] |
| 21 | + % |
| 22 | + % % A new test starts here because the previous line was white-space |
| 23 | + % % only. Thus the 'a' and 'b' variables are not present here anymore. |
| 24 | + % % The following expression raises an error because the 'b' variable |
| 25 | + % % is not defined (and does not carry over from the previous test). |
| 26 | + % % Because the expected output indicates an error as well, |
| 27 | + % % the test passes |
| 28 | + % disp(b) |
| 29 | + % %|| error('Some error') |
| 30 | + % |
| 31 | + % % A set of expressions is ignored if there is no expected output |
| 32 | + % % (that is, no lines starting with '%||'). |
| 33 | + % % Thus, the following expression is not part of any test, |
| 34 | + % % and therefore does not raise an error. |
| 35 | + % error('this is never executed) |
| 36 | + % |
| 37 | + % |
| 38 | + % % tests end here because test indentation has ended |
39 | 39 |
|
40 | | - % The code goes below |
| 40 | + % The code goes below |
41 | 41 |
|
42 | 42 | end |
0 commit comments