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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:02:51+00:00 2026-05-14T02:02:51+00:00

I am working with a unit-testing suite that hijacks function calls and tests expected

  • 0

I am working with a unit-testing suite that hijacks function calls and tests expected output values.

The normal layout requires one block of unit-testing code for each expected value.

Since my code makes use of a large number of enums, I would like to automate the automated-testing with some for loop / macro magic, and I’m looking for some advice with writing it.

Here is a block of the test code that I need to duplicate X number of times:

START_TEST("test_CallbackFn");

EXPECTED_CALLS("{{function1(param_type)#default}{function2(param_type)#default}}");

CallbackFn();

END_CALLS();
END_TEST();

Now, here is what I would envision occuring

for (int i = 0; i < 10; i++)
{
  RUN_TEST(i)
}

Now, I would like to define RUN_TEST with the code I mentioned above, except I need to replace the string default with the current value of i. What is throwing me off is the quotes and #’s that are present in the existing EXPECTED_CALLS macro.

  • 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-14T02:02:52+00:00Added an answer on May 14, 2026 at 2:02 am

    I think I would look at using a separate macro processor rather than trying to beat the C preprocessor into submission. The classic example that people point to is m4, but for this, you might do better with awk or perl or python or something similar.

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

Sidebar

Related Questions

I am working with Silverlight Unit Testing i need to test a function which
I'm running into an issue while unit-testing a Python project that I'm working on
I'm working on a project that uses MSTest for unit testing and I need
I am working on a unit testing for a function in a form call
I'm working on a groovy unit-testing class that contains a collection of rules for
I've been trying to get started with unit-testing while working on a little cli
I'm working on my first project in which I'm utilizing PHPUnit for unit testing.
now i'm working on a project for creating audio unit instrument that provide the
I am working with Erlang and EUnit to do unit tests, and I would
Working with an undisclosed API, I found a function that can set the number

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.