Skip to content

Commit

Permalink
Use int64_t instead of int for parameter integer range, fixes #199 (#214
Browse files Browse the repository at this point in the history
)
  • Loading branch information
AugusteBourgois authored Aug 23, 2024
1 parent 04b83a4 commit 28b1870
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions example/test/descriptor_test_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ TEST_F(DescriptorTest, check_lower_upper_bounds) {

TEST_F(DescriptorTest, check_lt_eq) {
EXPECT_EQ(descriptors_[3].integer_range.at(0).from_value,
std::numeric_limits<int>::lowest());
std::numeric_limits<int64_t>::lowest());
EXPECT_EQ(descriptors_[3].integer_range.at(0).to_value, 15);
}

TEST_F(DescriptorTest, check_gt) {
EXPECT_EQ(descriptors_[4].integer_range.at(0).from_value, 15);
EXPECT_EQ(descriptors_[4].integer_range.at(0).to_value,
std::numeric_limits<int>::max());
std::numeric_limits<int64_t>::max());
}

int main(int argc, char** argv) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ descriptor.integer_range.at({{loop.index0}}).to_value = {{validation.arguments[1
{%- elif ("lower" in validation.function_name or "gt" == validation.function_base_name or "gt_eq" == validation.function_base_name) and validation.arguments|length == 1 %}
descriptor.integer_range.resize({{loop.index}});
descriptor.integer_range.at({{loop.index0}}).from_value = {{validation.arguments[0]}};
descriptor.integer_range.at({{loop.index0}}).to_value = std::numeric_limits<int>::max();
descriptor.integer_range.at({{loop.index0}}).to_value = std::numeric_limits<int64_t>::max();
{%- elif ("upper" in validation.function_name or "lt" == validation.function_base_name or "lt_eq" == validation.function_base_name) and validation.arguments|length == 1 %}
descriptor.integer_range.resize({{loop.index}});
descriptor.integer_range.at({{loop.index0}}).from_value = std::numeric_limits<int>::lowest();
descriptor.integer_range.at({{loop.index0}}).from_value = std::numeric_limits<int64_t>::lowest();
descriptor.integer_range.at({{loop.index0}}).to_value = {{validation.arguments[0]}};
{%- endif %}
{%- endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ descriptor.integer_range.at({{loop.index0}}).to_value = {{validation.arguments[1
{%- elif ("lower" in validation.function_name or "gt" == validation.function_base_name or "gt_eq" == validation.function_base_name) and validation.arguments|length == 1 %}
descriptor.integer_range.resize({{loop.index}});
descriptor.integer_range.at({{loop.index0}}).from_value = {{validation.arguments[0]}};
descriptor.integer_range.at({{loop.index0}}).to_value = std::numeric_limits<int>::max();
descriptor.integer_range.at({{loop.index0}}).to_value = std::numeric_limits<int64_t>::max();
{%- elif ("upper" in validation.function_name or "lt" == validation.function_base_name or "lt_eq" == validation.function_base_name) and validation.arguments|length == 1 %}
descriptor.integer_range.resize({{loop.index}});
descriptor.integer_range.at({{loop.index0}}).from_value = std::numeric_limits<int>::lowest();
descriptor.integer_range.at({{loop.index0}}).from_value = std::numeric_limits<int64_t>::lowest();
descriptor.integer_range.at({{loop.index0}}).to_value = {{validation.arguments[0]}};
{%- endif %}
{%- endif %}
Expand Down

0 comments on commit 28b1870

Please sign in to comment.