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 950319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:32:45+00:00 2026-05-15T23:32:45+00:00

I am maintaining a server application written in C many years ago. It has

  • 0

I am maintaining a server application written in C many years ago. It has very few unit tests (cxxtest) and I am thinking about developing more.

I read on the subject of unit testing C programs in the last days and tried a few things also. The right thing to do appears to be to include the .c file containing the function to test from my test suite. However, because that .c file contains many functions calling many others, there are lots dependencies I have to deal with before I can start the real work.

What I would like to do is to “turn off” all functions I’m not interested with for a particular test. I would stub those called by my function under test. I am considering putting ifdef around my functions if it’s what it takes.

Is there a better solution or a framework addressing this problem?

  • 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-05-15T23:32:46+00:00Added an answer on May 15, 2026 at 11:32 pm

    Cmock solves most of my problem. I gave up on the idea of isolating a single function. I will be fine if I can isolate one C file from another. Cmock allows me to do that quite conveniently (and even more).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm on a team maintaining a .Net web app with a SQL Server 2005
I am maintaining a few web applications. The development and qa environments use invalid/outdated
I'm maintaining a .NET 1.1 application and one of the things I've been tasked
I'm maintaining a hybrid application, containing both WinForms and WPF technologies. Ideally, the look-and-feel
When maintaining a COM interface should an empty BSTR be treated the same way
After maintaining lots of code littered with #region (in both C# and VB.NET), it
I am maintaining an app for a client that is used in two locations.
I'm maintaining some code that uses a *= operator in a query to a
I am maintaining .net 1.1 and .net 3.5 c# code at once. For this
I assist in maintaining an enterprise web-based system (programmed in J2EE, but this is

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.