gnucap-devel
[Top][All Lists]
Advanced

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

Re: [Gnucap-devel] Problem in understanding Functions


From: al davis
Subject: Re: [Gnucap-devel] Problem in understanding Functions
Date: Sun, 30 Jun 2013 11:50:37 -0400
User-agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )

On Sunday 30 June 2013, Rishabh Yadav wrote:
> I can't figure out what for functions
> cmd.more(),cmd.tail(),itested() and utested() are used?

cmd.more() : part of CS class (Command String).  returns true if 
there is "more" in the string to be used, false if it is all 
used up.

cmd.tail() : returns std::string .. what is left, so far unused, 
in a command string (CS).

untested() : part of test procedures.  In a "release" build it 
does nothing, defined out.  In a "debug" build, -DTRACE_UNTESTED 
in the compile command, it prints a message including file name, 
line number, and function name every time.  It is used as an aid 
in building test suites.  It also serves as a comment to say 
that the block of code is not adequately tested.

itested() : interactively tested only.  -DTRACE_ITESTED to turn 
it on.  A weaker form of untested.

unreachable() : stronger form marking blocks of code that should 
be unreachable.  It really means reachable only if there are 
bugs in the code, not by user input.  Kind of like an "assert".

As part of testing .. Replace all "{" in code blocks with 
"{untested();" then run test cases.  Remove all "untested()" 
that show when run.  The ones left are blocks of code that the 
test cases don't cover.  The comment "//testing=(something) with 
a date indicates when this full procedure was done.  The test 
suite has been rerun many times since, and probably improved, 
without changing the testing date.  "script" means the above 
procedure.  "complete" means the test suite really does cover 
every line of code.

Also ..  replace ":" with "untested();" in switch statements.

For this procedure to work:
1.  Always use {}, even if there is only one line.
2.  Always have an "else" section, even if there is nothing in 
it.
3.  Switch statements must explicitly handle all cases.  No 
default.



reply via email to

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