0

I have a function which receives data as an argument and performs long calculations on it after parsing it. There are many if conditions in the function which deal with local variables of that function.

Friend class, I guess, can take care of private members and not local variables !

How to test if conditions dealing with local variables with gtest?

Community
  • 1
  • 1
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
  • 1
    Perhaps turn the big function into several smaller functions that can be tested separately? Generally, a test should verify the result of a function, not exactly how it computes it. – Bo Persson Jul 11 '16 at 07:25
  • write that as an answer, please. also do provide a link in your answer about how to write unit test cases @BoPersson – Aquarius_Girl Jul 11 '16 at 07:26
  • 1
    Agree with @BoPersson, splitting the large function to small ones, and test the small ones' with various inputs/results. – Mine Jul 11 '16 at 08:02

0 Answers0