Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:22:25+00:00 2026-06-06T09:22:25+00:00

I have a large library of code which has a few (much too few)

  • 0

I have a large library of code which has a few (much too few) unit tests; i am adding code to the library, trying to make unit tests for the new code (i also want to add unit tests for old code in future, when i get more experienced).

We currently use a custom (not very elaborate) unit-testing framework; i would like to switch to boost.test.

My library layout is:

  • mylib1 (300 files, 70000 lines of code)

    • src
      • foo
        • foo.cpp
        • foo_part.cpp
        • foo_part.h
        • UnitTests – should i move it outside mylib?
          • foo_test1.cpp
          • foo_test2.cpp
          • foo_test3.cpp
      • bar
        • bar.cpp
        • bar_part.cpp
        • bar_part.h
        • UnitTests – does it belong here?
          • bar_test1.cpp
          • bar_test2.cpp
          • bar_test3.cpp
    • include
      • foo.h
      • bar.h
  • mylib2 (70 files, 7000 lines of code)

    • Looks like the mylib1 above
  • UnitTestFramework

    • src
      • MockObject1.cpp – does it belong here?
      • Asserter.cpp – boost.test will replace it
      • TestFixture.cpp – boost.test will replace it
    • include
      • MockObject1.h
      • Asserter.h – boost.test will replace it
      • TestFixture.h – boost.test will replace it

I am asking the following questions here:

  • Should unit tests be part of mylib DLL? (I link mylib1 and mylib2 into one DLL)
  • Should source code for unit tests be located under the mylib1 directory?
  • Since i have mylib1 and mylib2, how should the corresponding unit-tests be located – in sibling directories, together, etc?
  • Where should i put source code for mock objects? (they serve both mylib1 and mylib2)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:22:26+00:00Added an answer on June 6, 2026 at 9:22 am
    1. unit tests are kind of documentation, therefore I would leave the directory structure as it is
    2. mocks/fakes are helpers in unit tests, therefore I wouldn’t leave them in the source directory. Create a new directory in the source, and move them there.

    Actually, I would simplify it even further :

     + mylib1 (300 files, 70000 lines of code)
        + unit_tests
          + test_foo.cpp
          + test_bar.cpp
        + mocks
          + mock_foo.hpp
          + mock_bar.hpp
        + foo.cpp
        + foo.hpp
        + bar.cpp
        + bar.hpp
     + mylib2
    similar as for mylib1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have started using the boost unit testing library for a large existing code
I have a project which uses a large library residing in its own repository.
I have an native C++ library which makes use of a large static buffer
I have a very old but very large library which I am considering converting
Consider I have large library package with sophisticated tree of private or package modules
I have a large sprite library and I'd like to cut GPU memory requirements.
I am developing a fairly large C++ support library, and have found myself moving
I am writing a fairly large C++ shared-object library, and have run into a
I have a large body of code, compiled with /MT (i.e. expecting to statically
I'm currently in the process of developing a fairly large static library which will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.