|
-
November 9th, 2003, 04:14 AM
#1
Stubs
Could you tell me what is stub ? and what is drive ?
Thx,
Ron
-
November 9th, 2003, 08:23 PM
#2
Do you mean test driver and stub? Basically, test driver is usually written to check if your written function is working properly. In the driver, you have to perform the necessary setup before calling the function.
As for the stubs, they are called by your written function which you want to test. The stubs are usually dummy functions that may or may not return certain values.
-
November 10th, 2003, 12:26 AM
#3
A stub is basically an empty function that takes the place of the real function for compile reasons to achieve certain things.
Imagine a unit test suite that you don't want with your released project. A way to handle this is to keep the unit test code in a different library. The unit test library will have a function to kick off the unit test suite. This function is called from main.
Now for release you can have a different library, with the unit test function stubbed out. The library will only contain this empty function.
There are other ways to achieve this example, namely by using #defines in main(), but you could probably imagine a case where you can't change the caller's code.
I also vaguely remember using stubs to get a certain DLL to work. The functions were never called, but they had to be stubbed out in the DLL because they were somehow referenced.
Jeff
-
November 10th, 2003, 01:17 AM
#4
Aha Thank you guys 
Ronio
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|