📄 testing.html
字号:
<HTML><HEAD><TITLE>Newmat09- testing</TITLE></HEAD> <BODY><H2>Testing</H2><A HREF="refer.html"> next</A> - <A HREF="refer.html"> skip</A> - <A HREF="starting.html"> up</A> - <A HREF="index.html"> start</A><P>The library package contains a comprehensive test program in the form ofa series of files with names of the form tmt?.cxx.The files consist of a large number of matrix formulaeall of which evaluate to zero (except the first one which is used tocheck that we are detecting non-zero matrices). The printout shouldstate that it has found just one non-zero matrix.<P>The test program should be run with <I>Real</I> typedefed to <I>double</I>rather than <I>float</I> in <A HREF="custom.html">include.h</A>.<P>Make sure the <A HREF="elements.html">C subscripts</A> are enabled if youwant to test these.<P>Various versions of the make file (extension .mak) are included with thepackage. See the section on <A HREF="make.html">make files</A>.<P>The program also allocates and deletes a large block and small block ofmemory before it starts the main testing and then at the end of thetest. It then checks that the blocks of memory were allocated in thesame place. If not then one suspects that there has been a memory leak.i.e. a piece of memory has been allocated and not deleted.<P>This is not completely foolproof. Programs may allocate extra printbuffers while the program is running. I have tried to overcome this bydoing a print before I allocate the first memory block. Programs mayallocate memory for different sized items in different places, or mightnot allocate items consecutively. Or they might mix the items with memoryblocks from other programs. Nevertheless, I seem to get consistentanswers from many of the compilers I am working with, so I think this isa worthwhile test.<P>If the <A HREF="custom.html">DO_FREE_CHECK</A> option in include.h is activated, the program checks thateach <TT>new</TT> is balanced with exactly one <TT>delete</TT>. This providesa more definitive test of no memory leaks. There are additional statements inmyexcept.cpp which can be activated to print out details of the memory beingallocated and released.<P>I have included a facility for checking that each piece of code in thelibrary is really exercised by the test routines. Each block of code in themain part of the library contains a word <TT>REPORT</TT>.<TT>newmat.h</TT> has a line defining <TT>REPORT</TT> that can beactivated (deactivate the dummy version). This gives a printout of the numberof times each of the <TT>REPORT</TT> statements in the <TT>.cpp</TT> filesis accessed. Use agrep with line numbers to locate the lines on which <TT>REPORT</TT> occurs andcompare these with the lines that the printout shows were actually accessed.One can then see which lines of code were not accessed.<P><A HREF="refer.html"> next</A> - <A HREF="refer.html"> skip</A> - <A HREF="starting.html"> up</A> - <A HREF="index.html"> start</A><P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -