//***************************************************************************** // (C) Automotive Lighting Reutlingen GmbH // Tuebinger Strasse 123, 72762 Reutlingen, Germany // // Automotive Lighting Reutlingen GmbH owns all the rights to this work. // This work shall not be copied, reproduced, used, modified, transferred // or its information shall not be disclosed without the prior written // authorization of Automotive Lighting Reutlingen GmbH. //***************************************************************************** //----------------------------------------------------------------------------- /// \file Test.c /// /// \brief Unit Test Cases for StatM /// /// \author /// //----------------------------------------------------------------------------- //#include #include #include #include #include #include #include #include uint8 Mt_StatM_ucCycles; tieResetReason Mt_CddSbc_ResetReason; tisStatistics* psData; uint32 pApplicationDataTemperatureHistogram[108] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; tis32Temperature_mCelsius Mt_rSensPcbTemperature; //----------------------------------------------------------------------------- /// \Test Case : Mt_riStatMInit /// /// \Test Case Description /// - Test subject: /// To call riStatMInit function /// /// - Expected test results: /// - All conditions and assigned values mentioned for each test case/step shall be reached and passed /// //----------------------------------------------------------------------------- void Mt_riStatMInit(void) { //--------------------------------------------------------------------------- //Call the function under test //--------------------------------------------------------------------------- riStatMInit(); //--------------------------------------------------------------------------- // Evaluate test result //--------------------------------------------------------------------------- AL_UNITTEST_CHECK(Mt_StatM_ucCycles, 0u, == ); AL_UNITTEST_CHECK(Mt_CddSbc_ResetReason, 0U, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_StatM_01 /// /// \Test Case Description /// - Test subject: /// To call rpStatM100ms function /// /// - Expected test results: /// - All conditions and assigned values mentioned for each test case/step shall be reached and passed /// //----------------------------------------------------------------------------- void Mt_StatM_01(void) { Mt_StatM_ucCycles = 0u; Mt_CddSbc_ResetReason = 0u; //--------------------------------------------------------------------------- //Call the function under test //--------------------------------------------------------------------------- for (int i = 0; i < 12; i++) { rpStatM100ms(); //usleep(100*1000);//100ms } //--------------------------------------------------------------------------- // Evaluate test result //--------------------------------------------------------------------------- AL_UNITTEST_CHECK(Mt_StatM_ucCycles, 0u, == ); AL_UNITTEST_CHECK(Mt_CddSbc_ResetReason, 0U, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_StatM_Write_TemperatureHistograms /// /// \Test Case Description /// - Test subject: /// To call StatM_Write_TemperatureHistograms function /// /// - Expected test results: /// - All conditions and assigned values mentioned for each test case/step shall be reached and passed /// //----------------------------------------------------------------------------- void Mt_StatM_Write_TemperatureHistograms(void) { Mt_StatM_ucCycles = 5u; pApplicationDataTemperatureHistogram[0] = 1u; pApplicationDataTemperatureHistogram[1] = 2u; pApplicationDataTemperatureHistogram[2] = 3u; pApplicationDataTemperatureHistogram[3] = 4u; pApplicationDataTemperatureHistogram[4] = 5u; rpStatM100ms(); } //----------------------------------------------------------------------------- /// \Test Case : Mt_StatM_IncrementResetCounter /// /// \Test Case Description /// - Test subject: /// To call StatM_IncrementResetCounter function /// /// - Expected test results: /// - All conditions and assigned values mentioned for each test case/step shall be reached and passed /// //----------------------------------------------------------------------------- void Mt_StatM_IncrementResetCounter(void) { StatM_IncrementResetCounter(); } // ---------------------------------------------------------------------------- // Add Test Cases //----------------------------------------------------------------------------- void ALUnitTest_AddTests(void) { ALUnitTest_AddFunction("Mt_riStatMInit", Mt_riStatMInit); ALUnitTest_AddFunction("Mt_StatM_01", Mt_StatM_01); ALUnitTest_AddFunction("Mt_StatM_Write_TemperatureHistograms", Mt_StatM_Write_TemperatureHistograms); ALUnitTest_AddFunction("Mt_StatM_IncrementResetCounter", Mt_StatM_IncrementResetCounter); }