Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
445
Issues
445
List
Boards
Labels
Service Desk
Milestones
Merge Requests
71
Merge Requests
71
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
971938d0
Commit
971938d0
authored
Sep 22, 2018
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[65-libyang-option-data] Simplified to one fixture class
parent
818f07b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
51 deletions
+24
-51
src/lib/yang/tests/sysrepo_setup.h
src/lib/yang/tests/sysrepo_setup.h
+7
-3
src/lib/yang/tests/translator_option_data_unittests.cc
src/lib/yang/tests/translator_option_data_unittests.cc
+17
-48
No files found.
src/lib/yang/tests/sysrepo_setup.h
View file @
971938d0
...
...
@@ -25,11 +25,15 @@ class GenericTranslatorTest : public ::testing::Test {
public:
/// @brief Constructor.
GenericTranslatorTest
()
:
conn_
(),
sess_
(),
t_obj_
()
{
}
/// @brief useModel
///
/// Open a sysrepo session and create a translator object.
/// Open a sysrepo session and create a translator object using
/// the given model.
///
///
#
param model The model to use.
GenericTranslatorTest
(
std
::
string
model
)
:
conn_
(),
sess_
(),
t_obj_
(
)
{
///
@
param model The model to use.
void
useModel
(
std
::
string
model
)
{
std
::
string
full_name
=
"translator "
+
std
::
string
(
Name
)
+
" unittests"
;
conn_
.
reset
(
new
Connection
(
full_name
.
c_str
()));
...
...
src/lib/yang/tests/translator_option_data_unittests.cc
View file @
971938d0
...
...
@@ -21,61 +21,24 @@ using namespace isc::yang::test;
namespace
{
/// @brief Translator name.
extern
char
const
name
[]
=
"option data list"
;
extern
char
const
option_data_list
[]
=
"option data list"
;
/// @brief Test fixture class for @ref TranslatorOptionDataList.
class
TranslatorOptionDataListTest
:
public
GenericTranslatorTest
<
name
,
TranslatorOptionDataList
>
{
class
TranslatorOptionDataListTest
:
public
GenericTranslatorTest
<
option_data_list
,
TranslatorOptionDataList
>
{
public:
/// Constructor (passes the model).
///
/// @param model The model.
TranslatorOptionDataListTest
(
string
model
)
:
GenericTranslatorTest
<
name
,
TranslatorOptionDataList
>
(
model
)
{
}
/// Constructor.
TranslatorOptionDataListTest
()
{
}
/// Destructor (does nothing).
virtual
~
TranslatorOptionDataListTest
()
{
}
};
#if 0
/// @brief Test fixture sub-class using the IETF model.
class TranslatorOptionDataListIetf6Test : public TranslatorOptionDataListTest {
public:
/// Constructor.
TranslatorOptionDataListIetf6Test() :
TranslatorOptionDataListTest("ietf-dhcpv6-server") { }
/// Destructor.
~TranslatorOptionDataListIetf6Test() { }
};
#endif
/// @brief Test fixture sub-class using the kea DHcpv4 server model.
class
TranslatorOptionDataListKea4Test
:
public
TranslatorOptionDataListTest
{
public:
/// Constructor.
TranslatorOptionDataListKea4Test
()
:
TranslatorOptionDataListTest
(
"kea-dhcp4-server"
)
{
}
/// Destructor.
~
TranslatorOptionDataListKea4Test
()
{
}
};
/// @brief Test fixture sub-class using the kea DHcpv6 server model.
class
TranslatorOptionDataListKea6Test
:
public
TranslatorOptionDataListTest
{
public:
/// Constructor.
TranslatorOptionDataListKea6Test
()
:
TranslatorOptionDataListTest
(
"kea-dhcp6-server"
)
{
}
/// Destructor.
~
TranslatorOptionDataListKea6Test
()
{
}
};
// Test get empty option data list.
TEST_F
(
TranslatorOptionDataListKea4Test
,
getEmpty
)
{
TEST_F
(
TranslatorOptionDataListTest
,
getEmpty
)
{
useModel
(
"kea-dhcp4-server"
);
// Get the option data list and checks it is empty.
const
string
&
xpath
=
"/kea-dhcp4-server:config/option-data-list"
;
ConstElementPtr
options
;
...
...
@@ -86,7 +49,9 @@ TEST_F(TranslatorOptionDataListKea4Test, getEmpty) {
}
// Test get one option data.
TEST_F
(
TranslatorOptionDataListKea6Test
,
get
)
{
TEST_F
(
TranslatorOptionDataListTest
,
get
)
{
useModel
(
"kea-dhcp6-server"
);
// Create the option code 100.
const
string
&
xpath
=
"/kea-dhcp6-server:config/option-data-list"
;
const
string
&
xoption
=
xpath
+
"/option-data[code='100'][space='dns']"
;
...
...
@@ -116,7 +81,9 @@ TEST_F(TranslatorOptionDataListKea6Test, get) {
}
// Test set empty option data list.
TEST_F
(
TranslatorOptionDataListKea4Test
,
setEmpty
)
{
TEST_F
(
TranslatorOptionDataListTest
,
setEmpty
)
{
useModel
(
"kea-dhcp4-server"
);
// Set empty list.
const
string
&
xpath
=
"/kea-dhcp4-server:config/option-data-list"
;
ConstElementPtr
options
=
Element
::
createList
();
...
...
@@ -130,7 +97,9 @@ TEST_F(TranslatorOptionDataListKea4Test, setEmpty) {
}
// Test set an option data.
TEST_F
(
TranslatorOptionDataListKea6Test
,
set
)
{
TEST_F
(
TranslatorOptionDataListTest
,
set
)
{
useModel
(
"kea-dhcp6-server"
);
// Set one option data.
const
string
&
xpath
=
"/kea-dhcp6-server:config/option-data-list"
;
ElementPtr
options
=
Element
::
createList
();
...
...
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