octave-maintainers
[Top][All Lists]
Advanced

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

Re: BIST tests for C++ functions


From: Rik
Subject: Re: BIST tests for C++ functions
Date: Tue, 15 Dec 2015 12:04:31 -0800

On 12/13/2015 09:00 AM, address@hidden wrote:
Subject:
BIST tests for C++ functions (was: 2015 Octave Code Sprint)
From:
Mike Miller <address@hidden>
Date:
12/12/2015 11:18 AM
To:
address@hidden
List-Post:
<mailto:address@hidden>
Content-Transfer-Encoding:
8bit
Precedence:
list
MIME-Version:
1.0
References:
<address@hidden>
In-Reply-To:
<address@hidden>
Message-ID:
<address@hidden>
Content-Type:
text/plain; charset=utf-8
Message:
1

On Fri, Dec 04, 2015 at 17:01:11 -0800, Rik wrote:
>  2. Add BIST tests for octave functions written in C++
>     (http://wiki.octave.org/wiki/index.php?title=Add_BIST_tests_for_octave_functions_written_in_C%2B%2B)
I worked on this task for a little at the tail end of the sprint today.
Rik, I assume you used a script to populate the list of instances on the
wiki. There seem to be both some false positives and missed
opportunities in the resulting list.

• Not finding functions declared like this:

  DEFUNX ("stat", …

I've adjusted my script to find DEFUNX and DEFUN_DLD now.  There are now 485 instances of functions that need to be reviewed.  Egads!

• Including functions that are block-commented out, such as

  libinterp/corefcn/symtab.cc:1841:DEFUN (set_variable, …

This one is hard to detect automatically without passing through cpp or something similar.  I'd propose to just add a comment marking it as tested.

• Including functions that are tested along with other functions.

We talked about the last item on #octave, just documenting it here for
others. To mark functions that are tested elsewhere, I added test-like
comment blocks like these:

http://hg.savannah.gnu.org/hgweb/octave/file/ec8c8977b0be/libinterp/corefcn/besselj.cc#l386
http://hg.savannah.gnu.org/hgweb/octave/file/ec8c8977b0be/libinterp/corefcn/bitfcns.cc#l374
I added a new example to the instructions on the code sprint page

-- Example 4 : Function tested elsewhere --

The BIST tests are normally located immediately following the DEFUN block. However this is not always the case. For functions that occur in pairs like set()/get() or load()/save() the tests may be located near just one of the functions. Or the tests may be located in a single block somewhere else. This could be the end of the file, or it could be in a separate test file in the test/ directory. In this case, the function needs only to be marked with an explanation about where the tests reside. For example, in bessel.cc there is a large test block at the end of the file and the code includes a note that begins with '%!#'

/*
%!# Function besselj is tested along with other bessels at the end of this file
*/

Alternatively, it may make sense to move the tests to reside next to the function. For example, cputime() does not have tests in data.cc, but it does in test/system.tst.

-- End Example 4 --

Although 485 untested functions sounds really bad, a lot of them do have some tests somewhere.  I think it would be a good idea to move tests from the test directory to reside in the same file as the implementation. 


Another common case I ran across is aliases, either with DEFALIAS or
with a trivial DEFUN that calls another one. Taking as example "arg" and
"angle", how much of the BIST for "arg" should be copy-pasted to test
"angle"?

I don't think we need to test functions defined through DEFALIAS.  For trivial DEFUNs I would just put a note in the code that the tests for the function reside under the principal name.

I've updated the instructions and the list of instances at http://wiki.octave.org/Add_BIST_tests_for_octave_functions_written_in_C%2B%2B#Instances.  Since this is a well-defined task I also added it to the Short Projects list in the wiki (http://wiki.octave.org/Short_projects).

--Rik

    


reply via email to

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