Mercurial > octave-nkf
annotate test/bug-31371.tst @ 20639:a260a6acb70f
fix test failures introduced by a22d8a2eb0e5
* scripts/ode/private/integrate_adaptive.m: fix stepping backwards, fix
invocation of OutputFcn, fix text of some error messages
* scripts/ode/private/integrate_const.m: remove use of option OutputSave
* scripts/ode/private/integrate_n_steps.m: remove use of option OutputSave
author | Carlo de Falco <carlo.defalco@polimi.it> |
---|---|
date | Sun, 11 Oct 2015 23:09:01 +0200 |
parents | 6fe6ac8bbfdb |
children |
rev | line source |
---|---|
14331
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 %!test |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 %! % Work around MATLAB bug where f(x)(y) is invalid syntax |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 %! % (This bug does not apply to Octave) |
14344
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
4 %! |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
5 %! C = @(fcn,x) fcn(x); |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
6 %! C2 = @(fcn,x,y) fcn(x,y); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
7 %! |
14331
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 %! % Church Booleans |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 %! T = @(t,f) t; |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 %! F = @(t,f) f; |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
11 %! |
14332
affda9a8f7d0
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
14331
diff
changeset
|
12 %! % Church Numerals |
14344
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
13 %! Zero = @(fcn,x) x; |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
14 %! One = @(fcn,x) fcn(x); |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
15 %! Two = @(fcn,x) fcn(fcn(x)); |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
16 %! Three = @(fcn,x) fcn(fcn(fcn(x))); |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
17 %! Four = @(fcn,x) fcn(fcn(fcn(fcn(x)))); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
18 %! |
14331
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 %! % Arithmetic Operations |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 %! Inc = @(a) @(f,x) f(a(f,x)); % Increment |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 %! Add = @(a,b) @(f,x) a(f,b(f,x)); |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 %! Mult = @(a,b) @(f,x) a(@(x) b(f,x),x); |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 %! Dec = @(a) @(f,x) C(a(@(g) @(h) h(g(f)), @(u) x), @(u) u); % Decrement |
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 %! Sub = @(a,b) b(Dec, a); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
25 %! |
14331
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 %! % Renderer - Convert church numeral to "real" number |
14344
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
27 %! Render = @(n) n(@(n) n+1,0); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
28 %! |
14331
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 %! % Predicates |
14344
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
30 %! Iszero = @(n) n(@(x) F, T); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
31 %! |
14331
9a276049f18b
maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 %! % Y combinator implements recursion |
14344
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
33 %! Ycomb = @(f) C(@(g) f(@(x) C(g(g), x)), ... |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
34 %! @(g) f(@(x) C(g(g), x))); |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
35 %! |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
36 %! Factorial = Ycomb(@(f) @(n) C(C2(Iszero(n), ... |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
37 %! @(d) One, @(d) Mult(n, f(Dec(n)))),0)); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
38 %! |
14344
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
39 %! assert (Render (Factorial (Two)), 2) |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
40 %! assert (Render (Factorial (Three)), 6) |
4687ecec0586
make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents:
14332
diff
changeset
|
41 %! assert (Render (Factorial (Four)), 24) |