From: Johannes Schanda Date: Wed, 16 Jan 2013 14:16:24 +0000 (+0100) Subject: Compile tests for variant output stream X-Git-Tag: genivi_release_2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20ae025e142e3b70e9aea7c404a51f8d9f19efff;p=profile%2Fivi%2Fcommon-api-dbus-runtime.git Compile tests for variant output stream --- diff --git a/Makefile.am b/Makefile.am index 7dba43b..fd93e1c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -86,7 +86,8 @@ TestInterfaceSources = \ check_PROGRAMS = \ DBusVariantTest \ - DBusTypeStreamTest + DBusTypeStreamTest \ + DBusVariantOutputStreamTest TESTS = ${check_PROGRAMS} @@ -101,6 +102,11 @@ DBusTypeStreamTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS} DBusTypeStreamTest_CXXFLAGS = ${GTEST_CXXFLAGS} DBusTypeStreamTest_LDADD = ${LDADD} ${GTEST_LIBS} libCommonAPI-DBus.la +DBusVariantOutputStreamTest_SOURCES = src/test/DBusVariantOutputStreamTest.cpp +DBusVariantOutputStreamTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS} +DBusVariantOutputStreamTest_CXXFLAGS = ${GTEST_CXXFLAGS} +DBusVariantOutputStreamTest_LDADD = ${LDADD} ${GTEST_LIBS} libCommonAPI-DBus.la + endif diff --git a/src/test/DBusVariantOutputStreamTest.cpp b/src/test/DBusVariantOutputStreamTest.cpp new file mode 100644 index 0000000..37001cd --- /dev/null +++ b/src/test/DBusVariantOutputStreamTest.cpp @@ -0,0 +1,57 @@ +/* Copyright (C) 2013 BMW Group + * Author: Manfred Bathelt (manfred.bathelt@bmw.de) + * Author: Juergen Gehring (juergen.gehring@bmw.de) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include +#include +#include + +using namespace CommonAPI; + +class VariantOutputStreamTest: public ::testing::Test { + protected: + size_t numOfElements; + CommonAPI::DBus::DBusMessage message; + const char* busName; + const char* objectPath; + const char* interfaceName; + const char* methodName; + + void SetUp() { + numOfElements = 10; + busName = "no.bus.here"; + objectPath = "/no/object/here"; + interfaceName = "no.interface.here"; + methodName = "noMethodHere"; + } + + void TearDown() { + } + +}; + +TEST_F(VariantOutputStreamTest, CanBeCalled) { + const char* signature = "yyyyyyyyyy"; + message = CommonAPI::DBus::DBusMessage::createMethodCall(busName, objectPath, interfaceName, methodName, signature); + DBus::DBusOutputStream outputStream(message); + + + int baseInt = 1; + std::string baseString = "abc"; + Variant primitiveVariant(baseInt); + Variant stringVariant(baseString); + Variant > layeredVariant(stringVariant); + + outputStream << primitiveVariant; + outputStream << stringVariant; + outputStream << layeredVariant; + +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}