test_devsteer.cc
Go to the documentation of this file.
00001 /*
00002  *  ART steering servo controller device interface unit test
00003  *
00004  *  Copyright (C) 2008 Austin Robot Technology
00005  *  License: Modified BSD Software License Agreement
00006  *
00007  *  $Id: test_devsteer.cc 1161 2011-03-26 02:10:49Z jack.oquin $
00008  */
00009 
00010 #include <gtest/gtest.h>
00011 #include "devsteer.h"
00012 
00013 void compare_ticks_and_degrees(int32_t center)
00014 {
00015   devsteer dev(center);                 // initializes center_ticks_
00016 
00017   EXPECT_EQ(0.0, dev.ticks2degrees(center));
00018   EXPECT_EQ(center, dev.degrees2ticks(0.0));
00019 
00020   for (int32_t tick = -300000; tick <= 300000; tick += 100)
00021     {
00022       EXPECT_EQ(tick, dev.degrees2ticks(dev.ticks2degrees(tick)));
00023     }
00024 }
00025 
00026 TEST(Conversions, ticks2degreesCentered)
00027 {
00028   compare_ticks_and_degrees(0);
00029 }
00030 
00031 TEST(Conversions, ticks2degreesOffsetLeft)
00032 {
00033   compare_ticks_and_degrees(-130);
00034 }
00035 
00036 TEST(Conversions, ticks2degreesOffsetRight)
00037 {
00038   compare_ticks_and_degrees(1024);
00039 }
00040 
00041 // Run all the tests that were declared with TEST()
00042 int main(int argc, char **argv)
00043 {
00044   testing::InitGoogleTest(&argc, argv);
00045   return RUN_ALL_TESTS();
00046 }


art_servo
Author(s): Austin Robot Technology, Jack O'Quin
autogenerated on Fri Jan 3 2014 11:09:12