# HG changeset patch # User Rik # Date 1411329385 25200 # Node ID 25ab600d16fd69ac0e8e86a47bcbd83262945c86 # Parent b5a0f11db15820b3e010c5188e31c6400829ba83 codesprint: Add %!tests for dot.cc file. * dot.cc: Add %!tests for dot and blkmm. diff -r b5a0f11db158 -r 25ab600d16fd libinterp/corefcn/dot.cc --- a/libinterp/corefcn/dot.cc Sun Sep 21 20:46:23 2014 +0100 +++ b/libinterp/corefcn/dot.cc Sun Sep 21 12:56:25 2014 -0700 @@ -247,10 +247,12 @@ %! x = [2, 1; 2, 1]; %! y = [-0.5, 2; 0.5, -2]; %! assert (dot (x, y), [0 0]); +%! assert (dot (single (x), single (y)), single ([0 0])); %!test %! x = [1+i, 3-i; 1-i, 3-i]; %! assert (dot (x, x), [4, 20]); +%! assert (dot (single (x), single (x)), single ([4, 20])); %!test %! x = int8 ([1 2]); @@ -397,4 +399,24 @@ %! z(:,:,1) = [7 10; 15 22]; %! z(:,:,2) = [2 2; 2 2]; %! assert (blkmm (x,x), z); +%! assert (blkmm (single (x), single (x)), single (z)); +%! assert (blkmm (x, single (x)), single (z)); + +%!test +%! x(:,:,1) = [1 2; 3 4]; +%! x(:,:,2) = [1i 1i; 1i 1i]; +%! z(:,:,1) = [7 10; 15 22]; +%! z(:,:,2) = [-2 -2; -2 -2]; +%! assert (blkmm (x,x), z); +%! assert (blkmm (single (x), single (x)), single (z)); +%! assert (blkmm (x, single (x)), single (z)); + +%% Test input validation +%!error blkmm () +%!error blkmm (1) +%!error blkmm (1,2,3) +%!error blkmm (ones (2,2), ones (3,3)) +%!error blkmm ({1,2}, [3,4]) +%!error blkmm ([3,4], {1,2}) */ +