Imported Upstream version 1.1
[platform/upstream/syncevolution.git] / test / ClientTest.cpp
index 90db828..b82dee3 100644 (file)
@@ -204,18 +204,30 @@ void LocalTests::addTests() {
             if (config.parentItem &&
                 config.childItem) {
                 ADD_TEST(LocalTests, testLinkedItemsParent);
-                ADD_TEST(LocalTests, testLinkedItemsChild);
+                if (config.linkedItemsRelaxedSemantic) {
+                    ADD_TEST(LocalTests, testLinkedItemsChild);
+                }
                 ADD_TEST(LocalTests, testLinkedItemsParentChild);
-                ADD_TEST(LocalTests, testLinkedItemsChildParent);
-                ADD_TEST(LocalTests, testLinkedItemsChildChangesParent);
-                ADD_TEST(LocalTests, testLinkedItemsRemoveParentFirst);
+                if (config.linkedItemsRelaxedSemantic) {
+                    ADD_TEST(LocalTests, testLinkedItemsChildParent);
+                }
+                if (config.linkedItemsRelaxedSemantic) {
+                    ADD_TEST(LocalTests, testLinkedItemsChildChangesParent);
+                }
+                if (config.linkedItemsRelaxedSemantic) {
+                    ADD_TEST(LocalTests, testLinkedItemsRemoveParentFirst);
+                }
                 ADD_TEST(LocalTests, testLinkedItemsRemoveNormal);
                 if (config.sourceKnowsItemSemantic) {
                     ADD_TEST(LocalTests, testLinkedItemsInsertParentTwice);
-                    ADD_TEST(LocalTests, testLinkedItemsInsertChildTwice);
+                    if (config.linkedItemsRelaxedSemantic) {
+                        ADD_TEST(LocalTests, testLinkedItemsInsertChildTwice);
+                    }
                 }
                 ADD_TEST(LocalTests, testLinkedItemsParentUpdate);
-                ADD_TEST(LocalTests, testLinkedItemsUpdateChild);
+                if (config.linkedItemsRelaxedSemantic) {
+                    ADD_TEST(LocalTests, testLinkedItemsUpdateChild);
+                }
                 ADD_TEST(LocalTests, testLinkedItemsInsertBothUpdateChild);
                 ADD_TEST(LocalTests, testLinkedItemsInsertBothUpdateParent);
             }
@@ -820,7 +832,6 @@ void LocalTests::testLinkedItemsParent() {
 // test inserting, removing and updating of parent + child item in
 // various order plus change tracking
 void LocalTests::testLinkedItemsChild() {
-#if LINKED_ITEMS_RELAXED_SEMANTIC
     // check additional requirements
     CPPUNIT_ASSERT(config.parentItem);
     CPPUNIT_ASSERT(config.childItem);
@@ -853,7 +864,6 @@ void LocalTests::testLinkedItemsChild() {
     SOURCE_ASSERT_EQUAL(copy.get(), 0, countUpdatedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countDeletedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), child));
-#endif
 }
 
 // test inserting, removing and updating of parent + child item in
@@ -899,7 +909,6 @@ void LocalTests::testLinkedItemsParentChild() {
 // test inserting, removing and updating of parent + child item in
 // various order plus change tracking
 void LocalTests::testLinkedItemsChildParent() {
-#if LINKED_ITEMS_RELAXED_SEMANTIC
     // check additional requirements
     CPPUNIT_ASSERT(config.parentItem);
     CPPUNIT_ASSERT(config.childItem);
@@ -935,13 +944,11 @@ void LocalTests::testLinkedItemsChildParent() {
     SOURCE_ASSERT_EQUAL(copy.get(), 2, countDeletedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), child));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), parent));
-#endif
 }
 
 // test inserting, removing and updating of parent + child item in
 // various order plus change tracking
 void LocalTests::testLinkedItemsChildChangesParent() {
-#if LINKED_ITEMS_RELAXED_SEMANTIC
     // check additional requirements
     CPPUNIT_ASSERT(config.parentItem);
     CPPUNIT_ASSERT(config.childItem);
@@ -989,13 +996,11 @@ void LocalTests::testLinkedItemsChildChangesParent() {
     SOURCE_ASSERT_EQUAL(copy.get(), 2, countDeletedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), child));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), parent));
-#endif
 }
 
 // test inserting, removing and updating of parent + child item in
 // various order plus change tracking
 void LocalTests::testLinkedItemsRemoveParentFirst() {
-#if LINKED_ITEMS_RELAXED_SEMANTIC
     // check additional requirements
     CPPUNIT_ASSERT(config.parentItem);
     CPPUNIT_ASSERT(config.childItem);
@@ -1042,7 +1047,6 @@ void LocalTests::testLinkedItemsRemoveParentFirst() {
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countDeletedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), child));
     CPPUNIT_ASSERT_NO_THROW(copy.reset());
-#endif
 }
 
 // test inserting, removing and updating of parent + child item in
@@ -1167,7 +1171,6 @@ void LocalTests::testLinkedItemsInsertChildTwice() {
     SOURCE_ASSERT_EQUAL(copy.get(), 0, countItems(copy.get()));
     CPPUNIT_ASSERT_NO_THROW(copy.reset());
 
-#if LINKED_ITEMS_RELAXED_SEMANTIC
     // add child twice (should be turned into update)
     child = insert(createSourceA, config.childItem);
 
@@ -1197,7 +1200,6 @@ void LocalTests::testLinkedItemsInsertChildTwice() {
     SOURCE_ASSERT_EQUAL(copy.get(), 0, countUpdatedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countDeletedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), child));
-#endif
 }
 
 // test inserting, removing and updating of parent + child item in
@@ -1251,7 +1253,6 @@ void LocalTests::testLinkedItemsParentUpdate() {
 // test inserting, removing and updating of parent + child item in
 // various order plus change tracking
 void LocalTests::testLinkedItemsUpdateChild() {
-#if LINKED_ITEMS_RELAXED_SEMANTIC
     // check additional requirements
     CPPUNIT_ASSERT(config.parentItem);
     CPPUNIT_ASSERT(config.childItem);
@@ -1294,8 +1295,6 @@ void LocalTests::testLinkedItemsUpdateChild() {
     SOURCE_ASSERT_EQUAL(copy.get(), 0, countUpdatedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countDeletedItems(copy.get()));
     SOURCE_ASSERT_EQUAL(copy.get(), 1, countEqual(listDeletedItems(copy.get()), child));
-    CPPUNIT_ASSERT_NO_THROW(copy.reset());
-#endif
 }
 
 // test inserting, removing and updating of parent + child item in
@@ -3544,6 +3543,7 @@ void ClientTest::getTestData(const char *type, Config &config)
     env = getenv("CLIENT_TEST_SUSPEND");
     config.suspendSync = (env && !strcmp (env, "t")) ?true :false;
     config.sourceKnowsItemSemantic = true;
+    config.linkedItemsRelaxedSemantic = true;
     config.itemType = "";
     config.import = import;
     config.dump = dump;