Mercurial > octave
annotate test/bug-45969.tst @ 33608:5fba13104493 bytecode-interpreter tip
maint: merge default to bytecode-interpreter.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Sat, 18 May 2024 22:40:00 -0400 |
parents | 9080316864bf |
children |
rev | line source |
---|---|
30110
9080316864bf
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
30109
diff
changeset
|
1 %!test <*45969> |
26698
63b5a17ba30f
Use save_default_options() to make BIST test suite robust against user configurations.
Rik <rik@octave.org>
parents:
26683
diff
changeset
|
2 %! text_filename = tempname (); |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
3 %! binary_filename = tempname (); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
4 %! a = 2; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
5 %! b = 10; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
6 %! c = 20; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
7 %! f1 = @ (f, x) f (x) + a; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
8 %! f2 = @ (y) f1 (@ (z) z^2 + b * y, y) + c; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
9 %! f2_arg = 5; |
26683
b765393dabe6
bug-45969.tst: save/restore save_default_options when doing test.
Rik <rik@octave.org>
parents:
26473
diff
changeset
|
10 %! save_default_options ("-text", "local"); |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
11 %! unwind_protect |
26698
63b5a17ba30f
Use save_default_options() to make BIST test suite robust against user configurations.
Rik <rik@octave.org>
parents:
26683
diff
changeset
|
12 %! save (text_filename, "f2"); |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
13 %! save ("-binary", binary_filename, "f2"); |
26698
63b5a17ba30f
Use save_default_options() to make BIST test suite robust against user configurations.
Rik <rik@octave.org>
parents:
26683
diff
changeset
|
14 %! text = load (text_filename); |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
15 %! binary = load (binary_filename); |
26698
63b5a17ba30f
Use save_default_options() to make BIST test suite robust against user configurations.
Rik <rik@octave.org>
parents:
26683
diff
changeset
|
16 %! assert (f2 (f2_arg), text.f2 (f2_arg)); |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
17 %! assert (f2 (f2_arg), binary.f2 (f2_arg)); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
18 %! unwind_protect_cleanup |
26698
63b5a17ba30f
Use save_default_options() to make BIST test suite robust against user configurations.
Rik <rik@octave.org>
parents:
26683
diff
changeset
|
19 %! unlink (text_filename); |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
20 %! unlink (binary_filename); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
21 %! end_unwind_protect |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
22 |
30110
9080316864bf
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
30109
diff
changeset
|
23 %!testif HAVE_HDF5 <*45969> |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
24 %! hdf5_filename = tempname (); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
25 %! a = 2; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
26 %! b = 10; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
27 %! c = 20; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
28 %! f1 = @ (f, x) f (x) + a; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
29 %! f2 = @ (y) f1 (@ (z) z^2 + b * y, y) + c; |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
30 %! f2_arg = 5; |
26683
b765393dabe6
bug-45969.tst: save/restore save_default_options when doing test.
Rik <rik@octave.org>
parents:
26473
diff
changeset
|
31 %! save_default_options ("-text", "local"); |
25824
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
32 %! unwind_protect |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
33 %! save ("-hdf5", hdf5_filename, "f2"); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
34 %! hdf5 = load (hdf5_filename); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
35 %! assert (f2 (f2_arg), hdf5.f2 (f2_arg)); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
36 %! unwind_protect_cleanup |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
37 %! unlink (hdf5_filename); |
91e1ca0e3a9d
Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff
changeset
|
38 %! end_unwind_protect |