Code Monkey home page Code Monkey logo

Comments (3)

rubiot avatar rubiot commented on May 10, 2024

You can by using a custom fake fuction: For instance:

FAKE_VALUE_FUNC_VARARG(int, fprintf, FILE *, const char*, ...);

In order to access the variadic parameters from your custom fake function, declare a va_list parameter. For instance, a custom fake for fprintf() could call the real fprintf() like this:

int fprintf_custom(FILE *stream, const char *format, va_list ap) {
  if (fprintf0_fake.return_val < 0) // should we fail?
    return fprintf0_fake.return_val;
  return vfprintf(stream, format, ap);
}

from fff.

ykoehler avatar ykoehler commented on May 10, 2024

Yes, I realized that afterwards, but I would prefer the other way since I could validate β€œafter” running the function.

from fff.

rubiot avatar rubiot commented on May 10, 2024

You're talking about the call history, right? The problem is the variadic arg types are not known, so there's no way to declare an array to automatically store them. But if you can predict the types you can create you're own history using the custom fake.

from fff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.