dev_test.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Peter Soetens  Mon Jan 10 15:59:51 CET 2005  dev_test.cpp
00003 
00004                         dev_test.cpp -  description
00005                            -------------------
00006     begin                : Mon January 10 2005
00007     copyright            : (C) 2005 Peter Soetens
00008     email                : peter.soetens@mech.kuleuven.ac.be
00009 
00010  ***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #include "unit.hpp"
00020 
00021 #include "dev_test.hpp"
00022 #include "FakeAnalogDevice.hpp"
00023 #include "FakeDigitalDevice.hpp"
00024 #include <extras/dev/AnalogInput.hpp>
00025 #include <extras/dev/AnalogOutput.hpp>
00026 #include <extras/dev/DigitalInput.hpp>
00027 #include <extras/dev/DigitalOutput.hpp>
00028 
00029 
00030 #include <iostream>
00031 
00032 using namespace std;
00033 using namespace RTT;
00034 
00035 void
00036 DevTest::setUp()
00037 {
00038 }
00039 
00040 
00041 void
00042 DevTest::tearDown()
00043 {
00044 }
00045 
00046 BOOST_FIXTURE_TEST_SUITE( DevTestSuite, DevTest )
00047 
00048 BOOST_AUTO_TEST_CASE( testClasses)
00049 {
00050     DigitalInput din(true, false); // init, invert
00051     DigitalOutput dout(false); // init.
00052     AnalogInput ain(0,0);
00053     AnalogOutput aout(0,0);
00054 
00055 
00056     BOOST_CHECK( din.isOn() );
00057 
00058     BOOST_CHECK( dout.isOn() == false);
00059     dout.setBit(true);
00060     BOOST_CHECK( dout.isOn() == true);
00061     dout.setBit(false);
00062     BOOST_CHECK( dout.isOn() == false);
00063 }
00064 
00065 BOOST_AUTO_TEST_CASE( testNaming)
00066 {
00067 
00068     FakeAnalogDevice fad;
00069     FakeDigitalDevice fdd;
00070 
00071     AnalogInInterface* aii = AnalogInInterface::nameserver.getObject("FakeAnalogDevice");
00072     AnalogOutInterface* aoi = AnalogOutInterface::nameserver.getObject("FakeAnalogDevice");
00073 
00074     DigitalInInterface* dii = DigitalInInterface::nameserver.getObject("FakeDigitalDevice");
00075     DigitalOutInterface* doi = DigitalOutInterface::nameserver.getObject("FakeDigitalDevice");
00076 
00077     BOOST_CHECK( aii );
00078     BOOST_CHECK( aoi );
00079     BOOST_CHECK( dii );
00080     BOOST_CHECK( doi );
00081 
00082 }
00083 BOOST_AUTO_TEST_SUITE_END()


rtt
Author(s): RTT Developers
autogenerated on Fri Sep 9 2016 04:01:52