octave-maintainers
[Top][All Lists]
Advanced

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

Re: Converting DejaGNU tests to Paul's test/assert infrastructure


From: David Bateman
Subject: Re: Converting DejaGNU tests to Paul's test/assert infrastructure
Date: Tue, 25 Oct 2005 16:02:03 +0200
User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

Paul Kienzle wrote:


On Oct 24, 2005, at 9:20 AM, David Bateman wrote:

However, nested functions are not permitted with Paul's test infrastructure. I haven't looked at test.m yet to see, but how complicated would it be to include nested functions in test.m?


You should now be able to build test function blocks with the function name being the name of a shared variable which will last until the end of the test or until the next 'shared' block.

Ok, but it doesn't treat white space between the function name and "(" that is

%!function y = f(x)
%! y=sin(x)

works, but

%!function y = f (x)
%! y=sin(x)

doesn't. All of the DejaGNU tests are of this form and so either I have to remove the spaces in my perl script, or better update test.m to take the spaces into account in function_name(). For this reason I suggest the attached patch to test.m.

Regards
David

--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary

*** test.m~     2005-10-25 10:38:13.000000000 +0200
--- test.m      2005-10-25 15:58:54.874856766 +0200
***************
*** 577,585 ****
    pos = [];
    right = min(find(def=='('));
    if isempty(right), return; endif
    left = max([find(def(1:right)==' '),find(def(1:right))=='=']);
    if isempty(left), return; endif
!   pos = [left+1,right-1];
  endfunction
  
  ## strip <pattern> from '<pattern> code'
--- 577,587 ----
    pos = [];
    right = min(find(def=='('));
    if isempty(right), return; endif
+   right--;
+   right = max(find(def(1:right)!=' '));
    left = max([find(def(1:right)==' '),find(def(1:right))=='=']);
    if isempty(left), return; endif
!   pos = [left+1,right];
  endfunction
  
  ## strip <pattern> from '<pattern> code'
***************
*** 704,709 ****
--- 706,715 ----
  %! x = 2*y;
  %!assert(a(2),4);       # Test a test function
  
+ %!function x = a (y)
+ %! x = 2*y;
+ %!assert(a(2),4);       # Test a test function with white space
+ 
  %!function a(y)
  %! x = 2*y;
  %!test

reply via email to

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