Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Use m4 and make to compose C programs |
| Date | 2015-08-22 19:22 +1200 |
| Message-ID | <d3qm98Fed1gU2@mid.individual.net> (permalink) |
| References | <ff7f0b6d-56e9-47a7-898f-b5fec727fc70@googlegroups.com> <d3qhhaFed1gU1@mid.individual.net> <9a4284c9-5108-48aa-8ee9-5664cae36f96@googlegroups.com> |
luser droog wrote: > On Saturday, August 22, 2015 at 1:01:24 AM UTC-5, Ian Collins wrote: >> >> I'll snip here and ask the obvious question: why can't you just unit >> test the code as is? > > I'm afraid I don't understand the question. How do you > "unit test the code as is"? The code has nothing conditional or test specific in it. What is built for production is what is tested. >> Everything I write has unit tests (I use TDD) and I never have anything >> conditionally compiled. > > I imagine the testing code has to be separated into the "test" file. Test, in my case each logical module has its own test set of tests, everything outside of that module is mocked. > The way I've come up with lets me keep the test code together with > the implementation. I think (for me) it will help keep the testing > updated and used more. The easiest way to do that is to set your build to have make = "make test". That way you can't build without testing. > I've also wanted to do something with m4 for a while. Here finally > was something cpp couldn't do. Maybe, but is the cost (in hard to read code) worth the benefit? You should be testing production code built as production code, optimisations, compiler options and all. -- Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Use m4 and make to compose C programs luser droog <luser.droog@gmail.com> - 2015-08-21 22:53 -0700
Re: Use m4 and make to compose C programs Ian Collins <ian-news@hotmail.com> - 2015-08-22 18:01 +1200
Re: Use m4 and make to compose C programs luser droog <luser.droog@gmail.com> - 2015-08-21 23:43 -0700
Re: Use m4 and make to compose C programs Ian Collins <ian-news@hotmail.com> - 2015-08-22 19:22 +1200
Re: Use m4 and make to compose C programs luser droog <luser.droog@gmail.com> - 2015-08-23 13:13 -0700
Re: Use m4 and make to compose C programs Ian Collins <ian-news@hotmail.com> - 2015-08-24 11:15 +1200
Re: Use m4 and make to compose C programs Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-23 16:52 -0700
Re: Use m4 and make to compose C programs Richard Damon <Richard@Damon-Family.org> - 2015-08-23 21:27 -0400
Re: Use m4 and make to compose C programs Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-24 00:43 -0700
Re: Use m4 and make to compose C programs <william@wilbur.25thandClement.com> - 2015-08-27 12:20 -0700
Re: Use m4 and make to compose C programs luser droog <luser.droog@gmail.com> - 2015-08-26 23:22 -0700
Re: Use m4 and make to compose C programs luser droog <luser.droog@gmail.com> - 2015-08-26 23:40 -0700
csiph-web