Commit 08ac4a9b authored by Giuseppe Carboni's avatar Giuseppe Carboni
Browse files

Fix #684, fixed tests for the SRTMinorServoCommandLibrary and its python wrapper (#685)

parent e35b20d0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -35,11 +35,11 @@ USER_CFLAGS = -Wall
# C programs (public and local)
# -----------------------------
EXECUTABLES     =
EXECUTABLES_L   = TestSRTMinorServoCommandLibrary
EXECUTABLES_L   =

TestSRTMinorServoCommandLibrary_OBJECTS   = TestSRTMinorServoCommandLibrary
TestSRTMinorServoCommandLibrary_CFLAGS    = -std=c++0x
TestSRTMinorServoCommandLibrary_LIBS      = SRTMinorServoCommandLibrary IRALibrary
xxxxx_OBJECTS   =
xxxxx_CFLAGS    =
xxxxx_LIBS      =

#
# <brief description of xxxxx program>
+0 −27
Original line number Diff line number Diff line
#include <iostream>
#include <IRA>
#include "SRTMinorServoCommandLibrary.h"

using namespace IRA;

int main(void)
{
    // Skipping std::endl since the protocol adds a \n already
    std::cout << SRTMinorServoCommandLibrary::status();
    std::cout << SRTMinorServoCommandLibrary::status("SRP");
    std::cout << SRTMinorServoCommandLibrary::setup("CCB");
    std::cout << SRTMinorServoCommandLibrary::stow("PFP");
    std::cout << SRTMinorServoCommandLibrary::stow("PFP", 1);
    std::cout << SRTMinorServoCommandLibrary::stop("PFP");
    std::cout << SRTMinorServoCommandLibrary::preset("PFP", std::vector<double>{0.,1.,2.,3.,4.,5.});

    double start_time = CIRATools::getUNIXEpoch() + 3;
    long unsigned int trajectory_id = (long unsigned int)(start_time * 1000);
    std::cout << SRTMinorServoCommandLibrary::programTrack("PFP", trajectory_id, 0, std::vector<double>{0.,1.,2.,3.,4.,5.}, start_time);
    for(unsigned int i = 1; i < 10; i++)
    {
        std::cout << SRTMinorServoCommandLibrary::programTrack("PFP", trajectory_id, i, std::vector<double>{0.,1.,2.,3.,4.,5.});
    }

    std::cout << SRTMinorServoCommandLibrary::offset("PFP", std::vector<double>{0.,1.,2.,3.,4.,5.});
}
+5 −0
Original line number Diff line number Diff line
This file is here to differentiate between ACS style test directory and discos-style test. 

This is a discos test directory

DO NOT REMOVE THIS FILE
+91 −0
Original line number Diff line number Diff line
# CPP UNIT TESTING SETUP
#--------------
GTEST_HOME=/usr/local/include/gtest
GMOCK_HOME=/usr/local/include/gmock
GTEST_LIBS=gtest gtest_main

USER_INC=-I$(GTEST_HOME) -I$(GMOCK_HOME)
# END OF CPP UNIT TESTING SETUP
#---------------------

# DEFINE YOUR CPP UNIT TEST EXECUTABLES HERE as:
#
# EXECTUABLES_L = unittest
# unittest_OBJECTS = unittest
# unittest_LIBS = $(GTEST_LIBS) <ComponentNameImpl>

EXECUTABLES_L = unittest
unittest_OBJECTS = unittest
unittest_CFLAGS = -std=c++0x
unittest_LIBS = $(GTEST_LIBS) SRTMinorServoCommandLibrary IRALibrary
unittest_LDFLAGS = -lstdc++ -lpthread

# END OF CUSTOMIZATION
# do not edit below this line
#----------------------------

CSOURCENAMES = \
	$(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \
	$(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \
	$(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS))

MAKEDIRTMP := $(shell searchFile include/acsMakefile)
ifneq ($(MAKEDIRTMP),\#error\#)
   MAKEDIR := $(MAKEDIRTMP)/include
   include $(MAKEDIR)/acsMakefile
endif

# TEST TARGETS
#TODO: unittest(2) discover pyunit

do_unit: all
	@echo "running cpp unit tests"
	../bin/unittest --gtest_output=xml:results/cppunittest.xml

do_pyunit:
	@echo "running python unit tests"
	python -m unittest pyunit

do_functional:
	@echo "running python functional tests"
	python -m unittest functional

do_external:
	@echo "running python external tests"
	python -m unittest external

clean_test:
	rm -f results/*.xml
	rm -f functional/*.pyc
	rm -f pyunit/*.pyc
	rm -f external/*.pyc

unit: do_unit
	@echo " . . . 'unit' done"

pyunit: do_pyunit
	@echo " . . . 'pyunit' done"

functional: do_functional
	@echo " . . . 'functional' done"

external: do_external
	@echo " . . . 'external' done"

# TARGETS
# -------
all:	do_all
	@echo " . . . 'all' done" 

clean : clean_all clean_test
	@echo " . . . clean done"

clean_dist : clean_all clean_dist_all clean_test
	@echo " . . . clean_dist done"

man   : do_man 
	@echo " . . . man page(s) done"

install : install_all
	@echo " . . . installation done"
+0 −0

Empty file added.

Loading