MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/application/tests/SciPeripheralTestInitializer.cpp

94 lines
2.2 KiB
C++
Raw Normal View History

/*!\file
* \brief \todo Описание файла.
*/
/*
* SciPeripheralTest.cpp
*
* Created on: 17 июн. 2019 г.
* Author: titov
*/
//#include "SciPeripheralTest.hh"
//
//#include <cstring>
//#include <algorithm>
//
//bool application::tests::SciPeripheralTest::input( Environment & env ) {
//
// return grab( test_uart, env.rholder.getShared<peripheral::IUartPort>( links.uart_id ) );
//
//}
//
//bool application::tests::SciPeripheralTest::prepare() {
//
// if( step == quantity_cases )
// return true;
//
// switch(state) {
// case Send: {
//
// if( test_uart->send( cases[step].data, cases[step].size ) )
// state = WaitDataSent;
//
// } break;
// case WaitDataSent: {
//
// if( test_uart->isDataSent() )
// state= Receive;
//
// } break;
// case Receive: {
//
// char buff[test_size];
// if( test_uart->receive( buff, cases[step].size ) ) {
//
// if( 0 == std::strncmp( buff, cases[step].data, cases[step].size ) )
// pass++;
//
// step++;
//
// state = Send;
// }
//
// } break;
// default: { pass = quantity_cases + 1; step = quantity_cases; } break;
// }
//
// return false;
//}
//
//struct SequenseNumber {
//
// unsigned char current;
//
// SequenseNumber() : current(0) {}
// char operator()() {
// return current++;
// }
//};
//
//application::tests::SciPeripheralTest::SciPeripheralTest( const Links & links, const configuration::ProcessConfig & proc ) :
// links(links), proc(proc), test_uart(nullptr), state(Send), step(0), pass(0), cases(), test_buff() {
//
// std::generate_n( test_buff, test_size, SequenseNumber() );
//
// std::size_t test_part = test_size / quantity_cases;
//
// if( test_size % quantity_cases )
// throw "bad sci test";
//
// for( std::size_t i = 0; i < quantity_cases; ++i ) {
// Case & current_case(cases[i]);
//
// current_case.data = test_buff;
// current_case.size = ( i + 1 ) * test_part;
// }
//
//}
//
//void application::tests::SciPeripheralTest::build( Environment & env ) {
//
// release( env.rholder.getShared<peripheral::IUartPort>( links.uart_id ), test_uart );
//
//}