Skip to content
Snippets Groups Projects
Verified Commit 2b4084e5 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

TST: update tests for v0.0.17

parent 21746dc2
Branches
Tags
1 merge request!16Tests for value and datatype structs
Pipeline #13706 failed
...@@ -105,13 +105,13 @@ TEST_F(test_list_properties, insert_list_of_text) { ...@@ -105,13 +105,13 @@ TEST_F(test_list_properties, insert_list_of_text) {
const auto &value = same_entity.GetProperties().at(0).GetValue(); const auto &value = same_entity.GetProperties().at(0).GetValue();
EXPECT_TRUE(data_type.IsList()); EXPECT_TRUE(data_type.IsList());
EXPECT_TRUE(data_type.AsList().IsListOfAtomic()); EXPECT_TRUE(data_type.GetAsList().IsListOfAtomic());
EXPECT_EQ(data_type.AsList().GetAtomicDataType(), AtomicDataType::TEXT); EXPECT_EQ(data_type.GetAsList().GetAtomicDataType(), AtomicDataType::TEXT);
EXPECT_TRUE(value.IsList()); EXPECT_TRUE(value.IsVector());
EXPECT_EQ(value.AsList().size(), 3); EXPECT_EQ(value.GetAsVector().size(), 3);
EXPECT_TRUE(value.AsList().at(1).IsString()); EXPECT_TRUE(value.GetAsVector().at(1).IsString());
EXPECT_EQ(value.AsList().at(1).AsString(), "item5"); EXPECT_EQ(value.GetAsVector().at(1).GetAsString(), "item5");
} }
TEST_F(test_list_properties, insert_list_of_int) { TEST_F(test_list_properties, insert_list_of_int) {
...@@ -161,13 +161,13 @@ TEST_F(test_list_properties, insert_list_of_int) { ...@@ -161,13 +161,13 @@ TEST_F(test_list_properties, insert_list_of_int) {
const auto &value = same_entity.GetProperties().at(0).GetValue(); const auto &value = same_entity.GetProperties().at(0).GetValue();
EXPECT_TRUE(data_type.IsList()); EXPECT_TRUE(data_type.IsList());
EXPECT_TRUE(data_type.AsList().IsListOfAtomic()); EXPECT_TRUE(data_type.GetAsList().IsListOfAtomic());
EXPECT_EQ(data_type.AsList().GetAtomicDataType(), AtomicDataType::INTEGER); EXPECT_EQ(data_type.GetAsList().GetAtomicDataType(), AtomicDataType::INTEGER);
EXPECT_TRUE(value.IsList()); EXPECT_TRUE(value.IsVector());
EXPECT_EQ(value.AsList().size(), 3); EXPECT_EQ(value.GetAsVector().size(), 3);
EXPECT_TRUE(value.AsList().at(1).IsInteger()); EXPECT_TRUE(value.GetAsVector().at(1).IsInt64());
EXPECT_EQ(value.AsList().at(1).AsInteger(), 5); EXPECT_EQ(value.GetAsVector().at(1).GetAsInt64(), 5);
} }
TEST_F(test_list_properties, insert_list_of_bool) { TEST_F(test_list_properties, insert_list_of_bool) {
...@@ -217,13 +217,13 @@ TEST_F(test_list_properties, insert_list_of_bool) { ...@@ -217,13 +217,13 @@ TEST_F(test_list_properties, insert_list_of_bool) {
const auto &value = same_entity.GetProperties().at(0).GetValue(); const auto &value = same_entity.GetProperties().at(0).GetValue();
EXPECT_TRUE(data_type.IsList()); EXPECT_TRUE(data_type.IsList());
EXPECT_TRUE(data_type.AsList().IsListOfAtomic()); EXPECT_TRUE(data_type.GetAsList().IsListOfAtomic());
EXPECT_EQ(data_type.AsList().GetAtomicDataType(), AtomicDataType::BOOLEAN); EXPECT_EQ(data_type.GetAsList().GetAtomicDataType(), AtomicDataType::BOOLEAN);
EXPECT_TRUE(value.IsList()); EXPECT_TRUE(value.IsVector());
EXPECT_EQ(value.AsList().size(), 3); EXPECT_EQ(value.GetAsVector().size(), 3);
EXPECT_TRUE(value.AsList().at(1).IsBool()); EXPECT_TRUE(value.GetAsVector().at(1).IsBool());
EXPECT_FALSE(value.AsList().at(1).AsBool()); EXPECT_FALSE(value.GetAsVector().at(1).GetAsBool());
} }
} // namespace caosdb::entity } // namespace caosdb::entity
...@@ -94,11 +94,11 @@ TEST_F(test_properties, retrieve_unit) { ...@@ -94,11 +94,11 @@ TEST_F(test_properties, retrieve_unit) {
EXPECT_FALSE(retrieval->GetStatus().IsError()); EXPECT_FALSE(retrieval->GetStatus().IsError());
const auto &same_property = retrieval->GetResultSet().at(0); const auto &same_property = retrieval->GetResultSet().at(0);
EXPECT_EQ(same_property.GetDataType().AsAtomic(), AtomicDataType::DOUBLE); EXPECT_EQ(same_property.GetDataType().GetAsAtomic(), AtomicDataType::DOUBLE);
EXPECT_EQ(same_property.GetUnit(), "V"); EXPECT_EQ(same_property.GetUnit(), "V");
const auto &same_record_type = retrieval->GetResultSet().at(1); const auto &same_record_type = retrieval->GetResultSet().at(1);
EXPECT_EQ(same_record_type.GetProperties().at(0).GetDataType().AsAtomic(), EXPECT_EQ(same_record_type.GetProperties().at(0).GetDataType().GetAsAtomic(),
AtomicDataType::DOUBLE); AtomicDataType::DOUBLE);
EXPECT_EQ(same_record_type.GetProperties().at(0).GetUnit(), "V"); EXPECT_EQ(same_record_type.GetProperties().at(0).GetUnit(), "V");
} }
......
...@@ -132,22 +132,22 @@ protected: ...@@ -132,22 +132,22 @@ protected:
template <> template <>
auto test_transaction::getValueAs<double>(const Value &value) -> double { auto test_transaction::getValueAs<double>(const Value &value) -> double {
return value.AsDouble(); return value.GetAsDouble();
} }
template <> template <>
auto test_transaction::getValueAs<int64_t>(const Value &value) -> int64_t { auto test_transaction::getValueAs<int64_t>(const Value &value) -> int64_t {
return value.AsInteger(); return value.GetAsInt64();
} }
template <> template <>
auto test_transaction::getValueAs<int32_t>(const Value &value) -> int32_t { auto test_transaction::getValueAs<int32_t>(const Value &value) -> int32_t {
return static_cast<int32_t>(value.AsInteger()); return static_cast<int32_t>(value.GetAsInt64());
} }
template <> template <>
auto test_transaction::getValueAs<bool>(const Value &value) -> bool { auto test_transaction::getValueAs<bool>(const Value &value) -> bool {
return value.AsBool(); return value.GetAsBool();
} }
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment