Changeset 119:dbd5fde00165 in finroc_plugins_blackboard


Ignore:
Timestamp:
08.07.2014 17:17:36 (7 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Phase:
public
Message:

Updated make.xml and transformed programs in former 'test' directory to unit tests

Files:
1 added
2 deleted
1 edited
7 moved

Legend:

Unmodified
Added
Removed
  • make.xml

    r101 r119  
    1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 
     1<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE targets PUBLIC "-//RRLIB//DTD make 14.05" "http://finroc.org/xml/14.05/make.dtd"> 
    23<targets> 
    3   <finrocplugin> 
     4  <library> 
    45    <sources> 
    56      *.h 
    67      internal/** 
    78    </sources> 
    8   </finrocplugin> 
     9  </library> 
    910</targets> 
  • tests/mBlackboardReader.cpp

    r102 r119  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    plugins/blackboard/test/mBlackboardReader.cpp 
     22/*!\file    plugins/blackboard/tests/mBlackboardReader.cpp 
    2323 * 
    2424 * \author  Max Reichardt 
     
    2828 */ 
    2929//---------------------------------------------------------------------- 
    30 #include "plugins/blackboard/test/mBlackboardReader.h" 
     30#include "plugins/blackboard/tests/mBlackboardReader.h" 
    3131 
    3232//---------------------------------------------------------------------- 
     
    8585    // Acquire read lock 
    8686    tBlackboardClient<float>::tReadAccess acc(bb_client); 
     87    blackboard_content_copy.resize(acc.Size()); 
     88    for (size_t i = 0; i < acc.Size(); ++i) 
     89    { 
     90      blackboard_content_copy[i] = acc[i]; 
     91    } 
    8792 
    8893    // Print blackboard contents 
     
    9398      output << " " << acc[i]; 
    9499    } 
    95     FINROC_LOG_PRINT(USER, output.str()); 
     100    FINROC_LOG_PRINT(DEBUG_VERBOSE_1, output.str()); 
    96101  } 
    97   catch (tLockException& e) 
     102  catch (const tLockException& e) 
    98103  { 
    99     FINROC_LOG_PRINT(WARNING, "Could not lock blackboard"); 
     104    FINROC_LOG_PRINT(ERROR, "Could not lock blackboard: ", e); 
    100105  } 
    101106} 
  • tests/mBlackboardReader.h

    r111 r119  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    plugins/blackboard/test/mBlackboardReader.h 
     22/*!\file    plugins/blackboard/tests/mBlackboardReader.h 
    2323 * 
    2424 * \author  Max Reichardt 
     
    3232 */ 
    3333//---------------------------------------------------------------------- 
    34 #ifndef _blackboard__mBlackboardReader_h_ 
    35 #define _blackboard__mBlackboardReader_h_ 
    36  
    37 #include "plugins/structure/tModule.h" 
    38 #include "plugins/blackboard/tBlackboardClient.h" 
     34#ifndef __plugins__blackboard__tests__mBlackboardReader_h_ 
     35#define __plugins__blackboard__tests__mBlackboardReader_h_ 
    3936 
    4037//---------------------------------------------------------------------- 
    4138// External includes (system with <>, local with "") 
    4239//---------------------------------------------------------------------- 
     40#include "plugins/structure/tModule.h" 
     41#include "plugins/blackboard/tBlackboardClient.h" 
    4342 
    4443//---------------------------------------------------------------------- 
     
    6463// Class declaration 
    6564//---------------------------------------------------------------------- 
    66 //! Reads contents of blackboard and prints them to console. 
     65//! Reads contents of blackboard and copies them to local variable 
    6766class mBlackboardReader : public structure::tModule 
    6867{ 
    69   static runtime_construction::tStandardCreateModuleAction<mBlackboardReader> cCREATE_ACTION; 
    7068 
    7169//---------------------------------------------------------------------- 
     
    8381  mBlackboardReader(core::tFrameworkElement *parent, const std::string &name = "BlackboardReader"); 
    8482 
     83  /*! 
     84   * \return Copy of blackboard content 
     85   */ 
     86  const std::vector<float>& GetBlackboardCopy() 
     87  { 
     88    return blackboard_content_copy; 
     89  } 
     90 
    8591//---------------------------------------------------------------------- 
    8692// Private fields and methods 
    8793//---------------------------------------------------------------------- 
    8894private: 
     95 
     96  /*! Copy of blackboard content */ 
     97  std::vector<float> blackboard_content_copy; 
    8998 
    9099  virtual void Update() override; 
  • tests/mBlackboardWriter.cpp

    r102 r119  
    2828 */ 
    2929//---------------------------------------------------------------------- 
    30 #include "plugins/blackboard/test/mBlackboardWriter.h" 
     30#include "plugins/blackboard/tests/mBlackboardWriter.h" 
    3131 
    3232//---------------------------------------------------------------------- 
     
    9898    } 
    9999  } 
    100   catch (tLockException& e) 
     100  catch (const tLockException& e) 
    101101  { 
    102     FINROC_LOG_PRINT(WARNING, "Could not lock blackboard"); 
     102    FINROC_LOG_PRINT(ERROR, "Could not lock blackboard: ", e); 
    103103  } 
    104104  update_counter++; 
  • tests/mBlackboardWriter.h

    r111 r119  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    plugins/blackboard/test/mBlackboardWriter.h 
     22/*!\file    plugins/blackboard/tests/mBlackboardWriter.h 
    2323 * 
    2424 * \author  Max Reichardt 
     
    3232 */ 
    3333//---------------------------------------------------------------------- 
    34 #ifndef _blackboard__mBlackboardWriter_h_ 
    35 #define _blackboard__mBlackboardWriter_h_ 
    36  
    37 #include "plugins/structure/tModule.h" 
    38 #include "plugins/blackboard/tBlackboardClient.h" 
     34#ifndef __plugins__blackboard__tests__mBlackboardWriter_h_ 
     35#define __plugins__blackboard__tests__mBlackboardWriter_h_ 
    3936 
    4037//---------------------------------------------------------------------- 
    4138// External includes (system with <>, local with "") 
    4239//---------------------------------------------------------------------- 
     40#include "plugins/structure/tModule.h" 
     41#include "plugins/blackboard/tBlackboardClient.h" 
    4342 
    4443//---------------------------------------------------------------------- 
     
    6766class mBlackboardWriter : public structure::tModule 
    6867{ 
    69   static runtime_construction::tStandardCreateModuleAction<mBlackboardWriter> cCREATE_ACTION; 
    7068 
    7169//---------------------------------------------------------------------- 
  • tests/mBlackboardWriterAsync.cpp

    r102 r119  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    plugins/blackboard/test/mBlackboardWriterAsync.cpp 
     22/*!\file    plugins/blackboard/tests/mBlackboardWriterAsync.cpp 
    2323 * 
    2424 * \author  Max Reichardt 
     
    2828 */ 
    2929//---------------------------------------------------------------------- 
    30 #include "plugins/blackboard/test/mBlackboardWriterAsync.h" 
     30#include "plugins/blackboard/tests/mBlackboardWriterAsync.h" 
    3131 
    3232//---------------------------------------------------------------------- 
  • tests/mBlackboardWriterAsync.h

    r111 r119  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    plugins/blackboard/test/mBlackboardWriterAsync.h 
     22/*!\file    plugins/blackboard/tests/mBlackboardWriterAsync.h 
    2323 * 
    2424 * \author  Max Reichardt 
     
    3232 */ 
    3333//---------------------------------------------------------------------- 
    34 #ifndef _blackboard__mBlackboardWriterAsync_h_ 
    35 #define _blackboard__mBlackboardWriterAsync_h_ 
    36  
    37 #include "plugins/structure/tModule.h" 
    38 #include "plugins/blackboard/tBlackboardClient.h" 
     34#ifndef __plugins__blackboard__tests__mBlackboardWriterAsync_h_ 
     35#define __plugins__blackboard__tests__mBlackboardWriterAsync_h_ 
    3936 
    4037//---------------------------------------------------------------------- 
    4138// External includes (system with <>, local with "") 
    4239//---------------------------------------------------------------------- 
     40#include "plugins/structure/tModule.h" 
     41#include "plugins/blackboard/tBlackboardClient.h" 
    4342 
    4443//---------------------------------------------------------------------- 
     
    7170class mBlackboardWriterAsync : public structure::tModule 
    7271{ 
    73   static runtime_construction::tStandardCreateModuleAction<mBlackboardWriterAsync> cCREATE_ACTION; 
    7472 
    7573//---------------------------------------------------------------------- 
  • tests/make.xml

    r101 r119  
    1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 
     1<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE targets PUBLIC "-//RRLIB//DTD make 14.05" "http://finroc.org/xml/14.05/make.dtd"> 
    23<targets> 
    34 
    4   <finroclibrary name="test_modules"> 
     5  <library name="test_modules"> 
    56    <sources> 
    67      m*.cpp 
    78    </sources> 
    8   </finroclibrary> 
     9  </library> 
    910 
    10   <testprogram name=""> 
     11  <program> 
    1112    <sources> 
    12       pBlackboardTest.cpp 
     13      blackboard_test.cpp 
    1314    </sources> 
    14   </testprogram> 
    15  
    16   <testprogram name="connecting"> 
    17     <sources> 
    18       pBlackboardConnectionTest.cpp 
    19     </sources> 
    20   </testprogram> 
     15  </program> 
    2116 
    2217</targets> 
Note: See TracChangeset for help on using the changeset viewer.