Commit 83838675 authored by Francis Dupont's avatar Francis Dupont
Browse files

[master] Merged trac5286 (signed integers in options)

parents f5add97e 0aa6243a
......@@ -1277,6 +1277,9 @@ It is merely echoed by the server
<row><entry>uint8</entry><entry>8 bit unsigned integer with allowed values 0 to 255</entry></row>
<row><entry>uint16</entry><entry>16 bit unsigned integer with allowed values 0 to 65535</entry></row>
<row><entry>uint32</entry><entry>32 bit unsigned integer with allowed values 0 to 4294967295</entry></row>
<row><entry>int8</entry><entry>8 bit signed integer with allowed values -128 to 127</entry></row>
<row><entry>int16</entry><entry>16 bit signed integer with allowed values -32768 to 32767</entry></row>
<row><entry>int32</entry><entry>32 bit signed integer with allowed values -2147483648 to 2147483647</entry></row>
</tbody>
</tgroup>
</table>
......
......@@ -1995,6 +1995,31 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidRecordType) {
EXPECT_TRUE(errorContainsPosition(status, "<string>"));
}
/// The purpose of this test is to verify that various integer types
/// are supported.
TEST_F(Dhcp4ParserTest, optionIntegerTypes) {
// Configuration string. The third of the record fields
// is invalid. It is "sting" instead of "string".
std::string config =
"{ \"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
" \"record-types\": \"uint8,uint16,uint32,int8,int16,int32\","
" \"space\": \"isc\""
" } ]"
"}";
ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config));
// Use the configuration string to create new option definition.
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
ASSERT_TRUE(status);
// Expecting parsing error (error code 1).
checkResult(status, 0);
}
/// The goal of this test is to verify that the invalid encapsulated
/// option space name is not accepted.
TEST_F(Dhcp4ParserTest, optionDefInvalidEncapsulatedSpace) {
......
......@@ -2393,6 +2393,32 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidRecordType) {
EXPECT_TRUE(errorContainsPosition(status, "<string>"));
}
/// The purpose of this test is to verify that various integer types
/// are supported.
TEST_F(Dhcp6ParserTest, optionIntegerTypes) {
// Configuration string. The third of the record fields
// is invalid. It is "sting" instead of "string".
std::string config =
"{ \"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
" \"record-types\": \"uint8,uint16,uint32,int8,int16,int32\","
" \"space\": \"isc\""
" } ]"
"}";
ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config));
// Use the configuration string to create new option definition.
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
ASSERT_TRUE(status);
// Expecting parsing error (error code 1).
checkResult(status, 0);
}
/// The goal of this test is to verify that the invalid encapsulated
/// option space name is not accepted.
TEST_F(Dhcp6ParserTest, optionDefInvalidEncapsulatedSpace) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment