From 8835737a30a6d9c20114758f82124887fd423458 Mon Sep 17 00:00:00 2001 From: florent <florent@laas.fr> Date: Fri, 17 Dec 2010 08:58:17 +0100 Subject: [PATCH] Add a test to check Value assignment operator. * unitTesting/CMakeLists.txt, * unitTesting/test-value.cpp: new. --- unitTesting/CMakeLists.txt | 7 +++--- unitTesting/test-value.cpp | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 unitTesting/test-value.cpp diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt index 96a4ebc..b4d4da6 100644 --- a/unitTesting/CMakeLists.txt +++ b/unitTesting/CMakeLists.txt @@ -20,7 +20,8 @@ include_directories(${Boost_INCLUDE_DIRS}) SET(tests_exe test_pool test_depend - test_signalcast) + test_signalcast + test-value) SET(tests_libs test_signalcast_libA @@ -40,7 +41,7 @@ FOREACH(test_name ${tests_libs}) ADD_LIBRARY(${LIBRARY_NAME} SHARED ${test_name}.cpp) - + PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} jrl-mal) TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${PROJECT_NAME}) ADD_DEPENDENCIES(${LIBRARY_NAME} @@ -57,7 +58,7 @@ FOREACH(test_name ${tests_exe}) ${PROJECT_NAME}) ADD_DEPENDENCIES(${EXECUTABLE_NAME} ${PROJECT_NAME}) - + PKG_CONFIG_USE_DEPENDENCY(${EXECUTABLE_NAME} jrl-mal) TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${${test_name}_additional_libs}) diff --git a/unitTesting/test-value.cpp b/unitTesting/test-value.cpp new file mode 100644 index 0000000..381c0d4 --- /dev/null +++ b/unitTesting/test-value.cpp @@ -0,0 +1,45 @@ +/* + * Copyright 2010, + * Florent Lamiraux + * + * CNRS/LAAS + * + * This file is part of dynamic-graph. + * dynamic-graph is free software: you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * dynamic-graph is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. You should + * have received a copy of the GNU Lesser General Public License along + * with dynamic-graph. If not, see <http://www.gnu.org/licenses/>. + */ + +/* -------------------------------------------------------------------------- */ +/* --- INCLUDES ------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +#include <iostream> +#include "dynamic-graph/value.h" + +int main() +{ + using dynamicgraph::command::Value; + + std::string str1("value #1"); + Value value1(str1); + Value value = value1; + + std::cout << "value1 = " << value1 << std::endl; + std::cout << "value = " << value << std::endl; + + std::string str2("value #2"); + Value value2(str2); + value = value2; + + std::cout << "value2 = " << value2 << std::endl; + std::cout << "value = " << value << std::endl; + +} -- GitLab