peripherals  1.4.2
RoadNarrows Robotics Hardware Peripherals Package
ut-MotDummy.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Peripherals
4 //
5 /*! \file
6  *
7  * $LastChangedDate: 2013-02-13 16:41:34 -0700 (Wed, 13 Feb 2013) $
8  * $Rev: 2683 $
9  *
10  * \ingroup periphs_ut
11  *
12  * \brief Unit test for libmot roboteq-small motor controller
13  *
14  * \author Daniel Packard (daniel@roadnarrows.com)
15  *
16  * \copyright
17  * \h_copy 2013-2017. RoadNarrows LLC.\n
18  * http://www.roadnarrows.com\n
19  * All Rights Reserved
20  */
21 //
22 // Redistribution and use in source and binary forms, with or without
23 // modification, are permitted provided that the following conditions are met:
24 //
25 // 1. Redistributions of source code must retain the above copyright notice,
26 // this list of conditions and the following disclaimer.
27 //
28 // 2. Redistributions in binary form must reproduce the above copyright notice,
29 // this list of conditions and the following disclaimer in the documentation
30 // and/or other materials provided with the distribution.
31 //
32 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
36 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 // POSSIBILITY OF SUCH DAMAGE.
42 //
43 // The views and conclusions contained in the software and documentation are
44 // those of the authors and should not be interpreted as representing official
45 // policies, either expressed or implied, of the FreeBSD Project.
46 
47 #include <iostream>
48 #include <string>
49 #include <stdio.h>
50 
51 #include "rnr/rnrconfig.h"
52 #include "rnr/log.h"
53 #include "rnr/mot/MotDummy.h"
54 
55 #include <gtest/gtest.h>
56 
57 using namespace rnr;
58 /*!
59  * \ingroup periphs_ut
60  * \defgroup periphs_ut_libmot_roboteq_s Roboteq Small Unit Tests
61  * \brief Fine-grained testing of Roboteq Small motor controller
62  * \{
63  */
64 
65 /*!
66  * \brief Sanity test Roboteq-small interface.
67  *
68  * \return Returns 0 if test succeeds, else returns \h_lt 0.
69  */
71 {
72  MotDummy motor;
73  return motor.setSpeed(0, 0);
74 }
75 
76 TEST(MotDummy, setSpeed)
77 {
78  EXPECT_TRUE( testMotDummySetSpeed() == 0 );
79 }
80 
81 /*!
82  * \brief Sanity test Roboteq-small interface.
83  *
84  * \return Returns 0 if test succeeds, else returns \h_lt 0.
85  */
87 {
88  MotDummy motor;
89  int min,max,step;
90  int rc = motor.getAttrSpeed(&min, &max, &step);
91  printf("Speed Attributes = min:%d max:%d step:%d \n",min, max, step);
92 }
93 
94 TEST(MotDummy, getAttrSpeed)
95 {
96  EXPECT_TRUE( testMotDummyGetAttrSpeed() == 0 );
97 }
98 
99 #ifndef JENKINS
100 
101 // put tests that require human input here.
102 
103 #endif // JENKINS
104 
105 
106 /*!
107  * \}
108  */
static int testMotDummySetSpeed()
Sanity test Roboteq-small interface.
Definition: ut-MotDummy.cxx:70
static int testMotDummyGetAttrSpeed()
Sanity test Roboteq-small interface.
Definition: ut-MotDummy.cxx:86
Dummy Motor Controller Interface.
RoadNarrows Robotics standard namespace.
Definition: HID.h:65
TEST(Xbox360, XboxSanity)
Sanity test Xbox360 controller interface.