title: How to count the number of times the real function has been called using a mocking framework in C
body: <p>I'm starting to use TDD for writing embedded C software and I'm using Google Test as my testing framework. I just realized a situation that doesn't seem to be covered on any mocking tutorials: I want to count how many times a given <em>REAL</em> function has been called.</p>
  
  <p>So, let's say that I'm developing some code that uses a library called LIB_A, which in turn uses another library called LIB_B.</p>
  
  <p>normally, I would mock LIB_B and have a test like so:</p>
  
  <pre><code>TEST(MyCodeTest, CanDoSomething) {
    Mock_LIB_B_Class mock_object;
    MyClass my_obj;
  
    // We expect that doSomething will call SomeMethod at least once
    EXPECT_CALL(mock_class, SomeMethod()).Times(AtLeast(1));
  
    // Checks for the expected return
    EXPECT_EQ(0, my_obj.doSomething());
  }
  </code></pre>
  
  <p>OK, that's all fine and dandy. Now here's my question: what if I don't have to mock LIB_A, but mock LIB_B. how can I count the number of times <code>SomeMethod</code> gets called? Because mocking frameworks make it easy to create mock functions that don't actually have a real implementation. </p>
  
  <p>I'm thinking that I could use a fake for LIB_A, so the calls would be countable. I'm thinking about using either Google Mock or Fake Function Framework.</p>
  
  <p>Thanks!</p>