Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
tests
dev_test.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
tag: Peter Soetens Mon Jan 10 15:59:51 CET 2005 dev_test.cpp
3
4
dev_test.cpp - description
5
-------------------
6
begin : Mon January 10 2005
7
copyright : (C) 2005 Peter Soetens
8
email : peter.soetens@mech.kuleuven.ac.be
9
10
***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18
19
#include "
unit.hpp
"
20
21
#include "
dev_test.hpp
"
22
#include "
FakeAnalogDevice.hpp
"
23
#include "
FakeDigitalDevice.hpp
"
24
#include <
extras/dev/AnalogInput.hpp
>
25
#include <
extras/dev/AnalogOutput.hpp
>
26
#include <
extras/dev/DigitalInput.hpp
>
27
#include <
extras/dev/DigitalOutput.hpp
>
28
29
30
#include <iostream>
31
32
using namespace
std
;
33
using namespace
RTT
;
34
35
void
36
DevTest::setUp
()
37
{
38
}
39
40
41
void
42
DevTest::tearDown
()
43
{
44
}
45
46
BOOST_FIXTURE_TEST_SUITE
( DevTestSuite,
DevTest
)
47
48
BOOST_AUTO_TEST_CASE
( testClasses)
49
{
50
bool
din_state =
true
;
51
DigitalInput
din(din_state,
false
);
// init, invert
52
DigitalOutput
dout(
false
);
// init.
53
AnalogInput
ain(0,0);
54
AnalogOutput
aout(0,0);
55
56
57
BOOST_CHECK( din.
isOn
() );
58
59
BOOST_CHECK( dout.
isOn
() ==
false
);
60
dout.
setBit
(
true
);
61
BOOST_CHECK( dout.
isOn
() ==
true
);
62
dout.
setBit
(
false
);
63
BOOST_CHECK( dout.
isOn
() ==
false
);
64
}
65
66
BOOST_AUTO_TEST_CASE
( testNaming)
67
{
68
69
FakeAnalogDevice
fad;
70
FakeDigitalDevice
fdd;
71
72
AnalogInInterface
* aii = AnalogInInterface::nameserver.getObject(
"FakeAnalogDevice"
);
73
AnalogOutInterface
* aoi = AnalogOutInterface::nameserver.getObject(
"FakeAnalogDevice"
);
74
75
DigitalInInterface
* dii = DigitalInInterface::nameserver.getObject(
"FakeDigitalDevice"
);
76
DigitalOutInterface
* doi = DigitalOutInterface::nameserver.getObject(
"FakeDigitalDevice"
);
77
78
BOOST_CHECK( aii );
79
BOOST_CHECK( aoi );
80
BOOST_CHECK( dii );
81
BOOST_CHECK( doi );
82
83
}
84
BOOST_AUTO_TEST_SUITE_END
()
AnalogOutput.hpp
RTT::FakeAnalogDevice
Definition:
FakeAnalogDevice.hpp:41
BOOST_FIXTURE_TEST_SUITE
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
Definition:
unit_test_suite.hpp:53
RTT::dev::AnalogInInterface
Definition:
AnalogInInterface.hpp:68
RTT::dev::AnalogOutput
Definition:
AnalogOutput.hpp:54
DevTest
Definition:
dev_test.hpp:23
FakeDigitalDevice.hpp
DevTest::tearDown
void tearDown()
Definition:
dev_test.cpp:42
DigitalInput.hpp
BOOST_AUTO_TEST_SUITE_END
#define BOOST_AUTO_TEST_SUITE_END()
Definition:
unit_test_suite.hpp:62
RTT::dev::DigitalOutput::setBit
void setBit(bool on_off)
Definition:
DigitalOutput.hpp:88
std
Definition:
mystd.hpp:163
RTT::FakeDigitalDevice
Definition:
FakeDigitalDevice.hpp:42
RTT::dev::DigitalInput
Definition:
DigitalInput.hpp:54
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(testClasses)
Definition:
dev_test.cpp:48
RTT::dev::DigitalOutput
Definition:
DigitalOutput.hpp:55
unit.hpp
RTT::dev::AnalogOutInterface
Definition:
AnalogOutInterface.hpp:68
RTT::dev::DigitalOutput::isOn
bool isOn() const
Definition:
DigitalOutput.hpp:123
AnalogInput.hpp
DigitalOutput.hpp
FakeAnalogDevice.hpp
dev_test.hpp
DevTest::setUp
void setUp()
Definition:
dev_test.cpp:36
RTT::dev::DigitalInInterface
Definition:
DigitalInInterface.hpp:56
RTT
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition:
Activity.cpp:53
RTT::dev::AnalogInput
Definition:
AnalogInput.hpp:51
RTT::dev::DigitalOutInterface
Definition:
DigitalOutInterface.hpp:58
RTT::dev::DigitalInput::isOn
bool isOn() const
Definition:
DigitalInput.hpp:93
rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:32