week4 - EECS 280 Week 4 Discussion Notes Testing and Binary...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EECS 280 Week 4 Discussion Notes Testing and Binary Trees 1 Testing Something new about project 2 that we all must have discovered by now is that p2.cpp does not contain the main() function. So, how do we run our code, or rather, how do we test our code? Drivers and stubs It is always a good idea to develop and test software in pieces. But, it may seem impossible because it is hard to imagine how you can test one piece if the other pieces that it uses have not yet been developed (and vice versa). To solve this, we use stubs and drivers. In white-box testing, we must run the code with predetermined input and check to make sure that the code produces predetermined outputs. Often testers write stubs and drivers for white-box testing. Consider the following piece of code: int HighFunc( int n) { . . . double tax = LowF1(months ) ; . . . double i n t e r e s t = LowF2( years ) ; . . . } double LowF1( int months) { . . . } double LowF2( int years ) { . . . } where HighFunc , LowF1 and LowF2 are not completely coded yet, but we know that LowF1 and LowF2 are called from HighFunc as a result of functional decomposition of HighFunc . Driver for Testing: A driver is a piece of code that passes test cases to another piece of code. It can be called as a software module which is used to invoke a module under test and provide test inputs, control and, monitor execution, and report test results or most simplistically...
View Full Document

Page1 / 4

week4 - EECS 280 Week 4 Discussion Notes Testing and Binary...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online