Go Back  IT Forums > Software > Testing
User Name
Password
Reply
 
Thread Tools Search this Thread Display Modes

Formal Algorithm Testing
  #1
Old 10-02-2006, 08:44 PM
david
Junior Member


david is offline
david's Info
Join Date: Oct 2006
Posts: 2
Default Formal Algorithm Testing

I'm looking for a formal method to test a function which contains an
algorithm or calculation. For example, suppose
I have a formula from a textbook, which I implement in C++. Is there a
formal test to verify that the
function (calculation) is producing the correct values, supposing I don't
have any known input/output data values?


Reply With Quote
Formal Algorithm Testing
  #2
Old 10-03-2006, 07:58 AM
Vladimir Trushkin
Junior Member


Vladimir Trushkin is offline
Vladimir Trushkin's Info
Join Date: Jun 2005
Posts: 11
Default Formal Algorithm Testing

david wrote:
Quote:
I'm looking for a formal method to test a function which contains an algorithm or calculation. For example, suppose I have a formula from a textbook, which I implement in C++. Is there a formal test to verify that the function (calculation) is producing the correct values, supposing I don't have any known input/output data values?


The mere formulation of the problem is wrong. You cannot test something
not knowing the limitations of (requirements to) input data and
expected output results. Testing is about comparing actual results
against expected ones. Try to reformulate your query.

----
Best Wishes,
Vladimir

Reply With Quote
Formal Algorithm Testing
  #3
Old 10-04-2006, 02:15 PM
david
Junior Member


david is offline
david's Info
Join Date: Oct 2006
Posts: 2
Default Formal Algorithm Testing

Ok.

In my situation I would know the possible input values, but not the
corresponding output values.

Someone must have done something like this before, for example:

1. Find a complicated formula in a textbook to calculate some value. You
would know the possible
input values, but there would be no tables of corresponding output values.

2. Implement the formula in C++

3. Do some test to check that the implentation of the formula in C++ is
correct (matches the original formula from the textbook).

Maybe the only way to do this test is to manually do some calculations using
the textbook formula and then compare with
the outputs from the C++ function - but I was wondering if there is a more
formal way to do this.

"Vladimir Trushkin" <trushkin@tut.by> wrote in message
news:1159891088.628834.244980@b28g2000cwb.googlegr oups.com...
Quote:
david wrote:
Quote:
I'm looking for a formal method to test a function which contains an algorithm or calculation. For example, suppose I have a formula from a textbook, which I implement in C++. Is there a formal test to verify that the function (calculation) is producing the correct values, supposing I don't have any known input/output data values?
The mere formulation of the problem is wrong. You cannot test something not knowing the limitations of (requirements to) input data and expected output results. Testing is about comparing actual results against expected ones. Try to reformulate your query. ---- Best Wishes, Vladimir



Reply With Quote
Formal Algorithm Testing
  #4
Old 10-05-2006, 07:06 AM
Vladimir Trushkin
Junior Member


Vladimir Trushkin is offline
Vladimir Trushkin's Info
Join Date: Jun 2005
Posts: 11
Default Formal Algorithm Testing


david wrote:
Quote:
Maybe the only way to do this test is to manually do some calculations using the textbook formula and then compare with the outputs from the C++ function - but I was wondering if there is a more formal way to do this.


Exactly! But before doing it, make sure you picked out correct input
values to try out. Your goal is to examine the most with the least. In
other words, from the huge amount of input cases you have to pick those
that will better represent the total scope of possible cases of use.

Good luck!

Vladimir

Reply With Quote
Formal Algorithm Testing
  #5
Old 10-05-2006, 11:55 AM
JMike
Junior Member


JMike is offline
JMike's Info
Join Date: Dec 2004
Posts: 29
Default Formal Algorithm Testing

david wrote:
Quote:
Ok. In my situation I would know the possible input values, but not the corresponding output values. Someone must have done something like this before, for example: 1. Find a complicated formula in a textbook to calculate some value. You would know the possible input values, but there would be no tables of corresponding output values. 2. Implement the formula in C++ 3. Do some test to check that the implentation of the formula in C++ is correct (matches the original formula from the textbook). Maybe the only way to do this test is to manually do some calculations using the textbook formula and then compare with the outputs from the C++ function - but I was wondering if there is a more formal way to do this.


I don't know of any formal method (and I think the jury is out on
whether it's even possible to define a formal method - you may run into
the halting problem if you try for a really clean formal method). But
I'd like to suggest a couple quick practical ideas.

- What actual inputs/outputs are really easy to compute (on the
pencil-and-paper side)? Do those first against your C++ function as a
sanity check.

- Can you compute any interesting related properties of the formula
(again on the P&P side)? Like the derivative with respect to each of
its inputs? Or does it have asymptotic behavior anywhere? You can use
these observations to guide your choice of inputs to, and verification
of, the C++ function.

- Does the C++ implementation give reasonable answers when various
input(s) are very large or very small? Or when the inputs are of very
different orders of magnitude?

If your formula is some kind of iterative approximation, you're going
to run into all kinds of questions that are discussed in the field of
"numerical analysis", but then you probably are already familiar with
numerical analysis if you're doing an iterative approximation. I'm
guessing your formula is a relatively straightforward one-time
computation sort of thing.

--JMike

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Style Design by vBStyles.com


Top Contact Us - IT Forums - Archive - MyLounge Top
MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service