Mercurial > hg > octave-lyh
comparison test/test_parser.m @ 14131:c3309e1ec50d stable
test: Use Octave coding and spacing conventions for fixed test scripts
* build_bc_overload_tests.sh, build_bc_overloads_expected.m,
build_sparse_tests.sh, test_args.m, test_contin.m, test_diag_perm.m,
test_error.m, test_eval-catch.m, test_for.m, test_func.m, test_global.m,
test_if.m, test_index.m, test_io.m, test_logical_index.m, test_null_assign.m,
test_parser.m, test_prefer.m, test_range.m, test_recursion.m, test_return.m,
test_slice.m, test_struct.m, test_switch.m, test_system.m, test_transpose.m,
test_try.m, test_unwind.m, test_while.m:
Use Octave coding and spacing conventions for fixed test scripts.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 01 Jan 2012 20:04:52 -0800 |
parents | 1bfca2bbea8b |
children | 72c96de7a403 |
comparison
equal
deleted
inserted
replaced
14130:e13bfbc2c4c5 | 14131:c3309e1ec50d |
---|---|
14 ## | 14 ## |
15 ## You should have received a copy of the GNU General Public License | 15 ## You should have received a copy of the GNU General Public License |
16 ## along with Octave; see the file COPYING. If not, see | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | 17 ## <http://www.gnu.org/licenses/>. |
18 | 18 |
19 ## Tests for parser problems belong in this file. We need many more | 19 ## Tests for parser problems belong in this file. |
20 ## tests here! | 20 ## We need many more tests here! |
21 | 21 |
22 %!assert ({1 2 {3 4}}, {1,2,{3,4}}) | 22 %!assert ({1 2 {3 4}}, {1,2,{3,4}}) |
23 %!assert ({1, 2 {3 4}}, {1,2,{3,4}}) | 23 %!assert ({1, 2 {3 4}}, {1,2,{3,4}}) |
24 %!assert ({1 2, {3 4}}, {1,2,{3,4}}) | 24 %!assert ({1 2, {3 4}}, {1,2,{3,4}}) |
25 %!assert ({1 2 {3, 4}}, {1,2,{3,4}}) | 25 %!assert ({1 2 {3, 4}}, {1,2,{3,4}}) |
245 %!test | 245 %!test |
246 %! a = 2; b = 5; c = 7; | 246 %! a = 2; b = 5; c = 7; |
247 %! assert (a += b *= c += 1, 42) | 247 %! assert (a += b *= c += 1, 42) |
248 %! assert (b == 40 && c == 8) | 248 %! assert (b == 40 && c == 8) |
249 | 249 |
250 ## Test creation of anonymous functions | |
251 | |
250 %!test | 252 %!test |
251 %! af_in_cell = {@(x) [1 2]}; | 253 %! af_in_cell = {@(x) [1 2]}; |
252 %! assert (af_in_cell{1}(), [1, 2]); | 254 %! assert (af_in_cell{1}(), [1, 2]); |
253 | 255 |
254 %!test | 256 %!test |
255 %! R = @(rot) [cos(rot) -sin(rot); sin(rot) cos(rot)]; | 257 %! R = @(rot) [cos(rot) -sin(rot); sin(rot) cos(rot)]; |
256 %! assert (R(pi/2), [cos(pi/2), -sin(pi/2); sin(pi/2),cos(pi/2)]); | 258 %! assert (R(pi/2), [cos(pi/2), -sin(pi/2); sin(pi/2),cos(pi/2)]); |
259 |