[UTC][calendar-service2][Non-ARC][add tc for calendar_updated_info]
authorJeesun Kim <iamjs.kim@samsung.com>
Mon, 20 Jun 2016 10:23:02 +0000 (19:23 +0900)
committerjeesun kim <iamjs.kim@samsung.com>
Mon, 20 Jun 2016 10:23:49 +0000 (03:23 -0700)
Change-Id: Icc82f6702b0ff28fa45100ad1820a29ad81bdbb6

src/utc/calendar-service2/helper/utc-calendar-helper-updated-info.c [new file with mode: 0644]
src/utc/calendar-service2/helper/utc-calendar-helper-updated-info.h [new file with mode: 0644]
src/utc/calendar-service2/record/utc-calendar-record-updated-info.c [new file with mode: 0644]
src/utc/calendar-service2/record/utc-calendar-record-updated-info.h [new file with mode: 0644]
src/utc/calendar-service2/utc-calendar-record.c
src/utc/calendar-service2/utc-calendar-record.h

diff --git a/src/utc/calendar-service2/helper/utc-calendar-helper-updated-info.c b/src/utc/calendar-service2/helper/utc-calendar-helper-updated-info.c
new file mode 100644 (file)
index 0000000..241feb7
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <calendar.h>
+
+#include "utc-calendar-debug.h"
+#include "utc-calendar-util.h"
+
+/**
+ * @testcase           utc_calendar_helper_updated_info_check_new_int
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_helper_updated_info_get_int(calendar_record_h record)
+{
+       int ret = 0;
+       int i = 0;
+       ret = calendar_record_get_int(record, _calendar_updated_info.calendar_book_id, &i);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = calendar_record_get_int(record, _calendar_updated_info.modified_status, &i);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = calendar_record_get_int(record, _calendar_updated_info.version, &i);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+       return 0;
+}
+
diff --git a/src/utc/calendar-service2/helper/utc-calendar-helper-updated-info.h b/src/utc/calendar-service2/helper/utc-calendar-helper-updated-info.h
new file mode 100644 (file)
index 0000000..b99faa2
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UTC_CALENDAR_HELPER_UPDATED_INFO_H__
+#define __UTC_CALENDAR_HELPER_UPDATED_INFO_H__
+
+#include <calendar.h>
+
+int utc_calendar_helper_updated_info_get_int(calendar_record_h record);
+
+#endif /* __UTC_CALENDAR_HELPER_UPDATED_INFO_H__ */
diff --git a/src/utc/calendar-service2/record/utc-calendar-record-updated-info.c b/src/utc/calendar-service2/record/utc-calendar-record-updated-info.c
new file mode 100644 (file)
index 0000000..71ab561
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <calendar.h>
+
+#include "utc-calendar-debug.h"
+#include "utc-calendar-util.h"
+#include "utc-calendar-helper-updated-info.h"
+
+/**
+ * @testcase           utc_calendar_record_create_p_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_create_p_updated_info(void)
+{
+       int ret = 0;
+
+       calendar_record_h updated_info = NULL;
+       ret = calendar_record_create(_calendar_updated_info._uri, &updated_info);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+
+       // check
+       if (NULL == updated_info)
+               assert_eq(-1, CALENDAR_ERROR_NONE);
+
+       calendar_record_destroy(updated_info, true);
+       return 0;
+}
+
+/**
+ * @testcase           utc_calendar_record_create_n_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_create_n_updated_info(void)
+{
+       int ret = 0;
+
+       // case 1
+       calendar_record_h updated_info = NULL;
+       ret = calendar_record_create(NULL, &updated_info);
+    assert_eq(ret, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       // case 2
+       ret = calendar_record_create(_calendar_updated_info._uri, NULL);
+    assert_eq(ret, CALENDAR_ERROR_INVALID_PARAMETER);
+       return 0;
+}
+
+/**
+ * @testcase           utc_calendar_record_destroy_p_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_destroy_p_updated_info(void)
+{
+       int ret = 0;
+
+       calendar_record_h updated_info = NULL;
+       ret = calendar_record_create(_calendar_updated_info._uri, &updated_info);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+
+    ret = calendar_record_destroy(updated_info, true);
+    assert_eq(ret, CALENDAR_ERROR_NONE);
+       return 0;
+}
+
+/**
+ * @testcase           utc_calendar_record_destroy_n_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_destroy_n_updated_info(void)
+{
+       int ret = 0;
+
+    ret = calendar_record_destroy(NULL, true);
+    assert_eq(ret, CALENDAR_ERROR_INVALID_PARAMETER);
+       return 0;
+}
+
+/**
+ * @testcase           utc_calendar_record_clone_p_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_clone_p_updated_info(void)
+{
+       int ret = 0;
+
+       calendar_record_h updated_info = NULL;
+       ret = calendar_record_create(_calendar_updated_info._uri, &updated_info);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+
+       // clone
+       calendar_record_h clone = NULL;
+       ret = calendar_record_clone(updated_info, &clone);
+       if (CALENDAR_ERROR_NONE != ret) {
+               calendar_record_destroy(updated_info, true);
+       }
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+       calendar_record_destroy(updated_info, true);
+
+       calendar_record_destroy(clone, true);
+       return 0;
+}
+
+/**
+ * @testcase           utc_calendar_record_clone_n_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_clone_n_updated_info(void)
+{
+       int ret = 0;
+
+       calendar_record_h updated_info = NULL;
+       ret = calendar_record_create(_calendar_updated_info._uri, &updated_info);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+
+       // case 1
+       ret = calendar_record_clone(updated_info, NULL);
+       if (CALENDAR_ERROR_INVALID_PARAMETER!= ret) {
+               calendar_record_destroy(updated_info, true);
+       }
+       assert_eq(ret, CALENDAR_ERROR_INVALID_PARAMETER);
+       calendar_record_destroy(updated_info, true);
+
+       // case 2
+       calendar_record_h clone = NULL;
+       ret = calendar_record_clone(NULL, &clone);
+       assert_eq(ret, CALENDAR_ERROR_INVALID_PARAMETER);
+       return 0;
+}
+
+/**
+ * @testcase           utc_calendar_record_get_int_p_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_get_int_p_updated_info(void)
+{
+       int ret = 0;
+
+       calendar_record_h updated_info = NULL;
+       ret = calendar_record_create(_calendar_updated_info._uri, &updated_info);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+
+       // get and check
+       ret = utc_calendar_helper_updated_info_get_int(updated_info);
+       if (CALENDAR_ERROR_NONE!= ret) {
+               calendar_record_destroy(updated_info, true);
+       }
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+       calendar_record_destroy(updated_info, true);
+       return 0;
+}
+
+/**
+ * @testcase           utc_calendar_record_get_int_n_updated_info
+ * @since_tizen                3.0
+ * @description
+ */
+UTC_HIDDEN int utc_calendar_record_get_int_n_updated_info(void)
+{
+       int ret = 0;
+
+       // case 1
+       int i = 0;
+       ret = calendar_record_get_int(NULL, _calendar_updated_info.calendar_book_id, &i);
+    assert_eq(ret, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       // case 2
+       calendar_record_h updated_info = NULL;
+       ret = calendar_record_create(_calendar_updated_info._uri, &updated_info);
+       assert_eq(ret, CALENDAR_ERROR_NONE);
+
+       ret = calendar_record_get_int(updated_info, _calendar_updated_info.calendar_book_id, NULL);
+       if (CALENDAR_ERROR_INVALID_PARAMETER != ret) {
+               calendar_record_destroy(updated_info, true);
+       }
+    assert_eq(ret, CALENDAR_ERROR_INVALID_PARAMETER);
+       calendar_record_destroy(updated_info, true);
+       return 0;
+}
+
diff --git a/src/utc/calendar-service2/record/utc-calendar-record-updated-info.h b/src/utc/calendar-service2/record/utc-calendar-record-updated-info.h
new file mode 100644 (file)
index 0000000..1379afb
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UTC_CALENDAR_RECORD_UPDATED_INFO_H__
+#define __UTC_CALENDAR_RECORD_UPDATED_INFO_H__
+
+int utc_calendar_record_create_p_updated_info(void);
+int utc_calendar_record_create_n_updated_info(void);
+int utc_calendar_record_destroy_p_updated_info(void);
+int utc_calendar_record_destroy_n_updated_info(void);
+int utc_calendar_record_clone_p_updated_info(void);
+int utc_calendar_record_clone_n_updated_info(void);
+int utc_calendar_record_get_int_p_updated_info(void);
+int utc_calendar_record_get_int_n_updated_info(void);
+
+#endif /* __UTC_CALENDAR_RECORD_UPDATED_INFO_H__ */
index 5d53438..b5b8bc4 100755 (executable)
 #include "utc-calendar-debug.h"
 #include "utc-calendar-util.h"
 #include "utc-calendar-record.h"
+#include "utc-calendar-record-alarm.h"
+#include "utc-calendar-record-attendee.h"
+#include "utc-calendar-record-book.h"
+#include "utc-calendar-record-event-book-attendee.h"
+#include "utc-calendar-record-event-book.h"
+#include "utc-calendar-record-event.h"
+#include "utc-calendar-record-extended.h"
+#include "utc-calendar-record-instance-localtime-book-extended.h"
+#include "utc-calendar-record-instance-localtime-book.h"
+#include "utc-calendar-record-instance-utime-book-extended.h"
+#include "utc-calendar-record-instance-utime-book.h"
+#include "utc-calendar-record-timezone.h"
+#include "utc-calendar-record-todo-book.h"
+#include "utc-calendar-record-todo.h"
+#include "utc-calendar-record-updated-info.h"
 
 static int g_startup_err = CALENDAR_ERROR_NONE;
 
@@ -88,6 +103,8 @@ int utc_calendar_record_create_p(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_create_p_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_create_p_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
@@ -128,6 +145,8 @@ int utc_calendar_record_create_n(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_create_n_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_create_n_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
@@ -168,6 +187,8 @@ int utc_calendar_record_destroy_p(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_destroy_p_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_destroy_p_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
@@ -208,6 +229,8 @@ int utc_calendar_record_destroy_n(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_destroy_n_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_destroy_n_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
@@ -247,6 +270,8 @@ int utc_calendar_record_clone_p(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_clone_p_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_clone_p_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
@@ -286,6 +311,8 @@ int utc_calendar_record_clone_n(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_clone_n_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_clone_n_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
@@ -559,6 +586,8 @@ int utc_calendar_record_get_int_p(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_get_int_p_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_get_int_p_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
@@ -598,6 +627,8 @@ int utc_calendar_record_get_int_n(void)
        assert_eq(ret, CALENDAR_ERROR_NONE);
        ret = utc_calendar_record_get_int_n_instance_localtime_book_extended();
        assert_eq(ret, CALENDAR_ERROR_NONE);
+       ret = utc_calendar_record_get_int_n_updated_info();
+       assert_eq(ret, CALENDAR_ERROR_NONE);
        return 0;
 }
 
index 3b30c16..6b7b2eb 100755 (executable)
 #ifndef __UTC_CALENDAR_RECORD_H__
 #define __UTC_CALENDAR_RECORD_H__
 
-#include "utc-calendar-record-alarm.h"
-#include "utc-calendar-record-attendee.h"
-#include "utc-calendar-record-book.h"
-#include "utc-calendar-record-event-book-attendee.h"
-#include "utc-calendar-record-event-book.h"
-#include "utc-calendar-record-event.h"
-#include "utc-calendar-record-extended.h"
-#include "utc-calendar-record-instance-localtime-book-extended.h"
-#include "utc-calendar-record-instance-localtime-book.h"
-#include "utc-calendar-record-instance-utime-book-extended.h"
-#include "utc-calendar-record-instance-utime-book.h"
-#include "utc-calendar-record-timezone.h"
-#include "utc-calendar-record-todo-book.h"
-#include "utc-calendar-record-todo.h"
-
 void utc_calendar_record_startup(void);
 void utc_calendar_record_cleanup(void);
 int utc_calendar_record_create_p(void);