Hello,
If I want to check my algorithm if it works good in every cases
so can i check very outer cases and then I can conclude that my algorithm works well in all cases?

Saying perhaps it is and the can, but me does not understand
(courtesy of our favorite translator babelfish)...

This is a QA kind of question.

You should feed your alogorithm data which has:

1. values outside given bounds, like what the sqrt() runtime function does:
It is able able to return NaN or +INFINITY and sets errno=EDOM (unix only).

2. validate output for known value sets, with extremely large/small or postivie/negative values

3. Deliberately try to break the code - if it expects numeric data feed it text instead of numbers, for example. In all cases it should simply return an error, not crash.
It should NOT exit. Whether or not an exit is called depends on the rules of operation of the program, not on an individual function.


Consider reading 'The Pragmatic Programmer' - it explains how functions (algorithms) are supposed to behave when users are trying to feed them data.

First thank you for the good answer :p
secondly i want to ask you something:
if I have an algorithm that solves questions with order of arithmetic operations than my input values can be very long, so I am trying to input something extreme small like:(0+0) or something extreme long and big like:
(2+4*(7/9-(6+7)+(789-9900)+6788-9/(45-998))) and then if my algorithm solves this inputs then I can conclude that my algorithm solves all the inputs i will give him?(and after i will try to input him string and it will not crash)

Originally quoted by SNA

(2+4*(7/9-(6+7)+(789-9900)+6788-9/(45-998))) and then if my algorithm solves this inputs then I can conclude that my algorithm solves all the inputs i will give him?

Hi,

Just becoz u give ur algorithm this case doesn't mean it works 4 all cases. U might give him many cases and they all appear 2 work. This doesn't not prove him to work it evry case.

For example, there might B 1 case that u forget.

To prove something is not to test alot. But to convince the reader through logic that your answer is the only obtanable solution.

:cool:

OK, I have understood you but you can't check all the cases in the world.

This article has been dead for over six months. Start a new discussion instead.