Skip to content
Snippets Groups Projects
Commit e60e780d authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

TST: more test cases

parent ddb79265
No related branches found
No related tags found
1 merge request!12F consolidation
Pipeline #12188 passed with warnings
Pipeline: caosdb-cppinttest

#12189

    ......@@ -48,6 +48,7 @@ TEST(test_data_type, test_atomic) {
    for (int i = 1; i < 6; i++) {
    Entity entity;
    entity.SetRole(Role::PROPERTY);
    // the different AtomicDataType are associated with integers
    entity.SetDataType(static_cast<AtomicDataType>(i));
    EXPECT_TRUE(entity.GetDataType().IsAtomic());
    EXPECT_EQ(entity.GetDataType().AsAtomic(), static_cast<AtomicDataType>(i));
    ......@@ -57,6 +58,7 @@ TEST(test_data_type, test_atomic) {
    entity.SetDataType(data_type);
    EXPECT_FALSE(data_type.IsReference());
    EXPECT_EQ(data_type.AsReference().GetName(), std::basic_string<char>(""));
    EXPECT_FALSE(data_type.IsList());
    EXPECT_TRUE(data_type.IsAtomic());
    EXPECT_EQ(data_type.AsAtomic(), static_cast<AtomicDataType>(i));
    ......@@ -95,6 +97,7 @@ TEST(test_data_type, test_list_of_atomic) {
    EXPECT_FALSE(data_type.IsAtomic());
    EXPECT_TRUE(data_type.IsList());
    const auto &list_data_type = data_type.AsList();
    EXPECT_EQ(list_data_type.GetReferenceDataType().GetName(), std::basic_string<char>(""));
    EXPECT_TRUE(list_data_type.IsListOfAtomic());
    EXPECT_FALSE(list_data_type.IsListOfReference());
    EXPECT_EQ(list_data_type.GetAtomicDataType(),
    ......
    ......@@ -30,12 +30,14 @@
    #include "caosdb/status_code.h" // for StatusCode, FILE_DO...
    #include "caosdb/transaction.h" // for Transaction
    #include "caosdb/value.h" // for Value
    #include <exception>
    #include <google/protobuf/arena.h> // for Arena
    #include <gtest/gtest-message.h> // for Message
    #include <gtest/gtest-test-part.h> // for TestPartResult, Sui...
    #include <gtest/gtest_pred_impl.h> // for Test, EXPECT_EQ
    #include <iostream>
    #include <memory> // for allocator, shared_ptr
    #include <stdexcept>
    #include <string> // for operator+, string
    namespace caosdb::entity {
    ......@@ -100,7 +102,10 @@ TEST(test_entity, test_append_property) {
    entity.AppendProperty(prop);
    EXPECT_EQ(entity.GetProperties().size(), 1);
    // also test RepeatedPtrFieldWrapper.at()
    const auto &same_prop = entity.GetProperties().at(0);
    EXPECT_THROW((void) entity.GetProperties().at(2), std::out_of_range);
    EXPECT_THROW((void) entity.GetProperties().at(-1), std::out_of_range);
    EXPECT_EQ(prop.GetName(), same_prop.GetName());
    EXPECT_EQ(prop.GetId(), same_prop.GetId());
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment