1

I just learned that static library building skips the linking stage, which explains why my build process succeeds all the time when it's possible I actually haven't implemented a function in my header. In an executable project, the linking stage would alert me if I had done this.

What is the typical workflow for static library developers to get that extra verification? Do you just write a test class separately that tries to invoke everything in your library API to ensure you've done your job right?

johnbakers
  • 289
  • 1
  • 7
  • 1
    you'll be surprised but that's the way used by developers of dynamic libraries. They just write a test class separately that tries to invoke everything in your library API to ensure you've done your job right. This approach is known as [tag:unit-testing] – gnat Apr 30 '16 at 17:43
  • 1
    @gnat would a static library have a different or the same general process of testing? – johnbakers Apr 30 '16 at 17:45
  • 1
    the same. It's a traditional way to quickly verify that your code works as expected. And not only that, "it doesn't require imagination to immediately see how my module will be used if designed this or that way and makes it easy to choose the more convenient one. When coding module for someone else, it also saves me from the need to painfully explain how to use it... ([Why is it often said that the test cases need to be made before we start coding?](http://programmers.stackexchange.com/a/182329/31260)) – gnat Apr 30 '16 at 17:49
  • The only difference I can think of between unit testing a library versus unit testing classes in a larger application is that the library might want to have a system or integration test that tries to compile and run a test app while linking against the pre-compiled library. And even that would be a much lower priority than good unit test coverage. – Ixrec Apr 30 '16 at 17:56

0 Answers0