pull in latest osmcode/libosmium changes
This commit is contained in:
+20
-20
@@ -4,30 +4,30 @@
|
||||
|
||||
TEST_CASE("Double") {
|
||||
|
||||
SECTION("double2string") {
|
||||
std::string s1;
|
||||
osmium::util::double2string(s1, 1.123, 7);
|
||||
REQUIRE(s1 == "1.123");
|
||||
SECTION("double2string") {
|
||||
std::string s1;
|
||||
osmium::util::double2string(s1, 1.123, 7);
|
||||
REQUIRE(s1 == "1.123");
|
||||
|
||||
std::string s2;
|
||||
osmium::util::double2string(s2, 1.000, 7);
|
||||
REQUIRE(s2 == "1");
|
||||
std::string s2;
|
||||
osmium::util::double2string(s2, 1.000, 7);
|
||||
REQUIRE(s2 == "1");
|
||||
|
||||
std::string s3;
|
||||
osmium::util::double2string(s3, 0.0, 7);
|
||||
REQUIRE(s3 == "0");
|
||||
std::string s3;
|
||||
osmium::util::double2string(s3, 0.0, 7);
|
||||
REQUIRE(s3 == "0");
|
||||
|
||||
std::string s4;
|
||||
osmium::util::double2string(s4, 0.020, 7);
|
||||
REQUIRE(s4 == "0.02");
|
||||
std::string s4;
|
||||
osmium::util::double2string(s4, 0.020, 7);
|
||||
REQUIRE(s4 == "0.02");
|
||||
|
||||
std::string s5;
|
||||
osmium::util::double2string(s5, -0.020, 7);
|
||||
REQUIRE(s5 == "-0.02");
|
||||
std::string s5;
|
||||
osmium::util::double2string(s5, -0.020, 7);
|
||||
REQUIRE(s5 == "-0.02");
|
||||
|
||||
std::string s6;
|
||||
osmium::util::double2string(s6, -0.0, 7);
|
||||
REQUIRE(s6 == "-0");
|
||||
}
|
||||
std::string s6;
|
||||
osmium::util::double2string(s6, -0.0, 7);
|
||||
REQUIRE(s6 == "-0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+34
-34
@@ -6,43 +6,43 @@
|
||||
|
||||
TEST_CASE("Options") {
|
||||
|
||||
SECTION("set_simple") {
|
||||
osmium::util::Options o;
|
||||
o.set("foo", "bar");
|
||||
REQUIRE("bar" == o.get("foo"));
|
||||
REQUIRE("" == o.get("empty"));
|
||||
REQUIRE("default" == o.get("empty", "default"));
|
||||
REQUIRE(!o.is_true("foo"));
|
||||
REQUIRE(!o.is_true("empty"));
|
||||
REQUIRE(1 == o.size());
|
||||
}
|
||||
SECTION("set_simple") {
|
||||
osmium::util::Options o;
|
||||
o.set("foo", "bar");
|
||||
REQUIRE("bar" == o.get("foo"));
|
||||
REQUIRE("" == o.get("empty"));
|
||||
REQUIRE("default" == o.get("empty", "default"));
|
||||
REQUIRE(!o.is_true("foo"));
|
||||
REQUIRE(!o.is_true("empty"));
|
||||
REQUIRE(1 == o.size());
|
||||
}
|
||||
|
||||
SECTION("set_from_bool") {
|
||||
osmium::util::Options o;
|
||||
o.set("t", true);
|
||||
o.set("f", false);
|
||||
REQUIRE("true" == o.get("t"));
|
||||
REQUIRE("false" == o.get("f"));
|
||||
REQUIRE("" == o.get("empty"));
|
||||
REQUIRE(o.is_true("t"));
|
||||
REQUIRE(!o.is_true("f"));
|
||||
REQUIRE(2 == o.size());
|
||||
}
|
||||
SECTION("set_from_bool") {
|
||||
osmium::util::Options o;
|
||||
o.set("t", true);
|
||||
o.set("f", false);
|
||||
REQUIRE("true" == o.get("t"));
|
||||
REQUIRE("false" == o.get("f"));
|
||||
REQUIRE("" == o.get("empty"));
|
||||
REQUIRE(o.is_true("t"));
|
||||
REQUIRE(!o.is_true("f"));
|
||||
REQUIRE(2 == o.size());
|
||||
}
|
||||
|
||||
SECTION("set_from_single_string_with_equals") {
|
||||
osmium::util::Options o;
|
||||
o.set("foo=bar");
|
||||
REQUIRE("bar" == o.get("foo"));
|
||||
REQUIRE(1 == o.size());
|
||||
}
|
||||
SECTION("set_from_single_string_with_equals") {
|
||||
osmium::util::Options o;
|
||||
o.set("foo=bar");
|
||||
REQUIRE("bar" == o.get("foo"));
|
||||
REQUIRE(1 == o.size());
|
||||
}
|
||||
|
||||
SECTION("set_from_single_string_without_equals") {
|
||||
osmium::util::Options o;
|
||||
o.set("foo");
|
||||
REQUIRE("true" == o.get("foo"));
|
||||
REQUIRE(o.is_true("foo"));
|
||||
REQUIRE(1 == o.size());
|
||||
}
|
||||
SECTION("set_from_single_string_without_equals") {
|
||||
osmium::util::Options o;
|
||||
o.set("foo");
|
||||
REQUIRE("true" == o.get("foo"));
|
||||
REQUIRE(o.is_true("foo"));
|
||||
REQUIRE(1 == o.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+35
-35
@@ -4,54 +4,54 @@
|
||||
|
||||
TEST_CASE("split_string") {
|
||||
|
||||
SECTION("split_string string") {
|
||||
std::string str { "foo,baramba,baz" };
|
||||
std::vector<std::string> result = {"foo", "baramba", "baz"};
|
||||
SECTION("split_string string") {
|
||||
std::string str { "foo,baramba,baz" };
|
||||
std::vector<std::string> result = {"foo", "baramba", "baz"};
|
||||
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
|
||||
SECTION("split_string string without sep") {
|
||||
std::string str { "foo" };
|
||||
std::vector<std::string> result = {"foo"};
|
||||
SECTION("split_string string without sep") {
|
||||
std::string str { "foo" };
|
||||
std::vector<std::string> result = {"foo"};
|
||||
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
|
||||
SECTION("split_string string with empty at end") {
|
||||
std::string str { "foo,bar," };
|
||||
std::vector<std::string> result = {"foo", "bar", ""};
|
||||
SECTION("split_string string with empty at end") {
|
||||
std::string str { "foo,bar," };
|
||||
std::vector<std::string> result = {"foo", "bar", ""};
|
||||
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
|
||||
SECTION("split_string string with empty in middle") {
|
||||
std::string str { "foo,,bar" };
|
||||
std::vector<std::string> result = {"foo", "", "bar"};
|
||||
SECTION("split_string string with empty in middle") {
|
||||
std::string str { "foo,,bar" };
|
||||
std::vector<std::string> result = {"foo", "", "bar"};
|
||||
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
|
||||
SECTION("split_string string with empty at start") {
|
||||
std::string str { ",bar,baz" };
|
||||
std::vector<std::string> result = {"", "bar", "baz"};
|
||||
SECTION("split_string string with empty at start") {
|
||||
std::string str { ",bar,baz" };
|
||||
std::vector<std::string> result = {"", "bar", "baz"};
|
||||
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
|
||||
SECTION("split_string sep") {
|
||||
std::string str { "," };
|
||||
std::vector<std::string> result = {"", ""};
|
||||
SECTION("split_string sep") {
|
||||
std::string str { "," };
|
||||
std::vector<std::string> result = {"", ""};
|
||||
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
|
||||
SECTION("split_string empty string") {
|
||||
std::string str { "" };
|
||||
std::vector<std::string> result;
|
||||
SECTION("split_string empty string") {
|
||||
std::string str { "" };
|
||||
std::vector<std::string> result;
|
||||
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
REQUIRE(result == osmium::split_string(str, ','));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user