* Bug #14049 fixed - genlib hangs if an unexpected endfunction occurs.
+* Bug #14057 fixed - grand(m,n) returned a wrong error and grand(m,n,p) called an overloading function instead of returning an error.
+
* Bug #14058 fixed - Scilab crashed with 'file("close", file())' instruction
* Bug #14095 fixed - Scilab crashed when a .fig file was loaded with loadmatfile function.
return types::Function::Error;
}
- // *** find the mothod string. ***
+ // *** find the method string. ***
for (int i = 0; i < in.size(); i++)
{
if (in[i]->isString())
{
pStrMethod = in[i]->getAs<types::String>();
iStrPos = i;
-
break;
}
}
- if ((iStrPos == 0) && (in[0]->isString() == false))
+ if (pStrMethod == NULL)
{
- ast::ExecVisitor exec;
- std::wstring wstFuncName = L"%" + in[0]->getShortTypeStr() + L"_grand";
- return Overload::call(wstFuncName, in, _iRetCount, out, &exec);
+ for (int i = 0; i < in.size(); i++)
+ {
+ if (in[i]->isDouble() == false)
+ {
+ ast::ExecVisitor exec;
+ std::wstring wstFuncName = L"%" + in[0]->getShortTypeStr() + L"_grand";
+ return Overload::call(wstFuncName, in, _iRetCount, out, &exec);
+ }
+ }
+
+ Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), "grand", in.size() + 1);
+ return types::Function::Error;
}
int iDims = iStrPos > 1 ? iStrPos : 2;
itab[0] = 1;
itab[1] = 1;
- if (pStrMethod == NULL)
- {
- Scierror(78, _("%s: Wrong number of output argument(s): At least %d string expected.\n"), "grand", 1);
- return types::Function::Error;
- }
-
wchar_t* wcsMeth = pStrMethod->get(0);
int iNumInputArg = 5;
if (wcscmp(wcsMeth, L"bet") == 0) // beta
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 14057 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=14057
+//
+// <-- Short Description -->
+// Calling grand(m,n) returned a wrong error and grand(m,n,p) called %s_grand
+// function instead of an error.
+// =============================================================================
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "grand", 3);
+assert_checkerror("grand(2,3)", refMsg);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "grand", 4);
+assert_checkerror("grand(4,3,2)", refMsg);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 14057 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=14057
+//
+// <-- Short Description -->
+// Calling grand(m,n) returned a wrong error and grand(m,n,p) called %s_grand
+// function instead of an error.
+// =============================================================================
+
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "grand", 3);
+assert_checkerror("grand(2,3)", refMsg);
+
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "grand", 4);
+assert_checkerror("grand(4,3,2)", refMsg);