Fix tests in integer module: sum, prod, cumsum and cumprod tests have be modified... 91/12591/2
Adeline CARNIS [Thu, 19 Sep 2013 07:59:20 +0000 (09:59 +0200)]
test_run('integer', 'bug_3842')

Change-Id: I0cbfe5941d16443f2a036ea20cd0fa3534c3b14c

scilab/modules/integer/tests/nonreg_tests/bug_3842.dia.ref

index 3c69e8e..61e5a2b 100644 (file)
@@ -20,6 +20,8 @@ exec SCI/modules/elementary_functions/tests/unit_tests/prod.tst
  
 // Copyright (C) 2010 - INRIA - Serge Steer
  
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
 //
  
 //  This file is distributed under the same license as the Scilab package.
@@ -31,6 +33,258 @@ exec SCI/modules/elementary_functions/tests/unit_tests/prod.tst
  
 // prod 
  
+// Check error
+d=[1 10;254 9];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// matrices of integer
+i = uint8(d);
+assert_checkfalse(execstr("prod(i, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(i, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(i, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("prod(i, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("prod(i,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong value for argument #%d.\n"), 3);
+assert_checkerror("prod(i,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("prod(i,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 3);
+assert_checkerror("prod(i,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("prod(i,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(i,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("prod(i,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong type for argument #%d: String expected.\n"), 3);
+assert_checkerror("prod(i,1,1)", refMsg);
+//==============================================================================
+// sparse matrices
+d = sparse(d);
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// boolean matrices
+d = [%f %t;%t %f];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"prod", 3, "native", "double");
+assert_checkerror("prod(d,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("prod(d,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("prod(d,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,1,1)", refMsg);
+//==============================================================================
+// sparse boolean matrices
+d = sparse(d);
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"prod", 3, "native", "double");
+assert_checkerror("prod(d,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("prod(d,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("prod(d,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,1,1)", refMsg);
+//==============================================================================
+// hypermatrices
+d = rand(2,2,2);
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// polynome
+s = poly(0, "s");
+d = [s s^2;s*%i 1];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// rational matrices
+s = poly(0, "s");
+d = [1/s 1/s^2; 1/s 1];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
 //empty matrices
  
 T=list(list(),list('native'),list('double'));
@@ -53,11 +307,11 @@ d=[1 10;254 9];
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  if prod(d,typ(:))<>22860 then pause,end
-  if prod(d,'*',typ(:))<>22860 then pause,end
-  if or(prod(d,1,typ(:))<>[254 90]) then pause,end
-  if or(prod(d,2,typ(:))<>[10;2286]) then pause,end
-  if or(prod(d,3,typ(:))<>d) then pause,end
+    assert_checkequal(prod(d, typ(:)), 22860);
+    assert_checkequal(prod(d, "*", typ(:)), 22860);
+    assert_checkequal(prod(d, 1, typ(:)), [254 90]);
+    assert_checkequal(prod(d, 2, typ(:)), [10;2286]);
+    assert_checkequal(prod(d, 3, typ(:)), d);
 end
  
  
@@ -69,12 +323,12 @@ d=[1 10;254 9];d(:,:,2)=1;
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  if prod(d,typ(:))<>22860 then pause,end
-  if prod(d,'*',typ(:))<>22860 then pause,end
-  if or(prod(d,1,typ(:))<>hypermat([1,2,2],[254;90;1;1])) then pause,end
-  if or(prod(d,2,typ(:))<>hypermat([2,1,2],[10;2286;1;1])) then pause,end
-  if or(prod(d,3,typ(:))<>[1,10;254,9]) then pause,end
-  if or(prod(d,5,typ(:))<>d) then pause,end
+    assert_checkequal(prod(d, typ(:)), 22860);
+    assert_checkequal(prod(d, "*", typ(:)), 22860);
+    assert_checkequal(prod(d, 1, typ(:)), hypermat([1,2,2],[254;90;1;1]));
+    assert_checkequal(prod(d, 2, typ(:)), hypermat([2,1,2],[10;2286;1;1]));
+    assert_checkequal(prod(d, 3, typ(:)), [1,10;254,9]);
+    assert_checkequal(prod(d, 5, typ(:)), d);
 end
  
  
@@ -87,51 +341,52 @@ i=uint8([1 10;254 9]);
 T=list(list(),list('native'));
  
 for typ=T
-  if prod(i,typ(:))<>uint8(76) then pause,end
-  if prod(i,'*',typ(:))<>uint8(76) then pause,end
-  if or(prod(i,1,typ(:))<>uint8([254 90])) then pause,end
-  if or(prod(i,2,typ(:))<>uint8([10;238])) then pause,end
-  if or(prod(i,3,typ(:))<>i) then pause,end
+    assert_checkequal(prod(i, typ(:)), uint8(76));
+    assert_checkequal(prod(i, "*", typ(:)), uint8(76));
+    assert_checkequal(prod(i, 1, typ(:)), uint8([254 90]));
+    assert_checkequal(prod(i, 2, typ(:)), uint8([10;238]));
+    assert_checkequal(prod(i, 3, typ(:)), double(i));
 end
  
  
-if prod(i,'double')<>22860 then pause,end
+assert_checkequal(prod(i, "double"), 22860);
  
-if prod(i,'*','double')<>22860 then pause,end
+assert_checkequal(prod(i, "*", "double"), 22860);
  
-if or(prod(i,1,'double')<>[254 90]) then pause,end
+assert_checkequal(prod(i, 1, "double"), [254 90]);
  
-if or(prod(i,2,'double')<>[10;2286]) then pause,end
+assert_checkequal(prod(i, 2, "double"), [10;2286]);
  
-if or(prod(i,3,'double')<>double(i)) then pause,end
+assert_checkequal(prod(i, 3, "double"), double(i));
  
  
 //with hypermatrices
  
 i=uint8([1 10;254 9]);i(:,:,2)=uint8(1);
  
-for typ=list(list(),list('native'));
-  if prod(i,typ(:))<>uint8(76) then pause,end
-  if prod(i,'*',typ(:))<>uint8(76) then pause,end
-  if or(prod(i,1,typ(:))<>hypermat([1,2,2],uint8([254;90;1;1]))) then pause,end
-  if or(prod(i,2,typ(:))<>hypermat([2,1,2],uint8([10;238;1;1]))) then pause,end
-  if or(prod(i,3,typ(:))<>([1,10;254,9])) then pause,end
-  if or(prod(i,5,typ(:))<>i) then pause,end
-end
+T = list(list(),list('native'));
  
+for typ=T
+    assert_checkequal(prod(i, typ(:)), uint8(76));
+    assert_checkequal(prod(i, "*", typ(:)), uint8(76));
+    assert_checkequal(prod(i, 1, typ(:)), hypermat([1,2,2],uint8([254;90;1;1])));
+    assert_checkequal(prod(i, 2, typ(:)), hypermat([2,1,2],uint8([10;238;1;1])));
+    assert_checkequal(prod(i, 3, typ(:)), uint8([1,10;254,9]));
+    assert_checkequal(prod(i, 5, typ(:)), double(i));
+end
  
-if prod(i,'double')<>22860 then pause,end
  
-if prod(i,'*','double')<>22860 then pause,end
+assert_checkequal(prod(i, "double"), 22860);
  
-if or(prod(i,1,'double')<>hypermat([1,2,2],[254;90;1;1])) then pause,end
+assert_checkequal(prod(i, "*", "double"), 22860);
  
-if or(prod(i,2,'double')<>hypermat([2,1,2],[10;2286;1;1])) then pause,end
+assert_checkequal(prod(i, 1, "double"), hypermat([1,2,2],[254;90;1;1]));
  
-if or(prod(i,3,'double')<>[1,10;254,9]) then pause,end
+assert_checkequal(prod(i, 2, "double"), hypermat([2,1,2],[10;2286;1;1]));
  
-if or(prod(i,5,'double')<>double(i)) then pause,end
+assert_checkequal(prod(i, 3, "double"), [1,10;254,9]);
  
+assert_checkequal(prod(i, 5, "double"), double(i));
  
  
 //Polynomials
@@ -141,11 +396,11 @@ s=%s;p=[s s+1;s^2 1];
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  if prod(p,typ(:))<>s^3+s^4 then pause,end
-  if prod(p,'*',typ(:))<>s^3+s^4 then pause,end
-  if or(prod(p,1,typ(:))<>[s^3,1+s]) then pause,end
-  if or(prod(p,2,typ(:))<>[s+s^2;s^2]) then pause,end
-  if or(prod(p,3,typ(:))<>p) then pause,end
+    assert_checkequal(prod(p, typ(:)), s^3+s^4);
+    assert_checkequal(prod(p, "*", typ(:)), s^3+s^4);
+    assert_checkequal(prod(p, 1, typ(:)), [s^3,1+s]);
+    assert_checkequal(prod(p, 2, typ(:)), [s+s^2;s^2]);
+    assert_checkequal(prod(p, 3, typ(:)), p);
 end
  
 //with hypermatrices
@@ -155,12 +410,12 @@ s=%s;p=[s s+1;s^2 1];p(:,:,2)=[1 s;s+1 2];
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  if prod(p,typ(:))<>2*s^4+4*s^5+2*s^6 then pause,end
-  if prod(p,'*',typ(:))<>2*s^4+4*s^5+2*s^6 then pause,end
-  if or(prod(p,1,typ(:))<>hypermat([1,2,2],[s^3;1+s;1+s;2*s])) then pause,end
-  if or(prod(p,2,typ(:))<>hypermat([2,1,2],[s+s^2;s^2;s;2+2*s])) then pause,end
-  if or(prod(p,3,typ(:))<>[s,s+s^2;s^2+s^3,2]) then pause,end
-  if or(prod(p,5,typ(:))<>p) then pause,end
+    assert_checkequal(prod(p, typ(:)), 2*s^4+4*s^5+2*s^6);
+    assert_checkequal(prod(p, "*", typ(:)), 2*s^4+4*s^5+2*s^6);
+    assert_checkequal(prod(p, 1, typ(:)), hypermat([1,2,2],[s^3;1+s;1+s;2*s]));
+    assert_checkequal(prod(p, 2, typ(:)), hypermat([2,1,2],[s+s^2;s^2;s;2+2*s]));
+    assert_checkequal(prod(p, 3, typ(:)), [s,s+s^2;s^2+s^3,2]);
+    assert_checkequal(prod(p, 5, typ(:)), p);
 end
  
  
@@ -173,11 +428,11 @@ s=%s;r=1.0 ./[s s+1;s^2 1];
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  if prod(r,typ(:))<>1.0/(s^3+s^4) then pause,end
-  if prod(r,'*',typ(:))<>1.0/(s^3+s^4) then pause,end
-  if or(prod(r,1,typ(:))<>[1,1]./[s^3,1+s]) then pause,end
-  if or(prod(r,2,typ(:))<>[1;1]./[s+s^2;s^2]) then pause,end
-  if or(prod(r,3,typ(:))<>r) then pause,end
+    assert_checkequal(prod(r, typ(:)), 1.0/(s^3+s^4));
+    assert_checkequal(prod(r, "*", typ(:)), 1.0/(s^3+s^4));
+    assert_checkequal(prod(r, 1, typ(:)), [1,1]./[s^3,1+s]);
+    assert_checkequal(prod(r, 2, typ(:)), [1;1]./[s+s^2;s^2]);
+    assert_checkequal(prod(r, 3, typ(:)), r);
 end
  
  
@@ -187,51 +442,56 @@ end
  
 b=[%t %t; %f %t];
  
-for typ=list(list(),list('double'));
-  if prod(b,typ(:))<>0 then pause,end
-  if prod(b,'*',typ(:))<>0 then pause,end
-  if or(prod(b,1,typ(:))<>[0 1]) then pause,end
-  if or(prod(b,2,typ(:))<>[1;0]) then pause,end
-  if or(prod(b,3,typ(:))<>double(b)) then pause,end
+T = list(list(),list('double'));
+for typ=T
+    assert_checkequal(prod(b, typ(:)), 0);
+    assert_checkequal(prod(b, "*", typ(:)), 0);
+    assert_checkequal(prod(b, 1, typ(:)), [0 1]);
+    assert_checkequal(prod(b, 2, typ(:)), [1;0]);
+    assert_checkequal(prod(b, 3, typ(:)), double(b));
 end
  
  
-if prod(b,'native')<>%f then pause,end
+assert_checkequal(prod(b, "native"), %f);
  
-if prod(b,'*','native')<>%f then pause,end
+assert_checkequal(prod(b, "*", "native"), %f);
  
-if or(prod(b,1,'native')<>[%f %t]) then pause,end
+assert_checkequal(prod(b, 1, "native"), [%f %t]);
  
-if or(prod(b,2,'native')<>[%t;%f]) then pause,end
+assert_checkequal(prod(b, 2, "native"), [%t;%f]);
  
-if or(prod(b,3,'native')<>b) then pause,end
+assert_checkequal(prod(b, 3, "native"), b);
  
-//with hypermatrices 
  
+//with hypermatrices   
  
 b=[%t %t;%f %t];b(1,1,2)=%t;
  
-for typ=list(list(),list('double'));
-  if prod(b,typ(:))<>0 then pause,end
-  if prod(b,'*',typ(:))<>0 then pause,end
-  if or(prod(b,1,typ(:))<>hypermat([1,2,2],[0;1;0;0])) then pause,end
-  if or(prod(b,2,typ(:))<>hypermat([2,1,2],[1;0;0;0])) then pause,end
-  if or(prod(b,3,typ(:))<>[1,0;0,0]) then pause,end
-  if or(prod(b,5,typ(:))<>double(b)) then pause,end
+T = list(list(),list('double'));
+for typ=T
+    assert_checkequal(prod(b, typ(:)), 0);
+    assert_checkequal(prod(b, "*", typ(:)), 0);
+    assert_checkequal(prod(b, 1, typ(:)), hypermat([1,2,2],[0;1;0;0]));
+    assert_checkequal(prod(b, 2, typ(:)), hypermat([2,1,2],[1;0;0;0]));
+    assert_checkequal(prod(b, 3, typ(:)), [1,0;0,0]);
+    assert_checkequal(prod(b, 5, typ(:)), double(b));
 end
  
  
-if prod(b,'native')<>%f then pause,end
+assert_checkequal(prod(b, "native"), %f);
+assert_checkequal(prod(b, "*", "native"), %f);
  
-if prod(b,'*','native')<>%f then pause,end
+assert_checkequal(prod(b, 1, "native"), hypermat([1,2,2],[%f;%t;%f;%f]));
  
-if or(prod(b,1,'native')<>hypermat([1,2,2],[%f;%t;%f;%f])) then pause,end
+assert_checkequal(prod(b, 2, "native"), hypermat([2,1,2],[%t;%f;%f;%f]));
  
-if or(prod(b,2,'native')<>hypermat([2,1,2],[%t;%f;%f;%f])) then pause,end
+assert_checkequal(prod(b, 3, "native"), [%t,%f;%f,%f]);
  
-if or(prod(b,3,'native')<>[%t,%f;%f,%f]) then pause,end
+assert_checkequal(prod(b, 5, "native"), b);
  
-if or(prod(b,5,'native')<>b) then pause,end
  
 //=======================================================================
  
@@ -242,11 +502,11 @@ s=sparse([1 10 2;-1 254 9]);
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  if prod(s,typ(:))<>-45720 then pause,end
-  if prod(s,'*',typ(:))<>-45720 then pause,end
-  if or(prod(s,1,typ(:))<>sparse([-1 2540 18])) then pause,end
-  if or(prod(s,2,typ(:))<>sparse([20;-2286])) then pause,end
-  if or(prod(s,3,typ(:))<>s) then pause,end
+    assert_checkequal(prod(s, typ(:)), -45720);
+    assert_checkequal(prod(s, "*", typ(:)), -45720);
+    assert_checkequal(prod(s, 1, typ(:)), sparse([-1 2540 18]));
+    assert_checkequal(prod(s, 2, typ(:)), sparse([20;-2286]));
+    assert_checkequal(prod(s, 3, typ(:)), s);
 end
  
  
@@ -256,24 +516,26 @@ end
  
 bs=sparse([%t %t %f;%t %t %t]);
  
-for typ=list(list(),list('double'));
-  if prod(bs,typ(:))<>0 then pause,end
-  if prod(bs,'*',typ(:))<>0 then pause,end
-  if or(prod(bs,1,typ(:))<>sparse([1,1,0])) then pause,end
-  if or(prod(bs,2,typ(:))<>sparse([0;1])) then pause,end
-  if or(prod(bs,3,typ(:))<>bool2s(bs)) then pause,end
+T = list(list(),list('double'));
+for typ=T
+    assert_checkequal(prod(bs, typ(:)), 0);
+    assert_checkequal(prod(bs, "*", typ(:)), 0);
+    assert_checkequal(prod(bs, 1, typ(:)), sparse([1,1,0]));
+    assert_checkequal(prod(bs, 2, typ(:)), sparse([0;1]));
+    assert_checkequal(prod(bs, 3, typ(:)), bool2s(bs));
 end
  
  
-if prod(bs,'native')<>%f then pause,end
+assert_checkequal(prod(bs, "native"), %f);
  
-if prod(bs,'*','native')<>%f then pause,end
+assert_checkequal(prod(bs, "*", "native"), %f);
  
-if or(prod(bs,1,'native')<>sparse([%t,%t,%f])) then pause,end
+assert_checkequal(prod(bs, 1, "native"), sparse([%t,%t,%f]));
  
-if or(prod(bs,2,'native')<>sparse([%f;%t])) then pause,end
+assert_checkequal(prod(bs, 2, "native"), sparse([%f;%t]));
  
-if or(prod(bs,3,'native')<>bs) then pause,end
+assert_checkequal(prod(bs, 3, "native"), bs);
  
  
 // TODO : test the "m" option
@@ -288,6 +550,8 @@ exec SCI/modules/elementary_functions/tests/unit_tests/cumprod.tst
  
 // Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
  
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
 //
  
 //  This file is distributed under the same license as the Scilab package.
@@ -297,19 +561,799 @@ exec SCI/modules/elementary_functions/tests/unit_tests/cumprod.tst
  
 // <-- CLI SHELL MODE 
  
+// Check error
  
-//cumprod
+//==============================================================================
  
-//Empty matrices
+//float matrices
  
-T=list(list(),list('native'),list('double'));
+d=[1 10;254 9];
  
-for typ=T
-  assert_checkequal(cumprod([],typ(:)), []);
-  assert_checkequal(cumprod([],'*',typ(:)), []);
-  assert_checkequal(cumprod([],1,typ(:)), []);
-  assert_checkequal(cumprod([],2,typ(:)), []);
-  assert_checkequal(cumprod([],3,typ(:)), []);
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// matrices of integer
+i = uint8(d);
+assert_checkfalse(execstr("cumprod(i, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("cumprod(i, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(i, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("cumprod(i, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("cumprod(i,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong value for argument #%d.\n"), 3);
+assert_checkerror("cumprod(i,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("cumprod(i,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 3);
+assert_checkerror("cumprod(i,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("cumprod(i,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("cumprod(i,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("cumprod(i,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong type for argument #%d: String expected.\n"), 3);
+assert_checkerror("cumprod(i,1,1)", refMsg);
+//==============================================================================
+// sparse matrices
+d = sparse(d);
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// boolean matrices
+d = [%f %t;%t %f];
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),"cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("cumprod(d,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"cumprod", 3, "native", "double");
+assert_checkerror("cumprod(d,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("cumprod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",3);
+assert_checkerror("cumprod(d,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("cumprod(d,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("cumprod(d,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"cumprod",3);
+assert_checkerror("cumprod(d,1,1)", refMsg);
+//==============================================================================
+// sparse boolean matrices
+d = sparse(d);
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("cumprod(d,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"cumprod", 3, "native", "double");
+assert_checkerror("cumprod(d,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("cumprod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",3);
+assert_checkerror("cumprod(d,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("cumprod(d,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("cumprod(d,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"cumprod",3);
+assert_checkerror("cumprod(d,1,1)", refMsg);
+//==============================================================================
+// hypermatrices
+d = rand(2,2,2);
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// polynome
+s = poly(0, "s");
+d = [s s^2;s*%i 1];
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// rational matrices
+s = poly(0, "s");
+d = [1/s 1/s^2; 1/s 1];
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+//cumprod
+//Empty matrices
+T=list(list(),list('native'),list('double'));
+for typ=T
+  assert_checkequal(cumprod([],typ(:)), []);
+  assert_checkequal(cumprod([],'*',typ(:)), []);
+  assert_checkequal(cumprod([],1,typ(:)), []);
+  assert_checkequal(cumprod([],2,typ(:)), []);
+  assert_checkequal(cumprod([],3,typ(:)), []);
+end
+//=======================================================================
+//float matrices
+d=[1 10;254 9];
+T=list(list(),list('native'),list('double'));
+for typ=T
+  assert_checkequal(cumprod(d,typ(:)), [1,2540;254,22860]);
+  assert_checkequal(cumprod(d,'*',typ(:)), [1,2540;254,22860]);
+  assert_checkequal(cumprod(d,1,typ(:)), [1,10;254,90]);
+  assert_checkequal(cumprod(d,2,typ(:)), [1,10;254,2286]);
+  assert_checkequal(cumprod(d,3,typ(:)), d);
+end
+//hypermatrices of floats
+d=[1 10;254 9];d(1,1,2)=1;
+T=list(list(),list('native'),list('double'));
+for typ=T
+  assert_checkequal(cumprod(d,typ(:)), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
+  assert_checkequal(cumprod(d,'*',typ(:)), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
+  assert_checkequal(cumprod(d,1,typ(:)), hypermat([2,2,2],[1;254;10;90;1;0;0;0]));
+  assert_checkequal(cumprod(d,2,typ(:)), hypermat([2,2,2],[1;254;10;2286;1;0;0;0]));
+  assert_checkequal(cumprod(d,3,typ(:)), hypermat([2,2,2],[1;254;10;9;1;0;0;0]));
+  assert_checkequal(cumprod(d,5,typ(:)), d);
+end
+//=======================================================================
+//Integers
+i=uint8([1 10;254 9]);
+for typ=list(list(),list('native'));
+  assert_checkequal(cumprod(i,typ(:)), uint8([1,236;254,76]));
+  assert_checkequal(cumprod(i,'*',typ(:)), uint8([1,236;254,76]));
+  assert_checkequal(cumprod(i,1,typ(:)), uint8([1,10;254,90]));
+  assert_checkequal(cumprod(i,2,typ(:)), uint8([1,10;254,238]));
+  assert_checkequal(cumprod(i,3,typ(:)), double(i));
+end
+assert_checkequal(cumprod(i,'double'), [1,2540;254,22860]);
+assert_checkequal(cumprod(i,'*','double'), [1,2540;254,22860]);
+assert_checkequal(cumprod(i,1,'double'), [1,10;254,90]);
+assert_checkequal(cumprod(i,2,'double'), [1,10;254,2286]);
+assert_checkequal(cumprod(i,3,'double'), double(i));
+//with hypermatrices
+i=uint8([1 10;254 9]);i(1,1,2)=uint8(1);
+for typ=list(list(),list('native'));
+  assert_checkequal(cumprod(i,typ(:)), hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0])));
+  assert_checkequal(cumprod(i,'*',typ(:)), hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0])));
+  assert_checkequal(cumprod(i,1,typ(:)), hypermat([2,2,2],uint8([1;254;10;90;1;0;0;0])));
+  assert_checkequal(cumprod(i,2,typ(:)), hypermat([2,2,2],uint8([1;254;10;238;1;0;0;0])));
+  assert_checkequal(cumprod(i,3,typ(:)), hypermat([2,2,2],uint8([1;254;10;9;1;0;0;0])));
+  assert_checkequal(cumprod(i,5,typ(:)), double(i));
+end
+assert_checkequal(cumprod(i,'double'), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
+assert_checkequal(cumprod(i,'*','double'), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
+assert_checkequal(cumprod(i,1,'double'), hypermat([2,2,2],[1;254;10;90;1;0;0;0]));
+assert_checkequal(cumprod(i,2,'double'), hypermat([2,2,2],[1;254;10;2286;1;0;0;0]));
+assert_checkequal(cumprod(i,3,'double'), hypermat([2,2,2],[1;254;10;9;1;0;0;0]));
+assert_checkequal(cumprod(i,5,'double'), double(i));
+//=======================================================================
+//Matrices of Polynomials
+s=%s;p=[s s+1;s^2 0];
+T=list(list(),list('native'),list('double'));
+for typ=T
+  assert_checkequal(cumprod(p,typ(:)), [s,s^3+s^4;s^3,0*s]);
+  assert_checkequal(cumprod(p,'*',typ(:)), [s,s^3+s^4;s^3,0*s]);
+  assert_checkequal(cumprod(p,1,typ(:)), [s,1+s;s^3,0*s]);
+  assert_checkequal(cumprod(p,2,typ(:)), [s,s+s^2;s^2,0*s]);
+  assert_checkequal(cumprod(p,3,typ(:)), p);
+end
+//with hypermatrices
+s=%s;p=[s s+1;s^2 0];p(1,1,2)=-1;
+T=list(list(),list('native'),list('double'));
+for typ=T
+  assert_checkequal(cumprod(p,typ(:)), hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s]));
+  assert_checkequal(cumprod(p,'*',typ(:)), hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s]));
+  assert_checkequal(cumprod(p,1,typ(:)), hypermat([2,2,2],[s;s^3;1+s;0*s;-1;0*s;0*s;0*s]));
+  assert_checkequal(cumprod(p,2,typ(:)), hypermat([2,2,2],[s;s^2;s+s^2;0*s;-1;0*s;0*s;0*s]));
+  assert_checkequal(cumprod(p,3,typ(:)), hypermat([2,2,2],[s;s^2;1+s;0*s;-s;0*s;0*s;0*s]));
+  assert_checkequal(cumprod(p,5,typ(:)), p);
+end
+//=======================================================================
+//Matrices of rationals
+s=%s;r=1.0 ./[s s+1;s^2 1];
+T=list(list(),list('native'),list('double'));
+for typ=T
+  assert_checkequal(cumprod(r,typ(:)), [1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]);
+  assert_checkequal(cumprod(r,'*',typ(:)), [1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]);
+  assert_checkequal(cumprod(r,1,typ(:)), [1,1;1,1]./[s,1+s;s^3,1+s]);
+  assert_checkequal(cumprod(r,2,typ(:)), [1,1;1,1]./[s,s+s^2;s^2,s^2]);
+  assert_checkequal(cumprod(r,3,typ(:)), r);
+end
+//=======================================================================
+///Matrices of boolean
+b=[%t %t;%f %t];
+for typ=list(list(),list('double'));
+  assert_checkequal(cumprod(b,typ(:)), [1,0;0,0]);
+  assert_checkequal(cumprod(b,'*',typ(:)), [1,0;0,0]);
+  assert_checkequal(cumprod(b,1,typ(:)), [1,1;0,1]);
+  assert_checkequal(cumprod(b,2,typ(:)), [1,1;0,0]);
+  assert_checkequal(cumprod(b,3,typ(:)), double(b));
+end
+assert_checkequal(cumprod(b,'native'), [%t,%f;%f,%f]);
+assert_checkequal(cumprod(b,'*','native'), [%t,%f;%f,%f]);
+assert_checkequal(cumprod(b,1,'native'), [%t,%t;%f,%t]);
+assert_checkequal(cumprod(b,2,'native'), [%t,%t;%f,%f]);
+assert_checkequal(cumprod(b,3,'native'), b);
+//with hypermatrices
+b=[%t %t;%f %t];b(1,1,2)=%f;
+for typ=list(list(),list('double'));
+  assert_checkequal(cumprod(b,typ(:)), hypermat([2,2,2],[1;0;0;0;0;0;0;0]));
+  assert_checkequal(cumprod(b,'*',typ(:)), hypermat([2,2,2],[1;0;0;0;0;0;0;0]));
+  assert_checkequal(cumprod(b,1,typ(:)), hypermat([2,2,2],[1;0;1;1;0;0;0;0]));
+  assert_checkequal(cumprod(b,2,typ(:)), hypermat([2,2,2],[1;0;1;0;0;0;0;0]));
+  assert_checkequal(cumprod(b,3,typ(:)), hypermat([2,2,2],[1;0;1;1;0;0;0;0]));
+  assert_checkequal(cumprod(b,5,typ(:)), double(b));
+end
+assert_checkequal(cumprod(b,'native'), hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f]));
+assert_checkequal(cumprod(b,'*','native'), hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f]));
+assert_checkequal(cumprod(b,1,'native'), hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f]));
+assert_checkequal(cumprod(b,2,'native'), hypermat([2,2,2],[%t;%f;%t;%f;%f;%f;%f;%f]));
+assert_checkequal(cumprod(b,3,'native'), hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f]));
+assert_checkequal(cumprod(b,5,'native'), b);
+//=======================================================================
+//sparse matrices of floats
+s=sparse([1 10 0;-1 0 9]);
+T=list(list(),list('native'),list('double'));
+for typ=T
+  assert_checkequal(cumprod(s,typ(:)), sparse([1,1;1,2;2,1],[1;-10;-1],[2,3]));
+  assert_checkequal(cumprod(s,'*',typ(:)), sparse([1,1;1,2;2,1],[1;-10;-1],[2,3]));
+  assert_checkequal(cumprod(s,1,typ(:)), sparse([1,1;1,2;2,1],[1;10;-1],[2,3]));
+  assert_checkequal(cumprod(s,2,typ(:)), sparse([1,1;1,2;2,1],[1;10;-1],[2,3]));
+  assert_checkequal(cumprod(s,3,typ(:)), s);
+end
+//=======================================================================
+//sparse  matrices of boolean
+bs=sparse([%t %t %f;%t %t %t]);
+for typ=list(list(),list('double'));
+  assert_checkequal(cumprod(bs,typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
+  assert_checkequal(cumprod(bs,'*',typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
+  assert_checkequal(cumprod(bs,1,typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
+  assert_checkequal(cumprod(bs,2,typ(:)), sparse([1,1;1,2;2,1;2,2;2,3],[1;1;1;1;1],[2,3]));
+  assert_checkequal(cumprod(bs,3,typ(:)), bool2s(bs));
+end
+assert_checkequal(cumprod(bs,'native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
+assert_checkequal(cumprod(bs,'*','native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
+assert_checkequal(cumprod(bs,1,'native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
+assert_checkequal(cumprod(bs,2,'native'), sparse([1,1;1,2;2,1;2,2;2,3],[%t;%t;%t;%t;%t],[2,3]));
+assert_checkequal(cumprod(bs,3,'native'), bs);
+// TODO : test the "m" option
+exec SCI/modules/elementary_functions/tests/unit_tests/prod.tst
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - INRIA - Serge Steer
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE 
+// prod 
+// Check error
+d=[1 10;254 9];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// matrices of integer
+i = uint8(d);
+assert_checkfalse(execstr("prod(i, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(i, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(i, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("prod(i, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("prod(i,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong value for argument #%d.\n"), 3);
+assert_checkerror("prod(i,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("prod(i,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 3);
+assert_checkerror("prod(i,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("prod(i,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(i,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("prod(i,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong type for argument #%d: String expected.\n"), 3);
+assert_checkerror("prod(i,1,1)", refMsg);
+//==============================================================================
+// sparse matrices
+d = sparse(d);
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// boolean matrices
+d = [%f %t;%t %f];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"prod", 3, "native", "double");
+assert_checkerror("prod(d,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("prod(d,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("prod(d,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,1,1)", refMsg);
+//==============================================================================
+// sparse boolean matrices
+d = sparse(d);
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", ""nat"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"prod", 3, "native", "double");
+assert_checkerror("prod(d,""r"", ""nat"")", refMsg);
+assert_checkfalse(execstr("prod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,""r"", [""nat"" ""dble""])", refMsg);
+assert_checkfalse(execstr("prod(d,""orient"", ""t"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d,""orient"", ""t"")", refMsg);
+assert_checkfalse(execstr("prod(d,1,1)"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"prod",3);
+assert_checkerror("prod(d,1,1)", refMsg);
+//==============================================================================
+// hypermatrices
+d = rand(2,2,2);
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// polynome
+s = poly(0, "s");
+d = [s s^2;s*%i 1];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// rational matrices
+s = poly(0, "s");
+d = [1/s 1/s^2; 1/s 1];
+assert_checkfalse(execstr("prod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+"prod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("prod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("prod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"prod",2);
+assert_checkerror("prod(d, [""r"", ""c""])", refMsg);
+//empty matrices
+T=list(list(),list('native'),list('double'));
+for typ=T
+  if prod([],typ(:))<>1 then pause,end
+  if prod([],'*',typ(:))<>1 then pause,end
+  if prod([],1,typ(:))<>[] then pause,end
+  if prod([],2,typ(:))<>[] then pause,end
+  if prod([],3,typ(:))<>[] then pause,end
 end
  
  
@@ -322,116 +1366,118 @@ d=[1 10;254 9];
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  assert_checkequal(cumprod(d,typ(:)), [1,2540;254,22860]);
-  assert_checkequal(cumprod(d,'*',typ(:)), [1,2540;254,22860]);
-  assert_checkequal(cumprod(d,1,typ(:)), [1,10;254,90]);
-  assert_checkequal(cumprod(d,2,typ(:)), [1,10;254,2286]);
-  assert_checkequal(cumprod(d,3,typ(:)), d);
+    assert_checkequal(prod(d, typ(:)), 22860);
+    assert_checkequal(prod(d, "*", typ(:)), 22860);
+    assert_checkequal(prod(d, 1, typ(:)), [254 90]);
+    assert_checkequal(prod(d, 2, typ(:)), [10;2286]);
+    assert_checkequal(prod(d, 3, typ(:)), d);
 end
  
  
 //hypermatrices of floats
  
-d=[1 10;254 9];d(1,1,2)=1;
+d=[1 10;254 9];d(:,:,2)=1;
  
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  assert_checkequal(cumprod(d,typ(:)), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
-  assert_checkequal(cumprod(d,'*',typ(:)), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
-  assert_checkequal(cumprod(d,1,typ(:)), hypermat([2,2,2],[1;254;10;90;1;0;0;0]));
-  assert_checkequal(cumprod(d,2,typ(:)), hypermat([2,2,2],[1;254;10;2286;1;0;0;0]));
-  assert_checkequal(cumprod(d,3,typ(:)), hypermat([2,2,2],[1;254;10;9;1;0;0;0]));
-  assert_checkequal(cumprod(d,5,typ(:)), d);
+    assert_checkequal(prod(d, typ(:)), 22860);
+    assert_checkequal(prod(d, "*", typ(:)), 22860);
+    assert_checkequal(prod(d, 1, typ(:)), hypermat([1,2,2],[254;90;1;1]));
+    assert_checkequal(prod(d, 2, typ(:)), hypermat([2,1,2],[10;2286;1;1]));
+    assert_checkequal(prod(d, 3, typ(:)), [1,10;254,9]);
+    assert_checkequal(prod(d, 5, typ(:)), d);
 end
  
  
 //=======================================================================
  
-//Integers
+//matrices of short integers
  
 i=uint8([1 10;254 9]);
  
-for typ=list(list(),list('native'));
-  assert_checkequal(cumprod(i,typ(:)), uint8([1,236;254,76]));
-  assert_checkequal(cumprod(i,'*',typ(:)), uint8([1,236;254,76]));
-  assert_checkequal(cumprod(i,1,typ(:)), uint8([1,10;254,90]));
-  assert_checkequal(cumprod(i,2,typ(:)), uint8([1,10;254,238]));
-  assert_checkequal(cumprod(i,3,typ(:)), double(i));
+T=list(list(),list('native'));
+for typ=T
+    assert_checkequal(prod(i, typ(:)), uint8(76));
+    assert_checkequal(prod(i, "*", typ(:)), uint8(76));
+    assert_checkequal(prod(i, 1, typ(:)), uint8([254 90]));
+    assert_checkequal(prod(i, 2, typ(:)), uint8([10;238]));
+    assert_checkequal(prod(i, 3, typ(:)), double(i));
 end
  
  
-assert_checkequal(cumprod(i,'double'), [1,2540;254,22860]);
+assert_checkequal(prod(i, "double"), 22860);
  
-assert_checkequal(cumprod(i,'*','double'), [1,2540;254,22860]);
+assert_checkequal(prod(i, "*", "double"), 22860);
  
-assert_checkequal(cumprod(i,1,'double'), [1,10;254,90]);
+assert_checkequal(prod(i, 1, "double"), [254 90]);
  
-assert_checkequal(cumprod(i,2,'double'), [1,10;254,2286]);
+assert_checkequal(prod(i, 2, "double"), [10;2286]);
  
-assert_checkequal(cumprod(i,3,'double'), double(i));
+assert_checkequal(prod(i, 3, "double"), double(i));
  
  
 //with hypermatrices
  
-i=uint8([1 10;254 9]);i(1,1,2)=uint8(1);
-for typ=list(list(),list('native'));
-  assert_checkequal(cumprod(i,typ(:)), hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0])));
-  assert_checkequal(cumprod(i,'*',typ(:)), hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0])));
-  assert_checkequal(cumprod(i,1,typ(:)), hypermat([2,2,2],uint8([1;254;10;90;1;0;0;0])));
-  assert_checkequal(cumprod(i,2,typ(:)), hypermat([2,2,2],uint8([1;254;10;238;1;0;0;0])));
-  assert_checkequal(cumprod(i,3,typ(:)), hypermat([2,2,2],uint8([1;254;10;9;1;0;0;0])));
-  assert_checkequal(cumprod(i,5,typ(:)), double(i));
-end
+i=uint8([1 10;254 9]);i(:,:,2)=uint8(1);
  
+T = list(list(),list('native'));
  
+for typ=T
+    assert_checkequal(prod(i, typ(:)), uint8(76));
+    assert_checkequal(prod(i, "*", typ(:)), uint8(76));
+    assert_checkequal(prod(i, 1, typ(:)), hypermat([1,2,2],uint8([254;90;1;1])));
+    assert_checkequal(prod(i, 2, typ(:)), hypermat([2,1,2],uint8([10;238;1;1])));
+    assert_checkequal(prod(i, 3, typ(:)), uint8([1,10;254,9]));
+    assert_checkequal(prod(i, 5, typ(:)), double(i));
+end
  
-assert_checkequal(cumprod(i,'double'), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
  
-assert_checkequal(cumprod(i,'*','double'), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
+assert_checkequal(prod(i, "double"), 22860);
  
-assert_checkequal(cumprod(i,1,'double'), hypermat([2,2,2],[1;254;10;90;1;0;0;0]));
+assert_checkequal(prod(i, "*", "double"), 22860);
  
-assert_checkequal(cumprod(i,2,'double'), hypermat([2,2,2],[1;254;10;2286;1;0;0;0]));
+assert_checkequal(prod(i, 1, "double"), hypermat([1,2,2],[254;90;1;1]));
  
-assert_checkequal(cumprod(i,3,'double'), hypermat([2,2,2],[1;254;10;9;1;0;0;0]));
+assert_checkequal(prod(i, 2, "double"), hypermat([2,1,2],[10;2286;1;1]));
  
-assert_checkequal(cumprod(i,5,'double'), double(i));
+assert_checkequal(prod(i, 3, "double"), [1,10;254,9]);
  
+assert_checkequal(prod(i, 5, "double"), double(i));
  
-//=======================================================================
  
-//Matrices of Polynomials
+//Polynomials
  
-s=%s;p=[s s+1;s^2 0];
+s=%s;p=[s s+1;s^2 1];
  
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  assert_checkequal(cumprod(p,typ(:)), [s,s^3+s^4;s^3,0*s]);
-  assert_checkequal(cumprod(p,'*',typ(:)), [s,s^3+s^4;s^3,0*s]);
-  assert_checkequal(cumprod(p,1,typ(:)), [s,1+s;s^3,0*s]);
-  assert_checkequal(cumprod(p,2,typ(:)), [s,s+s^2;s^2,0*s]);
-  assert_checkequal(cumprod(p,3,typ(:)), p);
+    assert_checkequal(prod(p, typ(:)), s^3+s^4);
+    assert_checkequal(prod(p, "*", typ(:)), s^3+s^4);
+    assert_checkequal(prod(p, 1, typ(:)), [s^3,1+s]);
+    assert_checkequal(prod(p, 2, typ(:)), [s+s^2;s^2]);
+    assert_checkequal(prod(p, 3, typ(:)), p);
 end
  
 //with hypermatrices
  
-s=%s;p=[s s+1;s^2 0];p(1,1,2)=-1;
+s=%s;p=[s s+1;s^2 1];p(:,:,2)=[1 s;s+1 2];
  
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  assert_checkequal(cumprod(p,typ(:)), hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s]));
-  assert_checkequal(cumprod(p,'*',typ(:)), hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s]));
-  assert_checkequal(cumprod(p,1,typ(:)), hypermat([2,2,2],[s;s^3;1+s;0*s;-1;0*s;0*s;0*s]));
-  assert_checkequal(cumprod(p,2,typ(:)), hypermat([2,2,2],[s;s^2;s+s^2;0*s;-1;0*s;0*s;0*s]));
-  assert_checkequal(cumprod(p,3,typ(:)), hypermat([2,2,2],[s;s^2;1+s;0*s;-s;0*s;0*s;0*s]));
-  assert_checkequal(cumprod(p,5,typ(:)), p);
+    assert_checkequal(prod(p, typ(:)), 2*s^4+4*s^5+2*s^6);
+    assert_checkequal(prod(p, "*", typ(:)), 2*s^4+4*s^5+2*s^6);
+    assert_checkequal(prod(p, 1, typ(:)), hypermat([1,2,2],[s^3;1+s;1+s;2*s]));
+    assert_checkequal(prod(p, 2, typ(:)), hypermat([2,1,2],[s+s^2;s^2;s;2+2*s]));
+    assert_checkequal(prod(p, 3, typ(:)), [s,s+s^2;s^2+s^3,2]);
+    assert_checkequal(prod(p, 5, typ(:)), p);
 end
  
 //=======================================================================
  
 //Matrices of rationals
@@ -441,81 +1487,85 @@ s=%s;r=1.0 ./[s s+1;s^2 1];
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  assert_checkequal(cumprod(r,typ(:)), [1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]);
-  assert_checkequal(cumprod(r,'*',typ(:)), [1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]);
-  assert_checkequal(cumprod(r,1,typ(:)), [1,1;1,1]./[s,1+s;s^3,1+s]);
-  assert_checkequal(cumprod(r,2,typ(:)), [1,1;1,1]./[s,s+s^2;s^2,s^2]);
-  assert_checkequal(cumprod(r,3,typ(:)), r);
+    assert_checkequal(prod(r, typ(:)), 1.0/(s^3+s^4));
+    assert_checkequal(prod(r, "*", typ(:)), 1.0/(s^3+s^4));
+    assert_checkequal(prod(r, 1, typ(:)), [1,1]./[s^3,1+s]);
+    assert_checkequal(prod(r, 2, typ(:)), [1;1]./[s+s^2;s^2]);
+    assert_checkequal(prod(r, 3, typ(:)), r);
 end
  
  
 //=======================================================================
  
-///Matrices of boolean
+//Matrices of booleans
  
+b=[%t %t; %f %t];
  
-b=[%t %t;%f %t];
+T = list(list(),list('double'));
  
-for typ=list(list(),list('double'));
-  assert_checkequal(cumprod(b,typ(:)), [1,0;0,0]);
-  assert_checkequal(cumprod(b,'*',typ(:)), [1,0;0,0]);
-  assert_checkequal(cumprod(b,1,typ(:)), [1,1;0,1]);
-  assert_checkequal(cumprod(b,2,typ(:)), [1,1;0,0]);
-  assert_checkequal(cumprod(b,3,typ(:)), double(b));
+for typ=T
+    assert_checkequal(prod(b, typ(:)), 0);
+    assert_checkequal(prod(b, "*", typ(:)), 0);
+    assert_checkequal(prod(b, 1, typ(:)), [0 1]);
+    assert_checkequal(prod(b, 2, typ(:)), [1;0]);
+    assert_checkequal(prod(b, 3, typ(:)), double(b));
 end
  
-assert_checkequal(cumprod(b,'native'), [%t,%f;%f,%f]);
  
-assert_checkequal(cumprod(b,'*','native'), [%t,%f;%f,%f]);
+assert_checkequal(prod(b, "native"), %f);
  
-assert_checkequal(cumprod(b,1,'native'), [%t,%t;%f,%t]);
+assert_checkequal(prod(b, "*", "native"), %f);
  
-assert_checkequal(cumprod(b,2,'native'), [%t,%t;%f,%f]);
+assert_checkequal(prod(b, 1, "native"), [%f %t]);
  
-assert_checkequal(cumprod(b,3,'native'), b);
+assert_checkequal(prod(b, 2, "native"), [%t;%f]);
  
+assert_checkequal(prod(b, 3, "native"), b);
  
-//with hypermatrices
  
-b=[%t %t;%f %t];b(1,1,2)=%f;
+//with hypermatrices   
  
-for typ=list(list(),list('double'));
-  assert_checkequal(cumprod(b,typ(:)), hypermat([2,2,2],[1;0;0;0;0;0;0;0]));
-  assert_checkequal(cumprod(b,'*',typ(:)), hypermat([2,2,2],[1;0;0;0;0;0;0;0]));
-  assert_checkequal(cumprod(b,1,typ(:)), hypermat([2,2,2],[1;0;1;1;0;0;0;0]));
-  assert_checkequal(cumprod(b,2,typ(:)), hypermat([2,2,2],[1;0;1;0;0;0;0;0]));
-  assert_checkequal(cumprod(b,3,typ(:)), hypermat([2,2,2],[1;0;1;1;0;0;0;0]));
-  assert_checkequal(cumprod(b,5,typ(:)), double(b));
+b=[%t %t;%f %t];b(1,1,2)=%t;
+T = list(list(),list('double'));
+for typ=T
+    assert_checkequal(prod(b, typ(:)), 0);
+    assert_checkequal(prod(b, "*", typ(:)), 0);
+    assert_checkequal(prod(b, 1, typ(:)), hypermat([1,2,2],[0;1;0;0]));
+    assert_checkequal(prod(b, 2, typ(:)), hypermat([2,1,2],[1;0;0;0]));
+    assert_checkequal(prod(b, 3, typ(:)), [1,0;0,0]);
+    assert_checkequal(prod(b, 5, typ(:)), double(b));
 end
  
  
-assert_checkequal(cumprod(b,'native'), hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f]));
+assert_checkequal(prod(b, "native"), %f);
  
-assert_checkequal(cumprod(b,'*','native'), hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f]));
+assert_checkequal(prod(b, "*", "native"), %f);
  
-assert_checkequal(cumprod(b,1,'native'), hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f]));
+assert_checkequal(prod(b, 1, "native"), hypermat([1,2,2],[%f;%t;%f;%f]));
  
-assert_checkequal(cumprod(b,2,'native'), hypermat([2,2,2],[%t;%f;%t;%f;%f;%f;%f;%f]));
+assert_checkequal(prod(b, 2, "native"), hypermat([2,1,2],[%t;%f;%f;%f]));
  
-assert_checkequal(cumprod(b,3,'native'), hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f]));
+assert_checkequal(prod(b, 3, "native"), [%t,%f;%f,%f]);
  
-assert_checkequal(cumprod(b,5,'native'), b);
+assert_checkequal(prod(b, 5, "native"), b);
  
  
 //=======================================================================
  
 //sparse matrices of floats
  
-s=sparse([1 10 0;-1 0 9]);
+s=sparse([1 10 2;-1 254 9]);
  
 T=list(list(),list('native'),list('double'));
  
 for typ=T
-  assert_checkequal(cumprod(s,typ(:)), sparse([1,1;1,2;2,1],[1;-10;-1],[2,3]));
-  assert_checkequal(cumprod(s,'*',typ(:)), sparse([1,1;1,2;2,1],[1;-10;-1],[2,3]));
-  assert_checkequal(cumprod(s,1,typ(:)), sparse([1,1;1,2;2,1],[1;10;-1],[2,3]));
-  assert_checkequal(cumprod(s,2,typ(:)), sparse([1,1;1,2;2,1],[1;10;-1],[2,3]));
-  assert_checkequal(cumprod(s,3,typ(:)), s);
+    assert_checkequal(prod(s, typ(:)), -45720);
+    assert_checkequal(prod(s, "*", typ(:)), -45720);
+    assert_checkequal(prod(s, 1, typ(:)), sparse([-1 2540 18]));
+    assert_checkequal(prod(s, 2, typ(:)), sparse([20;-2286]));
+    assert_checkequal(prod(s, 3, typ(:)), s);
 end
  
  
@@ -525,30 +1575,31 @@ end
  
 bs=sparse([%t %t %f;%t %t %t]);
  
-for typ=list(list(),list('double'));
-  assert_checkequal(cumprod(bs,typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
-  assert_checkequal(cumprod(bs,'*',typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
-  assert_checkequal(cumprod(bs,1,typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
-  assert_checkequal(cumprod(bs,2,typ(:)), sparse([1,1;1,2;2,1;2,2;2,3],[1;1;1;1;1],[2,3]));
-  assert_checkequal(cumprod(bs,3,typ(:)), bool2s(bs));
-end
+T = list(list(),list('double'));
  
+for typ=T
+    assert_checkequal(prod(bs, typ(:)), 0);
+    assert_checkequal(prod(bs, "*", typ(:)), 0);
+    assert_checkequal(prod(bs, 1, typ(:)), sparse([1,1,0]));
+    assert_checkequal(prod(bs, 2, typ(:)), sparse([0;1]));
+    assert_checkequal(prod(bs, 3, typ(:)), bool2s(bs));
+end
  
-assert_checkequal(cumprod(bs,'native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
  
-assert_checkequal(cumprod(bs,'*','native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
+assert_checkequal(prod(bs, "native"), %f);
  
+assert_checkequal(prod(bs, "*", "native"), %f);
  
-assert_checkequal(cumprod(bs,1,'native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
+assert_checkequal(prod(bs, 1, "native"), sparse([%t,%t,%f]));
  
-assert_checkequal(cumprod(bs,2,'native'), sparse([1,1;1,2;2,1;2,2;2,3],[%t;%t;%t;%t;%t],[2,3]));
+assert_checkequal(prod(bs, 2, "native"), sparse([%f;%t]));
  
-assert_checkequal(cumprod(bs,3,'native'), bs);
+assert_checkequal(prod(bs, 3, "native"), bs);
  
  
 // TODO : test the "m" option
  
-exec SCI/modules/elementary_functions/tests/unit_tests/prod.tst
+exec SCI/modules/elementary_functions/tests/unit_tests/cumprod.tst
  
 // =============================================================================
  
@@ -556,6 +1607,10 @@ exec SCI/modules/elementary_functions/tests/unit_tests/prod.tst
  
 // Copyright (C) 2010 - INRIA - Serge Steer
  
+// Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
 //
  
 //  This file is distributed under the same license as the Scilab package.
@@ -565,273 +1620,263 @@ exec SCI/modules/elementary_functions/tests/unit_tests/prod.tst
  
 // <-- CLI SHELL MODE 
  
-// prod 
+// Check error
  
-//empty matrices
+//==============================================================================
  
-T=list(list(),list('native'),list('double'));
+//float matrices
  
-for typ=T
-  if prod([],typ(:))<>1 then pause,end
-  if prod([],'*',typ(:))<>1 then pause,end
-  if prod([],1,typ(:))<>[] then pause,end
-  if prod([],2,typ(:))<>[] then pause,end
-  if prod([],3,typ(:))<>[] then pause,end
-end
+d=[1 10;254 9];
  
  
-//=======================================================================
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
  
-//float matrices
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
  
-d=[1 10;254 9];
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
  
-T=list(list(),list('native'),list('double'));
  
-for typ=T
-  if prod(d,typ(:))<>22860 then pause,end
-  if prod(d,'*',typ(:))<>22860 then pause,end
-  if or(prod(d,1,typ(:))<>[254 90]) then pause,end
-  if or(prod(d,2,typ(:))<>[10;2286]) then pause,end
-  if or(prod(d,3,typ(:))<>d) then pause,end
-end
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
  
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
  
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
  
-//hypermatrices of floats
  
-d=[1 10;254 9];d(:,:,2)=1;
+//==============================================================================
  
-T=list(list(),list('native'),list('double'));
+// matrices of integer
  
-for typ=T
-  if prod(d,typ(:))<>22860 then pause,end
-  if prod(d,'*',typ(:))<>22860 then pause,end
-  if or(prod(d,1,typ(:))<>hypermat([1,2,2],[254;90;1;1])) then pause,end
-  if or(prod(d,2,typ(:))<>hypermat([2,1,2],[10;2286;1;1])) then pause,end
-  if or(prod(d,3,typ(:))<>[1,10;254,9]) then pause,end
-  if or(prod(d,5,typ(:))<>d) then pause,end
-end
+i = uint8(d);
  
  
-//=======================================================================
+assert_checkfalse(execstr("cumprod(i, ""orient"")"   ,"errcatch") == 0);
  
-//matrices of short integers
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
  
-i=uint8([1 10;254 9]);
+assert_checkerror("cumprod(i, ""orient"")", refMsg);
  
-T=list(list(),list('native'));
  
-for typ=T
-  if prod(i,typ(:))<>uint8(76) then pause,end
-  if prod(i,'*',typ(:))<>uint8(76) then pause,end
-  if or(prod(i,1,typ(:))<>uint8([254 90])) then pause,end
-  if or(prod(i,2,typ(:))<>uint8([10;238])) then pause,end
-  if or(prod(i,3,typ(:))<>i) then pause,end
-end
+assert_checkfalse(execstr("cumprod(i, [""r"", ""c""])"   ,"errcatch") == 0);
  
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 2);
  
-if prod(i,'double')<>22860 then pause,end
+assert_checkerror("cumprod(i, [""r"", ""c""])", refMsg);
  
-if prod(i,'*','double')<>22860 then pause,end
  
-if or(prod(i,1,'double')<>[254 90]) then pause,end
+assert_checkfalse(execstr("cumprod(i,""r"", ""nat"")"   ,"errcatch") == 0);
  
-if or(prod(i,2,'double')<>[10;2286]) then pause,end
+refMsg = msprintf(_("Wrong value for argument #%d.\n"), 3);
  
-if or(prod(i,3,'double')<>double(i)) then pause,end
+assert_checkerror("cumprod(i,""r"", ""nat"")", refMsg);
  
  
-//with hypermatrices
+assert_checkfalse(execstr("cumprod(i,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
  
-i=uint8([1 10;254 9]);i(:,:,2)=uint8(1);
+refMsg = msprintf(_("Wrong size for argument #%d.\n"), 3);
  
-for typ=list(list(),list('native'));
-  if prod(i,typ(:))<>uint8(76) then pause,end
-  if prod(i,'*',typ(:))<>uint8(76) then pause,end
-  if or(prod(i,1,typ(:))<>hypermat([1,2,2],uint8([254;90;1;1]))) then pause,end
-  if or(prod(i,2,typ(:))<>hypermat([2,1,2],uint8([10;238;1;1]))) then pause,end
-  if or(prod(i,3,typ(:))<>([1,10;254,9])) then pause,end
-  if or(prod(i,5,typ(:))<>i) then pause,end
-end
+assert_checkerror("cumprod(i,""r"", [""nat"" ""dble""])", refMsg);
  
  
-if prod(i,'double')<>22860 then pause,end
+assert_checkfalse(execstr("cumprod(i,""orient"", ""t"")"   ,"errcatch") == 0);
  
-if prod(i,'*','double')<>22860 then pause,end
+refMsg = msprintf(_("Wrong argument #%d.\n"), 2);
  
-if or(prod(i,1,'double')<>hypermat([1,2,2],[254;90;1;1])) then pause,end
+assert_checkerror("cumprod(i,""orient"", ""t"")", refMsg);
  
-if or(prod(i,2,'double')<>hypermat([2,1,2],[10;2286;1;1])) then pause,end
  
-if or(prod(i,3,'double')<>[1,10;254,9]) then pause,end
+assert_checkfalse(execstr("cumprod(i,1,1)"   ,"errcatch") == 0);
  
-if or(prod(i,5,'double')<>double(i)) then pause,end
+refMsg = msprintf(_("Wrong type for argument #%d: String expected.\n"), 3);
  
+assert_checkerror("cumprod(i,1,1)", refMsg);
  
  
-//Polynomials
+//==============================================================================
  
-s=%s;p=[s s+1;s^2 1];
+// sparse matrices
  
-T=list(list(),list('native'),list('double'));
+d = sparse(d);
  
-for typ=T
-  if prod(p,typ(:))<>s^3+s^4 then pause,end
-  if prod(p,'*',typ(:))<>s^3+s^4 then pause,end
-  if or(prod(p,1,typ(:))<>[s^3,1+s]) then pause,end
-  if or(prod(p,2,typ(:))<>[s+s^2;s^2]) then pause,end
-  if or(prod(p,3,typ(:))<>p) then pause,end
-end
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
  
-//with hypermatrices
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
  
-s=%s;p=[s s+1;s^2 1];p(:,:,2)=[1 s;s+1 2];
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
  
-T=list(list(),list('native'),list('double'));
  
-for typ=T
-  if prod(p,typ(:))<>2*s^4+4*s^5+2*s^6 then pause,end
-  if prod(p,'*',typ(:))<>2*s^4+4*s^5+2*s^6 then pause,end
-  if or(prod(p,1,typ(:))<>hypermat([1,2,2],[s^3;1+s;1+s;2*s])) then pause,end
-  if or(prod(p,2,typ(:))<>hypermat([2,1,2],[s+s^2;s^2;s;2+2*s])) then pause,end
-  if or(prod(p,3,typ(:))<>[s,s+s^2;s^2+s^3,2]) then pause,end
-  if or(prod(p,5,typ(:))<>p) then pause,end
-end
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
  
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
  
-//=======================================================================
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
  
-//Matrices of rationals
  
-s=%s;r=1.0 ./[s s+1;s^2 1];
+//==============================================================================
  
-T=list(list(),list('native'),list('double'));
+// boolean matrices
  
-for typ=T
-  if prod(r,typ(:))<>1.0/(s^3+s^4) then pause,end
-  if prod(r,'*',typ(:))<>1.0/(s^3+s^4) then pause,end
-  if or(prod(r,1,typ(:))<>[1,1]./[s^3,1+s]) then pause,end
-  if or(prod(r,2,typ(:))<>[1;1]./[s+s^2;s^2]) then pause,end
-  if or(prod(r,3,typ(:))<>r) then pause,end
-end
+d = [%f %t;%t %f];
  
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
  
-//=======================================================================
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),"cumprod",2,"""*"",""r"",""c"",""m""");
  
-//Matrices of booleans
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
  
-b=[%t %t; %f %t];
  
-for typ=list(list(),list('double'));
-  if prod(b,typ(:))<>0 then pause,end
-  if prod(b,'*',typ(:))<>0 then pause,end
-  if or(prod(b,1,typ(:))<>[0 1]) then pause,end
-  if or(prod(b,2,typ(:))<>[1;0]) then pause,end
-  if or(prod(b,3,typ(:))<>double(b)) then pause,end
-end
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
  
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
  
-if prod(b,'native')<>%f then pause,end
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
  
-if prod(b,'*','native')<>%f then pause,end
  
-if or(prod(b,1,'native')<>[%f %t]) then pause,end
+assert_checkfalse(execstr("cumprod(d,""r"", ""nat"")"   ,"errcatch") == 0);
  
-if or(prod(b,2,'native')<>[%t;%f]) then pause,end
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"cumprod", 3, "native", "double");
  
-if or(prod(b,3,'native')<>b) then pause,end
+assert_checkerror("cumprod(d,""r"", ""nat"")", refMsg);
  
-//with hypermatrices 
  
+assert_checkfalse(execstr("cumprod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
  
-b=[%t %t;%f %t];b(1,1,2)=%t;
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",3);
  
-for typ=list(list(),list('double'));
-  if prod(b,typ(:))<>0 then pause,end
-  if prod(b,'*',typ(:))<>0 then pause,end
-  if or(prod(b,1,typ(:))<>hypermat([1,2,2],[0;1;0;0])) then pause,end
-  if or(prod(b,2,typ(:))<>hypermat([2,1,2],[1;0;0;0])) then pause,end
-  if or(prod(b,3,typ(:))<>[1,0;0,0]) then pause,end
-  if or(prod(b,5,typ(:))<>double(b)) then pause,end
-end
+assert_checkerror("cumprod(d,""r"", [""nat"" ""dble""])", refMsg);
  
  
-if prod(b,'native')<>%f then pause,end
+assert_checkfalse(execstr("cumprod(d,""orient"", ""t"")"   ,"errcatch") == 0);
  
-if prod(b,'*','native')<>%f then pause,end
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
  
-if or(prod(b,1,'native')<>hypermat([1,2,2],[%f;%t;%f;%f])) then pause,end
+assert_checkerror("cumprod(d,""orient"", ""t"")", refMsg);
  
-if or(prod(b,2,'native')<>hypermat([2,1,2],[%t;%f;%f;%f])) then pause,end
  
-if or(prod(b,3,'native')<>[%t,%f;%f,%f]) then pause,end
+assert_checkfalse(execstr("cumprod(d,1,1)"   ,"errcatch") == 0);
  
-if or(prod(b,5,'native')<>b) then pause,end
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"cumprod",3);
  
-//=======================================================================
+assert_checkerror("cumprod(d,1,1)", refMsg);
  
-//sparse matrices of floats
  
-s=sparse([1 10 2;-1 254 9]);
+//==============================================================================
  
-T=list(list(),list('native'),list('double'));
+// sparse boolean matrices
  
-for typ=T
-  if prod(s,typ(:))<>-45720 then pause,end
-  if prod(s,'*',typ(:))<>-45720 then pause,end
-  if or(prod(s,1,typ(:))<>sparse([-1 2540 18])) then pause,end
-  if or(prod(s,2,typ(:))<>sparse([20;-2286])) then pause,end
-  if or(prod(s,3,typ(:))<>s) then pause,end
-end
+d = sparse(d);
  
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
  
-//=======================================================================
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
  
-//sparse  matrices of boolean
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
  
-bs=sparse([%t %t %f;%t %t %t]);
  
-for typ=list(list(),list('double'));
-  if prod(bs,typ(:))<>0 then pause,end
-  if prod(bs,'*',typ(:))<>0 then pause,end
-  if or(prod(bs,1,typ(:))<>sparse([1,1,0])) then pause,end
-  if or(prod(bs,2,typ(:))<>sparse([0;1])) then pause,end
-  if or(prod(bs,3,typ(:))<>bool2s(bs)) then pause,end
-end
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
  
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
  
-if prod(bs,'native')<>%f then pause,end
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
  
-if prod(bs,'*','native')<>%f then pause,end
  
-if or(prod(bs,1,'native')<>sparse([%t,%t,%f])) then pause,end
+assert_checkfalse(execstr("cumprod(d,""r"", ""nat"")"   ,"errcatch") == 0);
  
-if or(prod(bs,2,'native')<>sparse([%f;%t])) then pause,end
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: ""%s"" or ""%s"" expected.\n"),"cumprod", 3, "native", "double");
  
-if or(prod(bs,3,'native')<>bs) then pause,end
+assert_checkerror("cumprod(d,""r"", ""nat"")", refMsg);
  
  
-// TODO : test the "m" option
+assert_checkfalse(execstr("cumprod(d,""r"", [""nat"" ""dble""])"   ,"errcatch") == 0);
  
-exec SCI/modules/elementary_functions/tests/unit_tests/cumprod.tst
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",3);
  
-// =============================================================================
+assert_checkerror("cumprod(d,""r"", [""nat"" ""dble""])", refMsg);
  
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  
-// Copyright (C) 2010 - INRIA - Serge Steer
+assert_checkfalse(execstr("cumprod(d,""orient"", ""t"")"   ,"errcatch") == 0);
  
-// Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
  
-//
+assert_checkerror("cumprod(d,""orient"", ""t"")", refMsg);
  
-//  This file is distributed under the same license as the Scilab package.
  
-// =============================================================================
+assert_checkfalse(execstr("cumprod(d,1,1)"   ,"errcatch") == 0);
  
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"cumprod",3);
  
-// <-- CLI SHELL MODE 
+assert_checkerror("cumprod(d,1,1)", refMsg);
+//==============================================================================
+// hypermatrices
+d = rand(2,2,2);
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// polynome
+s = poly(0, "s");
+d = [s s^2;s*%i 1];
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
+//==============================================================================
+// rational matrices
+s = poly(0, "s");
+d = [1/s 1/s^2; 1/s 1];
+assert_checkfalse(execstr("cumprod(d, ""orient"")"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),..
+            "cumprod",2,"""*"",""r"",""c"",""m""");
+assert_checkerror("cumprod(d, ""orient"")", refMsg);
+assert_checkfalse(execstr("cumprod(d, [""r"", ""c""])"   ,"errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"cumprod",2);
+assert_checkerror("cumprod(d, [""r"", ""c""])", refMsg);
  
  
 //cumprod
@@ -1077,6 +2122,7 @@ assert_checkequal(cumprod(bs,'*','native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%
  
 assert_checkequal(cumprod(bs,1,'native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
  
 assert_checkequal(cumprod(bs,2,'native'), sparse([1,1;1,2;2,1;2,2;2,3],[%t;%t;%t;%t;%t],[2,3]));
  
 assert_checkequal(cumprod(bs,3,'native'), bs);