- add initial version of unittest.
Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: Ib295df2a23c0dbac59adc3e6a72f48d9a0e2aa1e
ACLOCAL_AMFLAGS='-I m4'
SUBDIRS = src
+if IS_TESTS
+SUBDIRS += unittest
+endif
pcfiles = mm-wfd.pc
pkgconfigdir = $(libdir)/pkgconfig
m4_pattern_allow([AM_PROG_AR])
AM_PROG_AR
AC_PROG_CC
+AC_PROG_CXX
AC_PROG_LIBTOOL
AC_FUNC_MMAP
AC_HEADER_STDC
AC_HEADER_TIME
AC_PROG_GCC_TRADITIONAL
+AC_SUBST(GCC_CXXFLAGS)
# Checks for libraries.
AC_SUBST(CAPI_SYSTEM_INFO_CFLAGS)
AC_SUBST(CAPI_SYSTEM_INFO_LIBS)
+AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [unittest build]),
+ [
+ case "${enableval}" in
+ yes) IS_TESTS=yes ;;
+ no) IS_TESTS=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
+ esac
+ ],
+[IS_TESTS=no])
+AM_CONDITIONAL([IS_TESTS], [test "x$IS_TESTS" = "xyes"])
+
+AS_IF([test "x$enable_tests" = "xyes"], [
+ PKG_CHECK_MODULES(GTESTS, gmock)
+ AC_SUBST(GTESTS_CFLAGS)
+ AC_SUBST(GTESTS_LIBS)
+])
+
# for testsuite
AC_ARG_ENABLE(sdk, AC_HELP_STRING([--enable-sdk], [sdk build]),
AC_CONFIG_FILES([Makefile
src/Makefile
+ unittest/Makefile
mm-wfd.pc
])
AC_OUTPUT
Name: libmm-wfd
Summary: Multimedia Framework Wifi-Display Library
-Version: 0.2.237
+Version: 0.2.238
Release: 0
Group: System/Libraries
License: Apache-2.0
BuildRequires: pkgconfig(libtbm)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(capi-system-info)
+%if 0%{?gtests:1}
+BuildRequires: pkgconfig(gmock)
+%endif
+
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
# always enable sdk build. This option should go away
# --enable-wfd-sink-uibc
-%configure --disable-static
+%configure \
+%if 0%{?gtests:1}
+--enable-tests \
+%endif
+--disable-static
# Call make instruction with smp support
make %{?jobs:-j%jobs}
%{_libdir}/*.so.*
%manifest libmm-wfd.manifest
%license LICENSE.APLv2.0
+%if 0%{?gtests:1}
+%{_bindir}/gtest-libmm-wfd
+%endif
%files devel
%defattr(-,root,root,-)
--- /dev/null
+bin_PROGRAMS = gtest-libmm-wfd
+
+gtest_libmm_wfd_SOURCES = libmm_wfd_unittest.cpp
+
+gtest_libmm_wfd_CXXFLAGS = -I$(top_srcdir)/src/include \
+ $(GTESTS_CFLAGS)
+
+gtest_libmm_wfd_DEPENDENCIES = $(top_srcdir)/src/libmmfwfdsink.la
+
+gtest_libmm_wfd_LDADD = \
+ $(GTESTS_LIBS) \
+ $(top_srcdir)/src/libmmfwfdsink.la
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "libmm_wfd_unittest.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+
+class libmm_wfd_Test : public ::testing::Test {
+ protected:
+ void SetUp() {
+ std::cout << "SetUp()" << std::endl;
+ }
+
+ void TearDown() {
+ std::cout << "TearDown()" << std::endl;
+ }
+};
+
+TEST(libmm_wfdTest, __wfd_get_fourcc_p1)
+{
+ EXPECT_EQ(1, 1);
+}
+
+int main(int argc, char **argv)
+{
+ InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LIB_MM_WFD_UNITTEST_H__
+#define __LIB_MM_WFD_UNITTEST_H__
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#undef LOG_TAG
+#define LOG_TAG "GTEST_LIBMM_WFD"
+
+#endif /*__LIB_MM_WFD_UNITTEST_H__*/