I was having a problem in getting some sort of answer for the following problem, as i really not ever delt with testing.
Given a simple program designed to take inputs of integers from 1-1000 and to output the factorial value of that number, how would you test this program? You do not have access to the code. Please be as specific as possible.
Actually i have been coder and not sure how to tess tet the program.
Thank you for your time and Patience.
By test this program without access to the source code...what do you mean?
To see if it really does produce the correct factorials for its input range...you'd have to figure out the factorial for some number like 1000 and make sure the program gets the same answer. In many cases, you can only get to the factorial of between 8-15 or so correctly before 32bits becomes not enough to store the value. To get the factorial of 1000, you'd need to work out some sort of way to store an arbitrarly large number.
To see if you could crash the program...you could try giving it an input of a letter. Or of a floating-point number (3.1415). Or you could try a really big number like 999999999999999999999 or something.
If you had access to the source code, you could see if the program was "hardened" to deal with this. And you could find other problems that might have slipped by, such as a factorial of something bigger than 4294967296 so that you might break the conditionals the program uses to ensure that it loops correctly, if that was not hardened. To secure it, you need to make sure that the way the program calculates the factorial is hardened for pretty much any number you could ever throw at it. And, unless you want it to, that it doesn't try to calculate something so big as to use up hundreds of megabytes of RAM and load the processor for several minutes/hours. And then you need to of course check user input and how you output it, because if you (really) mess up in handling input and displaying stuff in C/C++, it is possible for them to output some sensitive stuff in your program, such as some variable inside of it. And at other times they could possibly take advantage of a buffer overflow to get the program to execute something it shouldn't that is loaded in memory...