mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Allow setting cylinder and head ranges.
This commit is contained in:
@@ -31,11 +31,32 @@ static void test_setting(void)
|
||||
setProtoByString(&config, "r.s", "val2");
|
||||
setProtoByString(&config, "firstoption.s", "1");
|
||||
setProtoByString(&config, "secondoption.s", "2");
|
||||
setProtoByString(&config, "range", "1-3x2");
|
||||
|
||||
std::string s;
|
||||
google::protobuf::TextFormat::PrintToString(config, &s);
|
||||
s = cleanup(s);
|
||||
AssertThat(s, Equals("i64: -1 i32: -2 u64: 3 u32: 4 d: 5.5 m { s: \"string\" } r { s: \"val2\" } secondoption { s: \"2\" }"));
|
||||
AssertThat(s, Equals(cleanup(R"M(
|
||||
i64: -1
|
||||
i32: -2
|
||||
u64: 3
|
||||
u32: 4
|
||||
d: 5.5
|
||||
m {
|
||||
s: "string"
|
||||
}
|
||||
r {
|
||||
s: "val2"
|
||||
}
|
||||
secondoption {
|
||||
s: "2"
|
||||
}
|
||||
range {
|
||||
start: 1
|
||||
step: 2
|
||||
end: 3
|
||||
}
|
||||
)M")));
|
||||
}
|
||||
|
||||
static void test_config(void)
|
||||
@@ -83,18 +104,53 @@ static void test_range(void)
|
||||
RangeProto r;
|
||||
r.set_start(0);
|
||||
r.set_end(3);
|
||||
r.add_also(5);
|
||||
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{0, 1, 2, 3, 5}));
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{0, 1, 2, 3}));
|
||||
}
|
||||
|
||||
{
|
||||
RangeProto r;
|
||||
r.set_start(0);
|
||||
r.set_end(3);
|
||||
r.set_step(2);
|
||||
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{0, 2}));
|
||||
}
|
||||
|
||||
{
|
||||
RangeProto r;
|
||||
r.set_start(1);
|
||||
r.set_end(1);
|
||||
r.add_also(5);
|
||||
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{1, 5}));
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{1}));
|
||||
}
|
||||
|
||||
{
|
||||
RangeProto r;
|
||||
setRange(&r, "1-3");
|
||||
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{1, 2, 3}));
|
||||
}
|
||||
|
||||
{
|
||||
RangeProto r;
|
||||
setRange(&r, "0-3x2");
|
||||
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{0, 2}));
|
||||
}
|
||||
|
||||
{
|
||||
RangeProto r;
|
||||
setRange(&r, "0");
|
||||
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{0}));
|
||||
}
|
||||
|
||||
{
|
||||
RangeProto r;
|
||||
setRange(&r, "7");
|
||||
|
||||
AssertThat(iterate(r), Equals(std::set<unsigned>{7}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +158,7 @@ static void test_fields(void)
|
||||
{
|
||||
TestProto proto;
|
||||
auto fields = findAllProtoFields(&proto);
|
||||
AssertThat(fields, HasLength(13));
|
||||
AssertThat(fields.size(), Equals(17));
|
||||
}
|
||||
|
||||
static void test_options(void)
|
||||
|
||||
@@ -19,5 +19,7 @@ message TestProto {
|
||||
SubMessageProto firstoption = 8;
|
||||
SubMessageProto secondoption = 9;
|
||||
}
|
||||
|
||||
optional RangeProto range = 10;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user