diff --git a/src/ccaosdb.cpp b/src/ccaosdb.cpp index 8797474ab8e2b879ceb7ae780c639349452bf084..c47562acba054ea40c701becaa2a49531d78957b 100644 --- a/src/ccaosdb.cpp +++ b/src/ccaosdb.cpp @@ -437,7 +437,22 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) CAOSDB_ENTITY_GET(id, strcpy(out, wrapped_entity->GetId().c_str());) +CAOSDB_ENTITY_GET(role, strcpy(out, wrapped_entity->GetRole().c_str());) CAOSDB_ENTITY_GET(name, strcpy(out, wrapped_entity->GetName().c_str());) - +CAOSDB_ENTITY_GET(description, + strcpy(out, wrapped_entity->GetDescription().c_str());) +CAOSDB_ENTITY_GET(datatype, strcpy(out, wrapped_entity->GetDatatype().c_str());) +CAOSDB_ENTITY_GET(value, strcpy(out, wrapped_entity->GetValue().c_str());) +CAOSDB_ENTITY_GET(unit, strcpy(out, wrapped_entity->GetUnit().c_str());) +CAOSDB_ENTITY_GET(version_id, + strcpy(out, wrapped_entity->GetVersionId().c_str());) + +CAOSDB_ENTITY_SET(role, role, wrapped_entity->SetRole(std::string(role));) CAOSDB_ENTITY_SET(name, name, wrapped_entity->SetName(std::string(name));) +CAOSDB_ENTITY_SET(description, description, + wrapped_entity->SetDescription(std::string(description));) +CAOSDB_ENTITY_SET(datatype, datatype, + wrapped_entity->SetDatatype(std::string(datatype));) +CAOSDB_ENTITY_SET(unit, unit, wrapped_entity->SetUnit(std::string(unit));) +CAOSDB_ENTITY_SET(value, value, wrapped_entity->SetValue(std::string(value));) } diff --git a/test/test_ccaosdb.cpp b/test/test_ccaosdb.cpp index 60432613e129daf3c62a8b517e78d73aeeaeb713..d9a49cb3c8fdd87058dcf8db7f4864e50b229b9e 100644 --- a/test/test_ccaosdb.cpp +++ b/test/test_ccaosdb.cpp @@ -146,12 +146,34 @@ TEST_F(test_ccaosdb, test_entity) { int return_code(caosdb_entity_create_entity(&entity)); EXPECT_EQ(return_code, 0); - return_code = caosdb_entity_entity_set_name(&entity, "some_name"); + // In-depth check for one pair of setter and getter, just compare + // the strings for the rest + return_code = caosdb_entity_entity_set_name(&entity, "length"); EXPECT_EQ(return_code, 0); char out[255] = {"a"}; // NOLINT return_code = caosdb_entity_entity_get_name(&entity, out); EXPECT_EQ(return_code, 0); - EXPECT_EQ(strcmp(out, "some_name"), 0); + EXPECT_EQ(strcmp(out, "length"), 0); + + caosdb_entity_entity_set_role(&entity, "Property"); + caosdb_entity_entity_get_role(&entity, out); + EXPECT_EQ(strcmp(out, "Property"), 0); + + caosdb_entity_entity_set_description(&entity, "The length of an object"); + caosdb_entity_entity_get_description(&entity, out); + EXPECT_EQ(strcmp(out, "The length of an object"), 0); + + caosdb_entity_entity_set_datatype(&entity, "DOUBLE"); + caosdb_entity_entity_get_datatype(&entity, out); + EXPECT_EQ(strcmp(out, "DOUBLE"), 0); + + caosdb_entity_entity_set_unit(&entity, "m"); + caosdb_entity_entity_get_unit(&entity, out); + EXPECT_EQ(strcmp(out, "m"), 0); + + caosdb_entity_entity_set_value(&entity, "5.0"); + caosdb_entity_entity_get_value(&entity, out); + EXPECT_EQ(strcmp(out, "5.0"), 0); return_code = caosdb_entity_delete_entity(&entity); EXPECT_EQ(return_code, 0);