unity_setup.h 1.1 KB
Newer Older
J
John Lindgren 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/* ==========================================
    Unity Project - A Test Framework for C
    Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
    [Released under MIT License. Please refer to license.txt for details]
========================================== */

#ifndef UNITY_SETUP_H
#define UNITY_SETUP_H

#include "unity_internals.h"

/* On some platforms (MinGW for example), weak function implementations
 * need to be in the same translation unit they are called from.  This
 * header can be included to provide implementations of setUp(), tearDown(),
 * suiteSetUp(), and suiteTearDown(). */

#if defined(UNITY_WEAK_ATTRIBUTE)
  UNITY_WEAK_ATTRIBUTE void setUp(void) { }
  UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
  UNITY_WEAK_ATTRIBUTE void suiteSetUp(void) { }
  UNITY_WEAK_ATTRIBUTE int suiteTearDown(int num_failures) { return num_failures; }
#elif defined(UNITY_WEAK_PRAGMA)
  #pragma weak setUp
  void setUp(void) { }
  #pragma weak tearDown
  void tearDown(void) { }
  #pragma weak suiteSetUp
  void suiteSetUp(void) { }
  #pragma weak suiteTearDown
  int suiteTearDown(int num_failures) { return num_failures; }
#endif

#endif