view test/inline-fcn.tst @ 33508:1d0365c531a1 default tip

workspace view column width only stored by header state (bug #65030) * gui-preferences-ws.h: remove obsolete settings keys * workspace-view.cc (workspace_view::workspace_view): initialize new class variable, do not restore header state here; (workspace_view::notice_settings): save current header state if it is not the first run where the header would be the default one, do not read column visibility from settings file, restore header state after other settings are updated; (workspace_view::header_contextmenu_requested): get column visibility from QTableView, not from settings; (workspace_view::toggle_header): toggle current visibility, which is determined from QTableView, not from settings; * workspace-view.h: new class variable m_first
author Torsten Lilge <ttl-octave@mailbox.org>
date Thu, 02 May 2024 06:44:38 +0200
parents cf60f8f636f6
children
line wrap: on
line source

## INLINE contstructor

%!shared fn
%! fn = inline ("x.^2 + 1");
%!assert (feval (fn, 6), 37)
%!assert (fn (6), 37)
%!assert (feval (inline ("sum (x(:))"), [1 2; 3 4]), 10)
%!assert (feval (inline ("sqrt (x^2 + y^2)", "x", "y"), 3, 4), 5)
%!assert (feval (inline ("exp (P1*x) + P2", 3), 3, 4, 5), exp (3*4) + 5)

## Test input validation
%!error inline ()
%!error <EXPR must be a string> inline (1)
%!error <N must be an integer> inline ("2", ones (2,2))
%!error <N must be a positive integer> inline ("2", -1)
%!error <additional arguments must be strings> inline ("2", "x", -1, "y")

## FORMULA

%!assert (formula (fn), "x.^2 + 1")
%!assert (formula (fn), char (fn))

## ARGNAMES

%!assert (argnames (fn), {"x"})
%!assert (argnames (inline ("1e-3*y + 2e4*z")), {"y"; "z"})
%!assert (argnames (inline ("2", 2)), {"x"; "P1"; "P2"})

## VECTORIZE

%!assert (formula (vectorize (fn)), "x.^2 + 1")
%!assert (formula (vectorize (inline ("1e-3*y + 2e4*z"))), "1e-3.*y + 2e4.*z")
%!assert (formula (vectorize (inline ("2^x^5"))), "2.^x.^5")