Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
37a95664
Commit
37a95664
authored
Jul 22, 2015
by
Thomas Markwalder
Browse files
[3929] Added basic unittests to src/lib/cfgrpt
parent
7eaa1ec0
Changes
6
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
37a95664
...
...
@@ -1442,6 +1442,7 @@ AC_CONFIG_FILES([compatcheck/Makefile
src/lib/cc/Makefile
src/lib/cc/tests/Makefile
src/lib/cfgrpt/Makefile
src/lib/cfgrpt/tests/Makefile
src/lib/config/Makefile
src/lib/config/tests/Makefile
src/lib/config/tests/data_def_unittests_config.h
...
...
src/lib/cfgrpt/Makefile.am
View file @
37a95664
SUBDIRS
=
.
tests
AM_CPPFLAGS
=
-I
$(top_srcdir)
/src/lib
-I
$(top_builddir)
/src/lib
# Get rid of generated message files on a clean
...
...
src/lib/cfgrpt/config_report.h
View file @
37a95664
...
...
@@ -15,6 +15,8 @@
#ifndef CONFIG_REPORT_H
#define CONFIG_REPORT_H
#include <string>
namespace
isc
{
namespace
detail
{
...
...
src/lib/cfgrpt/tests/Makefile.am
0 → 100644
View file @
37a95664
SUBDIRS
=
.
AM_CPPFLAGS
=
-I
$(top_builddir)
/src/lib
-I
$(top_srcdir)
/src/lib
AM_CPPFLAGS
+=
$(BOOST_INCLUDES)
AM_CPPFLAGS
+=
-DTEST_DATA_DIR
=
\"
$(abs_top_srcdir)
/src/lib/testutils/testdata
\"
AM_CPPFLAGS
+=
-DTEST_DATA_BUILDDIR
=
\"
$(abs_top_builddir)
/src/lib/config/tests
\"
AM_CXXFLAGS
=
$(KEA_CXXFLAGS)
if
USE_STATIC_LINK
AM_LDFLAGS
=
-static
endif
CLEANFILES
=
*
.gcno
*
.gcda
TESTS_ENVIRONMENT
=
\
$(LIBTOOL)
--mode
=
execute
$(VALGRIND_COMMAND)
TESTS
=
if
HAVE_GTEST
TESTS
+=
run_unittests
run_unittests_SOURCES
=
config_report_unittests.cc run_unittests.cc
run_unittests_CPPFLAGS
=
$(AM_CPPFLAGS)
$(GTEST_INCLUDES)
run_unittests_LDFLAGS
=
$(AM_LDFLAGS)
$(GTEST_LDFLAGS)
run_unittests_LDADD
=
$(GTEST_LDADD)
run_unittests_LDADD
+=
$(top_builddir)
/src/lib/cfgrpt/libcfgrpt.la
endif
noinst_PROGRAMS
=
$(TESTS)
src/lib/cfgrpt/tests/config_report_unittests.cc
0 → 100644
View file @
37a95664
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <cfgrpt/config_report.h>
#include <gtest/gtest.h>
using
namespace
isc
;
using
namespace
std
;
// This test verifies that the getConfigReport() function
// returns the actual config report.
TEST
(
ConfigReportTest
,
getConfigReport
)
{
// Fetch the report string
std
::
string
cfgReport
=
isc
::
detail
::
getConfigReport
();
// Verify that it is not empty and does contain the
// extended version number
ASSERT_FALSE
(
cfgReport
.
empty
());
EXPECT_NE
(
std
::
string
::
npos
,
cfgReport
.
find
(
EXTENDED_VERSION
,
0
));
}
src/lib/cfgrpt/tests/run_unittests.cc
0 → 100644
View file @
37a95664
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <gtest/gtest.h>
int
main
(
int
argc
,
char
*
argv
[])
{
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
int
result
=
RUN_ALL_TESTS
();
return
(
result
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment