HelperMacros.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. // //////////////////////////////////////////////////////////////////////////
  2. // Header file HelperMacros.h
  3. // (c)Copyright 2000, Baptiste Lepilleur.
  4. // Created: 2001/04/15
  5. // //////////////////////////////////////////////////////////////////////////
  6. #ifndef CPPUNIT_EXTENSIONS_HELPERMACROS_H
  7. #define CPPUNIT_EXTENSIONS_HELPERMACROS_H
  8. #include <cppunit/TestCaller.h>
  9. #include <cppunit/TestSuite.h>
  10. #include <cppunit/extensions/AutoRegisterSuite.h>
  11. #include <cppunit/extensions/ExceptionTestCaseDecorator.h>
  12. #include <cppunit/extensions/TestFixtureFactory.h>
  13. #include <cppunit/extensions/TestNamer.h>
  14. #include <cppunit/extensions/TestSuiteBuilderContext.h>
  15. #include <memory>
  16. /*! \addtogroup WritingTestFixture Writing test fixture
  17. */
  18. /** @{
  19. */
  20. /** \file
  21. * Macros intended to ease the definition of test suites.
  22. *
  23. * The macros
  24. * CPPUNIT_TEST_SUITE(), CPPUNIT_TEST(), and CPPUNIT_TEST_SUITE_END()
  25. * are designed to facilitate easy creation of a test suite.
  26. * For example,
  27. *
  28. * \code
  29. * #include <cppunit/extensions/HelperMacros.h>
  30. * class MyTest : public CppUnit::TestFixture {
  31. * CPPUNIT_TEST_SUITE( MyTest );
  32. * CPPUNIT_TEST( testEquality );
  33. * CPPUNIT_TEST( testSetName );
  34. * CPPUNIT_TEST_SUITE_END();
  35. * public:
  36. * void testEquality();
  37. * void testSetName();
  38. * };
  39. * \endcode
  40. *
  41. * The effect of these macros is to define two methods in the
  42. * class MyTest. The first method is an auxiliary function
  43. * named registerTests that you will not need to call directly.
  44. * The second function
  45. * \code static CppUnit::TestSuite *suite()\endcode
  46. * returns a pointer to the suite of tests defined by the CPPUNIT_TEST()
  47. * macros.
  48. *
  49. * Rather than invoking suite() directly,
  50. * the macro CPPUNIT_TEST_SUITE_REGISTRATION() is
  51. * used to create a static variable that automatically
  52. * registers its test suite in a global registry.
  53. * The registry yields a Test instance containing all the
  54. * registered suites.
  55. * \code
  56. * CPPUNIT_TEST_SUITE_REGISTRATION( MyTest );
  57. * CppUnit::Test* tp =
  58. * CppUnit::TestFactoryRegistry::getRegistry().makeTest();
  59. * \endcode
  60. *
  61. * The test suite macros can even be used with templated test classes.
  62. * For example:
  63. *
  64. * \code
  65. * template<typename CharType>
  66. * class StringTest : public CppUnit::TestFixture {
  67. * CPPUNIT_TEST_SUITE( StringTest );
  68. * CPPUNIT_TEST( testAppend );
  69. * CPPUNIT_TEST_SUITE_END();
  70. * public:
  71. * ...
  72. * };
  73. * \endcode
  74. *
  75. * You need to add in an implementation file:
  76. *
  77. * \code
  78. * CPPUNIT_TEST_SUITE_REGISTRATION( StringTest<char> );
  79. * CPPUNIT_TEST_SUITE_REGISTRATION( StringTest<wchar_t> );
  80. * \endcode
  81. */
  82. /*! \brief Begin test suite
  83. *
  84. * This macro starts the declaration of a new test suite.
  85. * Use CPPUNIT_TEST_SUB_SUITE() instead, if you wish to include the
  86. * test suite of the parent class.
  87. *
  88. * \param ATestFixtureType Type of the test case class. This type \b MUST
  89. * be derived from TestFixture.
  90. * \see CPPUNIT_TEST_SUB_SUITE, CPPUNIT_TEST, CPPUNIT_TEST_SUITE_END,
  91. * \see CPPUNIT_TEST_SUITE_REGISTRATION, CPPUNIT_TEST_EXCEPTION, CPPUNIT_TEST_FAIL.
  92. */
  93. #define CPPUNIT_TEST_SUITE( ATestFixtureType ) \
  94. public: \
  95. typedef ATestFixtureType TestFixtureType; \
  96. \
  97. private: \
  98. static const CPPUNIT_NS::TestNamer &getTestNamer__() \
  99. { \
  100. static CPPUNIT_TESTNAMER_DECL( testNamer, ATestFixtureType ); \
  101. return testNamer; \
  102. } \
  103. \
  104. public: \
  105. typedef CPPUNIT_NS::TestSuiteBuilderContext<TestFixtureType> \
  106. TestSuiteBuilderContextType; \
  107. \
  108. static void \
  109. addTestsToSuite( CPPUNIT_NS::TestSuiteBuilderContextBase &baseContext ) \
  110. { \
  111. TestSuiteBuilderContextType context( baseContext )
  112. /*! \brief Begin test suite (includes parent suite)
  113. *
  114. * This macro may only be used in a class whose parent class
  115. * defines a test suite using CPPUNIT_TEST_SUITE() or CPPUNIT_TEST_SUB_SUITE().
  116. *
  117. * This macro begins the declaration of a test suite, in the same
  118. * manner as CPPUNIT_TEST_SUITE(). In addition, the test suite of the
  119. * parent is automatically inserted in the test suite being
  120. * defined.
  121. *
  122. * Here is an example:
  123. *
  124. * \code
  125. * #include <cppunit/extensions/HelperMacros.h>
  126. * class MySubTest : public MyTest {
  127. * CPPUNIT_TEST_SUB_SUITE( MySubTest, MyTest );
  128. * CPPUNIT_TEST( testAdd );
  129. * CPPUNIT_TEST( testSub );
  130. * CPPUNIT_TEST_SUITE_END();
  131. * public:
  132. * void testAdd();
  133. * void testSub();
  134. * };
  135. * \endcode
  136. *
  137. * \param ATestFixtureType Type of the test case class. This type \b MUST
  138. * be derived from TestFixture.
  139. * \param ASuperClass Type of the parent class.
  140. * \see CPPUNIT_TEST_SUITE.
  141. */
  142. #define CPPUNIT_TEST_SUB_SUITE( ATestFixtureType, ASuperClass ) \
  143. public: \
  144. typedef ASuperClass ParentTestFixtureType; \
  145. private: \
  146. CPPUNIT_TEST_SUITE( ATestFixtureType ); \
  147. ParentTestFixtureType::addTestsToSuite( baseContext )
  148. /*! \brief End declaration of the test suite.
  149. *
  150. * After this macro, member access is set to "private".
  151. *
  152. * \see CPPUNIT_TEST_SUITE.
  153. * \see CPPUNIT_TEST_SUITE_REGISTRATION.
  154. */
  155. #define CPPUNIT_TEST_SUITE_END() \
  156. } \
  157. \
  158. static CPPUNIT_NS::TestSuite *suite() \
  159. { \
  160. const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \
  161. std::auto_ptr<CPPUNIT_NS::TestSuite> suite( \
  162. new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \
  163. CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \
  164. CPPUNIT_NS::TestSuiteBuilderContextBase context( *suite.get(), \
  165. namer, \
  166. factory ); \
  167. TestFixtureType::addTestsToSuite( context ); \
  168. return suite.release(); \
  169. } \
  170. private: /* dummy typedef so that the macro can still end with ';'*/ \
  171. typedef int CppUnitDummyTypedefForSemiColonEnding__
  172. /*! \brief End declaration of an abstract test suite.
  173. *
  174. * Use this macro to indicate that the %TestFixture is abstract. No
  175. * static suite() method will be declared.
  176. *
  177. * After this macro, member access is set to "private".
  178. *
  179. * Here is an example of usage:
  180. *
  181. * The abstract test fixture:
  182. * \code
  183. * #include <cppunit/extensions/HelperMacros.h>
  184. * class AbstractDocument;
  185. * class AbstractDocumentTest : public CppUnit::TestFixture {
  186. * CPPUNIT_TEST_SUITE( AbstractDocumentTest );
  187. * CPPUNIT_TEST( testInsertText );
  188. * CPPUNIT_TEST_SUITE_END_ABSTRACT();
  189. * public:
  190. * void testInsertText();
  191. *
  192. * void setUp()
  193. * {
  194. * m_document = makeDocument();
  195. * }
  196. *
  197. * void tearDown()
  198. * {
  199. * delete m_document;
  200. * }
  201. * protected:
  202. * virtual AbstractDocument *makeDocument() =0;
  203. *
  204. * AbstractDocument *m_document;
  205. * };\endcode
  206. *
  207. * The concret test fixture:
  208. * \code
  209. * class RichTextDocumentTest : public AbstractDocumentTest {
  210. * CPPUNIT_TEST_SUB_SUITE( RichTextDocumentTest, AbstractDocumentTest );
  211. * CPPUNIT_TEST( testInsertFormatedText );
  212. * CPPUNIT_TEST_SUITE_END();
  213. * public:
  214. * void testInsertFormatedText();
  215. * protected:
  216. * AbstractDocument *makeDocument()
  217. * {
  218. * return new RichTextDocument();
  219. * }
  220. * };\endcode
  221. *
  222. * \see CPPUNIT_TEST_SUB_SUITE.
  223. * \see CPPUNIT_TEST_SUITE_REGISTRATION.
  224. */
  225. #define CPPUNIT_TEST_SUITE_END_ABSTRACT() \
  226. } \
  227. private: /* dummy typedef so that the macro can still end with ';'*/ \
  228. typedef int CppUnitDummyTypedefForSemiColonEnding__
  229. /*! \brief Add a test to the suite (for custom test macro).
  230. *
  231. * The specified test will be added to the test suite being declared. This macro
  232. * is intended for \e advanced usage, to extend %CppUnit by creating new macro such
  233. * as CPPUNIT_TEST_EXCEPTION()...
  234. *
  235. * Between macro CPPUNIT_TEST_SUITE() and CPPUNIT_TEST_SUITE_END(), you can assume
  236. * that the following variables can be used:
  237. * \code
  238. * typedef TestSuiteBuilder<TestFixtureType> TestSuiteBuilderType;
  239. * TestSuiteBuilderType &context;
  240. * \endcode
  241. *
  242. * \c context can be used to name test case, create new test fixture instance,
  243. * or add test case to the test fixture suite.
  244. *
  245. * Below is an example that show how to use this macro to create new macro to add
  246. * test to the fixture suite. The macro below show how you would add a new type
  247. * of test case which fails if the execution last more than a given time limit.
  248. * It relies on an imaginary TimeOutTestCaller class which has an interface similar
  249. * to TestCaller.
  250. *
  251. * \code
  252. * #define CPPUNITEX_TEST_TIMELIMIT( testMethod, timeLimit ) \
  253. * CPPUNIT_TEST_SUITE_ADD_TEST( (new TimeOutTestCaller<TestFixtureType>( \
  254. * namer.getTestNameFor( #testMethod ), \
  255. * &TestFixtureType::testMethod, \
  256. * factory.makeFixture(), \
  257. * timeLimit ) ) )
  258. *
  259. * class PerformanceTest : CppUnit::TestFixture
  260. * {
  261. * public:
  262. * CPPUNIT_TEST_SUITE( PerformanceTest );
  263. * CPPUNITEX_TEST_TIMELIMIT( testSortReverseOrder, 5.0 );
  264. * CPPUNIT_TEST_SUITE_END();
  265. *
  266. * void testSortReverseOrder();
  267. * };
  268. * \endcode
  269. *
  270. * \param test Test to add to the suite. Must be a subclass of Test. The test name
  271. * should have been obtained using TestNamer::getTestNameFor().
  272. */
  273. #define CPPUNIT_TEST_SUITE_ADD_TEST( test ) \
  274. context.addTest( test )
  275. /*! \brief Add a method to the suite.
  276. * \param testMethod Name of the method of the test case to add to the
  277. * suite. The signature of the method must be of
  278. * type: void testMethod();
  279. * \see CPPUNIT_TEST_SUITE.
  280. */
  281. #define CPPUNIT_TEST( testMethod ) \
  282. CPPUNIT_TEST_SUITE_ADD_TEST( \
  283. ( new CPPUNIT_NS::TestCaller<TestFixtureType>( \
  284. context.getTestNameFor( #testMethod), \
  285. &TestFixtureType::testMethod, \
  286. context.makeFixture() ) ) )
  287. /*! \brief Add a test which fail if the specified exception is not caught.
  288. *
  289. * Example:
  290. * \code
  291. * #include <cppunit/extensions/HelperMacros.h>
  292. * #include <vector>
  293. * class MyTest : public CppUnit::TestFixture {
  294. * CPPUNIT_TEST_SUITE( MyTest );
  295. * CPPUNIT_TEST_EXCEPTION( testVectorAtThrow, std::invalid_argument );
  296. * CPPUNIT_TEST_SUITE_END();
  297. * public:
  298. * void testVectorAtThrow()
  299. * {
  300. * std::vector<int> v;
  301. * v.at( 1 ); // must throw exception std::invalid_argument
  302. * }
  303. * };
  304. * \endcode
  305. *
  306. * \param testMethod Name of the method of the test case to add to the suite.
  307. * \param ExceptionType Type of the exception that must be thrown by the test
  308. * method.
  309. * \deprecated Use the assertion macro CPPUNIT_ASSERT_THROW instead.
  310. */
  311. #define CPPUNIT_TEST_EXCEPTION( testMethod, ExceptionType ) \
  312. CPPUNIT_TEST_SUITE_ADD_TEST( \
  313. (new CPPUNIT_NS::ExceptionTestCaseDecorator< ExceptionType >( \
  314. new CPPUNIT_NS::TestCaller< TestFixtureType >( \
  315. context.getTestNameFor( #testMethod ), \
  316. &TestFixtureType::testMethod, \
  317. context.makeFixture() ) ) ) )
  318. /*! \brief Adds a test case which is excepted to fail.
  319. *
  320. * The added test case expect an assertion to fail. You usually used that type
  321. * of test case when testing custom assertion macros.
  322. *
  323. * \code
  324. * CPPUNIT_TEST_FAIL( testAssertFalseFail );
  325. *
  326. * void testAssertFalseFail()
  327. * {
  328. * CPPUNIT_ASSERT( false );
  329. * }
  330. * \endcode
  331. * \see CreatingNewAssertions.
  332. * \deprecated Use the assertion macro CPPUNIT_ASSERT_ASSERTION_FAIL instead.
  333. */
  334. #define CPPUNIT_TEST_FAIL( testMethod ) \
  335. CPPUNIT_TEST_EXCEPTION( testMethod, CPPUNIT_NS::Exception )
  336. /*! \brief Adds some custom test cases.
  337. *
  338. * Use this to add one or more test cases to the fixture suite. The specified
  339. * method is called with a context parameter that can be used to name,
  340. * instantiate fixture, and add instantiated test case to the fixture suite.
  341. * The specified method must have the following signature:
  342. * \code
  343. * static void aMethodName( TestSuiteBuilderContextType &context );
  344. * \endcode
  345. *
  346. * \c TestSuiteBuilderContextType is typedef to
  347. * TestSuiteBuilderContext<TestFixtureType> declared by CPPUNIT_TEST_SUITE().
  348. *
  349. * Here is an example that add two custom tests:
  350. *
  351. * \code
  352. * #include <cppunit/extensions/HelperMacros.h>
  353. *
  354. * class MyTest : public CppUnit::TestFixture {
  355. * CPPUNIT_TEST_SUITE( MyTest );
  356. * CPPUNIT_TEST_SUITE_ADD_CUSTOM_TESTS( addTimeOutTests );
  357. * CPPUNIT_TEST_SUITE_END();
  358. * public:
  359. * static void addTimeOutTests( TestSuiteBuilderContextType &context )
  360. * {
  361. * context.addTest( new TimeOutTestCaller( context.getTestNameFor( "test1" ) ),
  362. * &MyTest::test1,
  363. * context.makeFixture(),
  364. * 5.0 );
  365. * context.addTest( new TimeOutTestCaller( context.getTestNameFor( "test2" ) ),
  366. * &MyTest::test2,
  367. * context.makeFixture(),
  368. * 5.0 );
  369. * }
  370. *
  371. * void test1()
  372. * {
  373. * // Do some test that may never end...
  374. * }
  375. *
  376. * void test2()
  377. * {
  378. * // Do some test that may never end...
  379. * }
  380. * };
  381. * \endcode
  382. * @param testAdderMethod Name of the method called to add the test cases.
  383. */
  384. #define CPPUNIT_TEST_SUITE_ADD_CUSTOM_TESTS( testAdderMethod ) \
  385. testAdderMethod( context )
  386. /*! \brief Adds a property to the test suite builder context.
  387. * \param APropertyKey Key of the property to add.
  388. * \param APropertyValue Value for the added property.
  389. * Example:
  390. * \code
  391. * CPPUNIT_TEST_SUITE_PROPERTY("XmlFileName", "paraTest.xml"); \endcode
  392. */
  393. #define CPPUNIT_TEST_SUITE_PROPERTY( APropertyKey, APropertyValue ) \
  394. context.addProperty( std::string(APropertyKey), \
  395. std::string(APropertyValue) )
  396. /** @}
  397. */
  398. /*! Adds the specified fixture suite to the unnamed registry.
  399. * \ingroup CreatingTestSuite
  400. *
  401. * This macro declares a static variable whose construction
  402. * causes a test suite factory to be inserted in a global registry
  403. * of such factories. The registry is available by calling
  404. * the static function CppUnit::TestFactoryRegistry::getRegistry().
  405. *
  406. * \param ATestFixtureType Type of the test case class.
  407. * \warning This macro should be used only once per line of code (the line
  408. * number is used to name a hidden static variable).
  409. * \see CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
  410. * \see CPPUNIT_REGISTRY_ADD_TO_DEFAULT
  411. * \see CPPUNIT_REGISTRY_ADD
  412. * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite,
  413. * CppUnit::TestFactoryRegistry.
  414. */
  415. #define CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ) \
  416. static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \
  417. CPPUNIT_MAKE_UNIQUE_NAME(autoRegisterRegistry__ )
  418. /** Adds the specified fixture suite to the specified registry suite.
  419. * \ingroup CreatingTestSuite
  420. *
  421. * This macro declares a static variable whose construction
  422. * causes a test suite factory to be inserted in the global registry
  423. * suite of the specified name. The registry is available by calling
  424. * the static function CppUnit::TestFactoryRegistry::getRegistry().
  425. *
  426. * For the suite name, use a string returned by a static function rather
  427. * than a hardcoded string. That way, you can know what are the name of
  428. * named registry and you don't risk mistyping the registry name.
  429. *
  430. * \code
  431. * // MySuites.h
  432. * namespace MySuites {
  433. * std::string math() {
  434. * return "Math";
  435. * }
  436. * }
  437. *
  438. * // ComplexNumberTest.cpp
  439. * #include "MySuites.h"
  440. *
  441. * CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ComplexNumberTest, MySuites::math() );
  442. * \endcode
  443. *
  444. * \param ATestFixtureType Type of the test case class.
  445. * \param suiteName Name of the global registry suite the test suite is
  446. * registered into.
  447. * \warning This macro should be used only once per line of code (the line
  448. * number is used to name a hidden static variable).
  449. * \see CPPUNIT_TEST_SUITE_REGISTRATION
  450. * \see CPPUNIT_REGISTRY_ADD_TO_DEFAULT
  451. * \see CPPUNIT_REGISTRY_ADD
  452. * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite,
  453. * CppUnit::TestFactoryRegistry..
  454. */
  455. #define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ATestFixtureType, suiteName ) \
  456. static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \
  457. CPPUNIT_MAKE_UNIQUE_NAME(autoRegisterRegistry__ )(suiteName)
  458. /*! Adds that the specified registry suite to another registry suite.
  459. * \ingroup CreatingTestSuite
  460. *
  461. * Use this macros to automatically create test registry suite hierarchy. For example,
  462. * if you want to create the following hierarchy:
  463. * - Math
  464. * - IntegerMath
  465. * - FloatMath
  466. * - FastFloat
  467. * - StandardFloat
  468. *
  469. * You can do this automatically with:
  470. * \code
  471. * CPPUNIT_REGISTRY_ADD( "FastFloat", "FloatMath" );
  472. * CPPUNIT_REGISTRY_ADD( "IntegerMath", "Math" );
  473. * CPPUNIT_REGISTRY_ADD( "FloatMath", "Math" );
  474. * CPPUNIT_REGISTRY_ADD( "StandardFloat", "FloatMath" );
  475. * \endcode
  476. *
  477. * There is no specific order of declaration. Think of it as declaring links.
  478. *
  479. * You register the test in each suite using CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.
  480. *
  481. * \param which Name of the registry suite to add to the registry suite named \a to.
  482. * \param to Name of the registry suite \a which is added to.
  483. * \see CPPUNIT_REGISTRY_ADD_TO_DEFAULT, CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.
  484. */
  485. #define CPPUNIT_REGISTRY_ADD( which, to ) \
  486. static CPPUNIT_NS::AutoRegisterRegistry \
  487. CPPUNIT_MAKE_UNIQUE_NAME( autoRegisterRegistry__ )( which, to )
  488. /*! Adds that the specified registry suite to the default registry suite.
  489. * \ingroup CreatingTestSuite
  490. *
  491. * This macro is just like CPPUNIT_REGISTRY_ADD except the specified registry
  492. * suite is added to the default suite (root suite).
  493. *
  494. * \param which Name of the registry suite to add to the default registry suite.
  495. * \see CPPUNIT_REGISTRY_ADD.
  496. */
  497. #define CPPUNIT_REGISTRY_ADD_TO_DEFAULT( which ) \
  498. static CPPUNIT_NS::AutoRegisterRegistry \
  499. CPPUNIT_MAKE_UNIQUE_NAME( autoRegisterRegistry__ )( which )
  500. // Backwards compatibility
  501. // (Not tested!)
  502. #if CPPUNIT_ENABLE_CU_TEST_MACROS
  503. #define CU_TEST_SUITE(tc) CPPUNIT_TEST_SUITE(tc)
  504. #define CU_TEST_SUB_SUITE(tc,sc) CPPUNIT_TEST_SUB_SUITE(tc,sc)
  505. #define CU_TEST(tm) CPPUNIT_TEST(tm)
  506. #define CU_TEST_SUITE_END() CPPUNIT_TEST_SUITE_END()
  507. #define CU_TEST_SUITE_REGISTRATION(tc) CPPUNIT_TEST_SUITE_REGISTRATION(tc)
  508. #endif
  509. #endif // CPPUNIT_EXTENSIONS_HELPERMACROS_H