Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: TDD can be useful even when it doesn't achieve what you want Date: Thu, 18 Feb 2016 23:22:36 +1300 Lines: 25 Message-ID: References: <56c34b5c$0$18569$e4fe514c@newszilla.xs4all.nl> <56c4b474$0$4233$e4fe514c@newszilla.xs4all.nl> <56c4ef61$0$4197$e4fe514c@newszilla.xs4all.nl> <56c573ab$0$4031$e4fe514c@newszilla.xs4all.nl> <56c5798b$0$4048$e4fe514c@newszilla.xs4all.nl> <56c57f1e$0$4042$e4fe514c@newszilla.xs4all.nl> <56c5832f$0$3977$e4fe514c@newszilla.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net XNQ5kExtlD5Z1bIcYQNKIQ6Tsp1nR99Hs/2Odh5V/0GE5vwsTI Cancel-Lock: sha1:CzWLJtNMczYG5znxS+MOSZSOy0Q= User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <56c5832f$0$3977$e4fe514c@newszilla.xs4all.nl> Xref: csiph.com comp.lang.c++:41028 Wouter van Ooijen wrote: > > Note that I mentioned 'run-time specified baudrate'. Would you test > (whether register-values-based or with real hardware) be for one > specific baudrate? And would the code you write be for one baudrate only > or for the allowed range? Now that is really hard to answer, there are so many ifs buts and maybes! In the example I cited, there was only one baud rate, so we only had to test that the correct number was written to the register. if there were several discrete values, how many to test would depend on how the value was derived. I would probably test the setting of the register and the the algorithm used to calculate the value. The algorithm is just like any other and not specifically driver/embedded code code. Either way my point - that TDD is just as relevant and useful for low level embedded code as it is for business logic - still stands. Code is code. How you implement the details of the tests may vary, but the process does not. -- Ian Collins