Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

testing a piece of inline code

22 views
Skip to first unread message

rob

unread,
Sep 28, 2018, 6:50:21 AM9/28/18
to
I have about 30 lines of code which I need to test. However, just
leaving the code in situ is not easy as getting the previous code to
meet all the possible initial conditions would increase the SNR
enormously. Is there any way I should make myself aware of to do this
other than to turn the code into a function and wrap a test harness
around it.
I'm testing in visual studio but ultimately need to port the whole thing
as a class into arduino. The whole thing will ultimately be processing
GPS signals so i'd like to keep one eye on performance issues as I go.
cheers
Rob

Ian Collins

unread,
Sep 28, 2018, 6:57:19 AM9/28/18
to
On 28/09/18 22:50, rob wrote:
> I have about 30 lines of code which I need to test. However, just
> leaving the code in situ is not easy as getting the previous code to
> meet all the possible initial conditions would increase the SNR
> enormously. Is there any way I should make myself aware of to do this
> other than to turn the code into a function and wrap a test harness
> around it.

Breaking code down into smaller, testable parts is always a good idea.
There are plenty of mature unit test frameworks such is googletest to
help you on your way.

--
Ian.

Jorgen Grahn

unread,
Sep 28, 2018, 3:01:17 PM9/28/18
to
On Fri, 2018-09-28, Stefan Ram wrote:
> rob <robdnew...@gmail.com> writes:
>>I have about 30 lines of code which I need to test.
>
> To "test" means: to test whether the piece of code fulfills
> written specifications.

Not necessarily. See e.g. exploratory testing.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
0 new messages