octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: format compact and loose


From: Ben Abbott
Subject: Re: format compact and loose
Date: Thu, 08 Sep 2011 11:31:23 -0400

On Sep 7, 2011, at 7:54 AM, bpabbott wrote:

> On Sep 06, 2011, at 10:18 PM, Jordi Gutiérrez Hermoso <address@hidden> wrote:
> 
> Thanks Jordi,
>  
> In my spare time, I'll start writing test scripts for different classes.
> 
> Ben

Does this look like a reasonable approach?

Ben

diff --git a/src/pr-output.cc b/src/pr-output.cc
--- a/src/pr-output.cc
+++ b/src/pr-output.cc
@@ -3547,6 +3547,21 @@
 %!   endfor
 %! endfor
 %! fclose (fd);
+
+%!test
+%! foo.real = pi * ones (3,20,3);
+%! foo.complex = pi * ones (3,20,3) + 1i;
+%! foo.char = repmat ("- Hello World -", [3, 20]);
+%! foo.cell = {foo.real, foo.complex, foo.char};
+%! fields = fieldnames (foo);
+%! for f = 1:numel(fields)
+%!   format loose
+%!   loose = disp (foo.(fields{f}));
+%!   format compact
+%!   compact = disp (foo.(fields{f}));
+%!   expected = strrep (loose, "\n\n", "\n");
+%!   assert (expected, compact)
+%! endfor
 */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]