mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Add string decode/encode api
This commit is contained in:
@@ -2,9 +2,19 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <ifcparse/file.h>
|
||||
#include <ifcparse/parse.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
TEST_CASE("SPF strings can be encoded and decoded", "[ifcparse]") {
|
||||
const std::string decoded = "Caf\xC3\xA9" "'s \\";
|
||||
const std::string encoded = R"('Caf\X2\00E9\X0\''s \\')";
|
||||
|
||||
CHECK(ifcopenshell::encode_spf_string(decoded) == encoded);
|
||||
CHECK(ifcopenshell::decode_spf_string(encoded) == decoded);
|
||||
CHECK(ifcopenshell::decode_spf_string(encoded.substr(1, encoded.size() - 2)) == decoded);
|
||||
}
|
||||
|
||||
TEST_CASE("IfcPropertySetDefinitionSet references are resolved without replacing their owner", "[ifcparse]") {
|
||||
const std::string fixture = std::string(IFCOPENSHELL_TEST_FIXTURES) + "/ColumnPSetsOfSets.ifc";
|
||||
ifcopenshell::file file(fixture);
|
||||
|
||||
Reference in New Issue
Block a user