Loading ...
Sorry, an error occurred while loading the content.

120204Re: [XP] Is there anyone who uses xp methods in embedded applications?

Expand Messages
  • Russel Hill
    Jun 1, 2006
      On 6/1/06, Micron Engineering <micronpn@...> wrote:
      > I have a separate c file but I have to include it on original file to
      > test (using #if...#endif to compile or not) and this to test also static
      > functions and variables.

      I try to minimize my use of static and, given the choice, I prefer
      using the trick Ian mentioned when I need to directly access statics.


      > > 1) I have the liberty of writing C++ test against C code (I like this one)
      > >
      > This means that you have a C++ compiler for the embedded cpu, I haven't
      > for all cpu I used (example Z8Encore, eZ80Acclaim)

      Actually, it means that my programmer tests run in an environment that
      has a C++ compiler. Which need not be on the embedded CPU. We develop
      Coldfire apps on x86 linux boxes. Virtually all the programmer tests
      run on the x86. When we move to the Coldfire, we mostly run acceptance
      tests (using Fitnesse).

      > How do you test static functions? And how can you use static variables?

      1) Minimize the use of static
      2) Clever use of macros:

      #ifdef TESTING
      #define STATIC
      #else
      #define STATIC static
      #endif

      Or, something like that...

      > >
      > > In your example, there isn't much reason for a stub. Consider:
      > >
      > Yes, my example was a "difficult" example, I choose it because I read
      > articles about a stub for every dependant function so I choose one
      > difficult to implement to understand better; the most difficult are
      > functions where the returned type depends from one or more input parameters.

      I only stub or mock where I must, or where it makes my life simpler.
      Dogmatically stubbing every dependent functions isn're required and
      wouldn't make my life simpler.
    • Show all 14 messages in this topic