Refactor component-based-application 60/257360/28
authorjh9216.park <jh9216.park@samsung.com>
Fri, 23 Apr 2021 05:33:33 +0000 (01:33 -0400)
committerChanggyu Choi <changyu.choi@samsung.com>
Fri, 7 Jan 2022 07:21:59 +0000 (16:21 +0900)
- Use app-core for C++

Requires:
 - https://review.tizen.org/gerrit/#/c/platform/core/base/bundle/+/257520/
 - https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-core/+/247812/

Change-Id: Id771571eabe9c06bbec0c19bd3f50dc5bcec58fb
Signed-off-by: jh9216.park <jh9216.park@samsung.com>
160 files changed:
CMakeLists.txt
cmake/Modules/ApplyPkgConfig.cmake [new file with mode: 0644]
component_based/app_control/CMakeLists.txt
component_based/app_control/component_based_app_control.cc
component_based/app_control/component_based_app_control.h
component_based/app_control/component_based_app_control_implementation.h
component_based/base/CMakeLists.txt
component_based/base/action_event_interface.h [new file with mode: 0644]
component_based/base/action_internal.cc
component_based/base/action_internal.h
component_based/base/api/base_component.h
component_based/base/api/base_frame_component.h
component_based/base/api/base_service_component.h
component_based/base/api/component_based_app_base.h
component_based/base/api/component_common.h
component_based/base/application_base.cc
component_based/base/application_base.h
component_based/base/application_base_implementation.h [deleted file]
component_based/base/component.cc
component_based/base/component.h
component_based/base/component_implementation.h [deleted file]
component_based/base/component_manager_interface.h [deleted file]
component_based/base/component_manager_internal.cc [deleted file]
component_based/base/component_manager_internal.h [deleted file]
component_based/base/content_manager_internal.cc
component_based/base/content_manager_internal.h
component_based/base/core_base_internal.h [deleted file]
component_based/base/device_orientation.h
component_based/base/dlog_internal.h
component_based/base/frame_component.cc
component_based/base/frame_component.h
component_based/base/frame_window.cc
component_based/base/frame_window.h
component_based/base/low_battery.h
component_based/base/low_memory.h
component_based/base/service_component.cc
component_based/base/service_component.h
component_based/base/stub.cc
component_based/base/suspended_state.h
component_based/base/system_event_interface.h [new file with mode: 0644]
component_based/base/system_event_internal.h
component_based/base/window_component_manager_interface.h
component_based/base/window_interface.h
component_based/common/exception.h
component_based/efl_base/CMakeLists.txt
component_based/efl_base/api/component_based_app.h
component_based/efl_base/api/frame_component.h
component_based/efl_base/api/frame_component_internal.h
component_based/efl_base/api/service_component.h
component_based/efl_base/application.cc
component_based/efl_base/application.h
component_based/efl_base/elm_window.cc
component_based/efl_base/elm_window.h
component_based/efl_base/stub.cc [changed mode: 0755->0644]
component_based/efl_widget_base/CMakeLists.txt
component_based/efl_widget_base/api/widget_component.h
component_based/efl_widget_base/elm_widget_window.cc
component_based/efl_widget_base/elm_widget_window.h
component_based/efl_widget_base/stub.cc
component_based/port/CMakeLists.txt
component_based/port/api/component_port.h
component_based/port/client.cc
component_based/port/client.hh
component_based/port/exception.hh
component_based/port/export_api.hh
component_based/port/log_private.hh
component_based/port/main_loop.cc
component_based/port/main_loop.hh
component_based/port/peer_creds.cc
component_based/port/peer_creds.hh
component_based/port/port.cc
component_based/port/port.hh
component_based/port/port_implementation.hh
component_based/port/privilege_checker.cc
component_based/port/privilege_checker.hh
component_based/port/request.cc
component_based/port/request.hh
component_based/port/response.cc
component_based/port/response.hh
component_based/port/sender_info.cc
component_based/port/sender_info.hh
component_based/port/server.cc
component_based/port/server.hh
component_based/port/socket.cc
component_based/port/socket.hh
component_based/port/stub.cc
component_based/port/util.cc
component_based/port/util.hh
component_based/uri/CMakeLists.txt
component_based/uri/component_based_query.h
component_based/uri/component_based_uri.cc
component_based/uri/component_based_uri.h
component_based/widget_base/CMakeLists.txt
component_based/widget_base/api/base_widget_component.h
component_based/widget_base/stub.cc
component_based/widget_base/widget_component.cc
component_based/widget_base/widget_component.h
component_based/widget_base/widget_component_implementation.h
component_based/widget_base/widget_window.cc
component_based/widget_base/widget_window.h
doc/appfw_component_based_application_doc.h
mock/fff.h [deleted file]
mock/mock.cc [deleted file]
mock/mock.h [deleted file]
mock/mock_app_common.h [deleted file]
mock/mock_app_control.h [deleted file]
mock/mock_appcore_multiwindow_base.h [deleted file]
mock/mock_aul.h [deleted file]
mock/mock_elementary.h [deleted file]
packaging/component-based.spec
test/CMakeLists.txt [new file with mode: 0644]
test/unit_tests/CMakeLists.txt [new file with mode: 0644]
test/unit_tests/base/test_component_based_application_base.cc [new file with mode: 0644]
test/unit_tests/efl_base/test_component_based_app.cc [new file with mode: 0644]
test/unit_tests/mock/app_common_mock.cc [new file with mode: 0644]
test/unit_tests/mock/app_common_mock.h [new file with mode: 0644]
test/unit_tests/mock/app_control_event_mock.h [new file with mode: 0644]
test/unit_tests/mock/app_control_mock.cc [new file with mode: 0644]
test/unit_tests/mock/app_control_mock.h [new file with mode: 0644]
test/unit_tests/mock/appcore_multiwindow_base_mock.cc [new file with mode: 0644]
test/unit_tests/mock/appcore_multiwindow_base_mock.h [new file with mode: 0644]
test/unit_tests/mock/base_component_callback_mock.cc [new file with mode: 0644]
test/unit_tests/mock/base_component_callback_mock.h [new file with mode: 0644]
test/unit_tests/mock/base_frame_component_callback_mock.cc [new file with mode: 0644]
test/unit_tests/mock/base_frame_component_callback_mock.h [new file with mode: 0644]
test/unit_tests/mock/base_service_component_callback_mock.cc [new file with mode: 0644]
test/unit_tests/mock/base_service_component_callback_mock.h [new file with mode: 0644]
test/unit_tests/mock/component_based_app_base_callback_mock.cc [new file with mode: 0644]
test/unit_tests/mock/component_based_app_base_callback_mock.h [new file with mode: 0644]
test/unit_tests/mock/component_based_app_callback_mock.cc [new file with mode: 0644]
test/unit_tests/mock/component_based_app_callback_mock.h [new file with mode: 0644]
test/unit_tests/mock/dummy_args.h [new file with mode: 0644]
test/unit_tests/mock/elm_mock.cc [new file with mode: 0644]
test/unit_tests/mock/elm_mock.h [new file with mode: 0644]
test/unit_tests/mock/frame_component_callback_mock.cc [new file with mode: 0644]
test/unit_tests/mock/frame_component_callback_mock.h [new file with mode: 0644]
test/unit_tests/mock/mock_hook.h [new file with mode: 0644]
test/unit_tests/mock/module_mock.h [new file with mode: 0644]
test/unit_tests/mock/service_component_callback_mock.cc [new file with mode: 0644]
test/unit_tests/mock/service_component_callback_mock.h [new file with mode: 0644]
test/unit_tests/mock/test_fixture.cc [new file with mode: 0644]
test/unit_tests/mock/test_fixture.h [new file with mode: 0644]
test/unit_tests/test_component_based_app_control.cc [new file with mode: 0644]
test/unit_tests/test_component_based_uri.cc [new file with mode: 0644]
test/unit_tests/test_main.cc [new file with mode: 0644]
unit_tests/CMakeLists.txt [deleted file]
unit_tests/src/base/test_base_base_stub.cc [deleted file]
unit_tests/src/base/test_base_frame_stub.cc [deleted file]
unit_tests/src/base/test_base_service_stub.cc [deleted file]
unit_tests/src/base/test_component_based_application_base.cc [deleted file]
unit_tests/src/base/test_component_based_component.cc [deleted file]
unit_tests/src/base/test_component_based_component_mananger.cc [deleted file]
unit_tests/src/base/test_component_based_content_manager.cc [deleted file]
unit_tests/src/efl_base/test_component_based_app.cc [deleted file]
unit_tests/src/efl_base/test_frame_component.cc [deleted file]
unit_tests/src/efl_base/test_service_component.cc [deleted file]
unit_tests/src/test_component_based_app_control.cc [deleted file]
unit_tests/src/test_component_based_application.cc [deleted file]
unit_tests/src/test_component_based_uri.cc [deleted file]
unit_tests/src/test_main.cc [deleted file]

index be6d2cb6d26d325e12bfbad657dff73101004ba7..60f88b466f7359d8bfecc2ede5700f2cd603cc5d 100644 (file)
@@ -1,19 +1,59 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based CXX)
 
-INCLUDE(FindPkgConfig)
+PROJECT(component-based)
 
-ADD_SUBDIRECTORY(component_based)
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-zdefs")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-declarations")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS} -std=c++14")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
+
+SET(TARGET_COMPONENT_BASED_APPLICATION "component-based-application")
+SET(TARGET_COMPONENT_BASED_APP_CONTROL "component-based-app-control")
+SET(TARGET_COMPONENT_BASED_CORE_BASE "component-based-core-base")
+SET(TARGET_COMPONENT_BASED_CORE_WIDGET_BASE "component-based-core-widget-base")
+SET(TARGET_COMPONENT_BASED_EFL_WIDGET "component-based-efl-widget")
+SET(TARGET_COMPONENT_BASED_PORT "component-based-port")
+SET(TARGET_COMPONENT_BASED_URI "component-based-uri")
+
+SET(TARGET_COMPONENT_BASED_UNITTESTS "component-based_unittests")
 
-IF(NOT DEFINED MINIMUM_BUILD)
 ENABLE_TESTING()
-SET(COMPONENT_BASED_UNITTESTS component-based_unittests)
-ADD_TEST(NAME ${COMPONENT_BASED_UNITTESTS} COMMAND ${COMPONENT_BASED_UNITTESTS}
-       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/unit_tests)
-
-ADD_SUBDIRECTORY(unit_tests)
-ADD_DEPENDENCIES(${COMPONENT_BASED_UNITTESTS}
-       component-based-application
-       component-based-uri
-       component-based-app-control)
-ENDIF(NOT DEFINED MINIMUM_BUILD)
+ADD_TEST(NAME ${TARGET_COMPONENT_BASED_UNITTESTS}
+  COMMAND ${TARGET_COMPONENT_BASED_UNITTESTS}
+       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test/unit_tests)
+
+INCLUDE(FindPkgConfig)
+INCLUDE(ApplyPkgConfig)
+
+PKG_CHECK_MODULES(APP_CORE_MULTI_WINDOW_NEXT_DEPS REQUIRED app-core-multi-window-cpp)
+PKG_CHECK_MODULES(AUL_DEPS REQUIRED aul)
+PKG_CHECK_MODULES(BUNDLE_DEPS REQUIRED bundle)
+PKG_CHECK_MODULES(CAPI_APPFW_APP_COMMON_DEPS REQUIRED capi-appfw-app-common)
+PKG_CHECK_MODULES(CAPI_APPFW_APP_CONTROL_DEPS REQUIRED capi-appfw-app-control)
+PKG_CHECK_MODULES(CYNARA_CLIENT_DEPS REQUIRED cynara-client)
+PKG_CHECK_MODULES(CYNARA_CREDS_SOCKET_DEPS REQUIRED cynara-creds-socket)
+PKG_CHECK_MODULES(DLOG_DEPS REQUIRED dlog)
+PKG_CHECK_MODULES(ECORE_WL2_DEPS REQUIRED ecore-wl2)
+PKG_CHECK_MODULES(ELEMENTARY_DEPS REQUIRED elementary)
+PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0)
+PKG_CHECK_MODULES(GLIB_DEPS REQUIRED glib-2.0)
+PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock)
+PKG_CHECK_MODULES(PARCEL_DEPS REQUIRED parcel)
+PKG_CHECK_MODULES(SCREEN_CONNECTOR_PROVIDER_DEPS REQUIRED screen_connector_provider)
+PKG_CHECK_MODULES(WIDGET_SERVICE_DEPS REQUIRED widget_service)
+
+ADD_SUBDIRECTORY(component_based)
+ADD_SUBDIRECTORY(test)
diff --git a/cmake/Modules/ApplyPkgConfig.cmake b/cmake/Modules/ApplyPkgConfig.cmake
new file mode 100644 (file)
index 0000000..f4a262e
--- /dev/null
@@ -0,0 +1,35 @@
+# Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+#
+# This function applies external (out of source tree) dependencies
+# to given target. Arguments are:
+#   TARGET - valid cmake target
+#   PRIVACY - dependency can be inherited by dependent targets or not:
+#     PUBLIC - this should be used by default, cause compile/link flags passing
+#     PRIVATE - do not passes any settings to dependent targets,
+#               may be usefull for static libraries from the inside of the project
+# Argument ARGV2 and following are supposed to be names of checked pkg config
+# packages. This function will use variables created by check_pkg_modules().
+#  - ${DEP_NAME}_LIBRARIES
+#  - ${DEP_NAME}_INCLUDE_DIRS
+#  - ${DEP_NAME}_CFLAGS
+#
+FUNCTION(APPLY_PKG_CONFIG TARGET PRIVACY)
+  MATH(EXPR DEST_INDEX "${ARGC}-1")
+  FOREACH(I RANGE 2 ${DEST_INDEX})
+    IF(NOT ${ARGV${I}}_FOUND)
+      MESSAGE(FATAL_ERROR "Not found dependency - ${ARGV${I}}_FOUND")
+    ENDIF(NOT ${ARGV${I}}_FOUND)
+    TARGET_LINK_LIBRARIES(${TARGET} ${PRIVACY} "${${ARGV${I}}_LIBRARIES}")
+    TARGET_INCLUDE_DIRECTORIES(${TARGET} ${PRIVACY} SYSTEM "${${ARGV${I}}_INCLUDE_DIRS}")
+    STRING(REPLACE ";" " " CFLAGS_STR "${${ARGV${I}}_CFLAGS}")
+    SET(CFLAGS_LIST ${CFLAGS_STR})
+    SEPARATE_ARGUMENTS(CFLAGS_LIST)
+    FOREACH(OPTION ${CFLAGS_LIST})
+      TARGET_COMPILE_OPTIONS(${TARGET} ${PRIVACY} ${OPTION})
+    ENDFOREACH(OPTION)
+    SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SKIP_BUILD_RPATH true)
+  ENDFOREACH(I RANGE 2 ${DEST_INDEX})
+ENDFUNCTION(APPLY_PKG_CONFIG TARGET PRIVACY)
index 2800b9fe63b06f080e57b0e0691bcd9f896bffa3..f152a281da91464466089c6d7e13a9a9b876f0d7 100644 (file)
@@ -1,43 +1,34 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based-app-control CXX)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION ${FULLVER})
-
-INCLUDE(FindPkgConfig)
-
-SET(requires "glib-2.0 bundle dlog capi-appfw-app-control")
-SET(pc_requires "capi-appfw-app-control component-based-uri")
-
-pkg_check_modules(component-based-app-control REQUIRED ${requires})
-
-FOREACH(flag ${component-based-app-control_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based-app-control_LDFLAGS} component-based-uri)
-
-SET(PC_NAME component-based-app-control)
-SET(PC_REQUIRED ${pc_requires})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/app_control
-       FILES_MATCHING PATTERN "*.h")
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_CONTROL_SRCS)
+
+ADD_LIBRARY (${TARGET_COMPONENT_BASED_APP_CONTROL} SHARED ${APP_CONTROL_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_APP_CONTROL} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_APP_CONTROL} PROPERTIES
+  VERSION ${FULLVER})
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_APP_CONTROL} PROPERTIES
+  SOVERSION ${MAJORVER})
+TARGET_LINK_LIBRARIES(${TARGET_COMPONENT_BASED_APP_CONTROL} PUBLIC
+  ${TARGET_COMPONENT_BASED_URI})
+
+APPLY_PKG_CONFIG(${TARGET_COMPONENT_BASED_APP_CONTROL} PUBLIC
+  BUNDLE_DEPS
+  CAPI_APPFW_APP_CONTROL_DEPS
+  DLOG_DEPS
+  GLIB_DEPS
+)
+
+CONFIGURE_FILE(${TARGET_COMPONENT_BASED_APP_CONTROL}.pc.in
+  ${TARGET_COMPONENT_BASED_APP_CONTROL}.pc @ONLY)
+INSTALL(FILES ${TARGET_COMPONENT_BASED_APP_CONTROL}.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_APP_CONTROL}
+  DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
+  DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/app_control
+       FILES_MATCHING
+  PATTERN "*_implementation.h" EXCLUDE
+  PATTERN "*.h")
index 3d0ff131555384efc5dc14a13cb2a2c399220e84..afd88d8d161bf2317954643b4a23e556b4103683 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -273,4 +273,10 @@ app_control_h AppControl::GetHandle() const {
   return impl_->handle_;
 }
 
+app_control_h AppControl::Detach() {
+  auto h = impl_->handle_;
+  impl_->handle_ = nullptr;
+  return h;
+}
+
 }  // namespace component_based
index 8ecba0a427a5d6a9ad7656d420c545a209bce9a8..8e1649e632c5efa7c940b45d621febd9daac1a29 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -112,6 +112,7 @@ class EXPORT_API AppControl {
   std::string GetComponentID();
 
   app_control_h GetHandle() const;
+  app_control_h Detach();
 
  private:
   class Impl;
index 992e9b2c1444ef184b35b425b83786295bf2f2e4..c8f186ddf4d3fdc4f7bb2db3053b352e53c92769 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index ec231f61dd0f2dcd3f7b30fe3823cada061b1b69..a4bea1b2abe6bff585141e9570914e04244dbd9a 100644 (file)
@@ -1,51 +1,47 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based-core-base CXX)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION ${FULLVER})
-
-INCLUDE(FindPkgConfig)
-SET(requires "glib-2.0 bundle dlog ecore-wl2 appcore-multiwindow capi-appfw-app-control aul capi-appfw-app-common")
-SET(pc_requires "ecore-wl2 appcore-multiwindow capi-appfw-app-control component-based-app-control aul")
-
-pkg_check_modules(component-based-core-base REQUIRED ${requires})
-
-FOREACH(flag ${component-based-core-base_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -std=c++11")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/api)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based-core-base_LDFLAGS} component-based-app-control)
-
-SET(PC_NAME component-based-core-base)
-SET(PC_REQUIRED ${pc_requires})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc
-       DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} CORE_BASE_SRCS)
+
+ADD_LIBRARY(${TARGET_COMPONENT_BASED_CORE_BASE} SHARED ${CORE_BASE_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_CORE_BASE} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../
+  ${CMAKE_CURRENT_SOURCE_DIR}/api)
+
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_CORE_BASE} PROPERTIES
+  VERSION ${FULLVER})
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_CORE_BASE} PROPERTIES
+  SOVERSION ${MAJORVER})
+TARGET_LINK_LIBRARIES(${TARGET_COMPONENT_BASED_CORE_BASE} PUBLIC
+  ${TARGET_COMPONENT_BASED_APP_CONTROL})
+
+APPLY_PKG_CONFIG(${TARGET_COMPONENT_BASED_CORE_BASE} PUBLIC
+  APP_CORE_MULTI_WINDOW_NEXT_DEPS
+  AUL_DEPS
+  BUNDLE_DEPS
+  CAPI_APPFW_APP_COMMON_DEPS
+  CAPI_APPFW_APP_CONTROL_DEPS
+  DLOG_DEPS
+  ECORE_WL2_DEPS
+  GLIB_DEPS
+)
+
+SET(PC_NAME ${TARGET_COMPONENT_BASED_CORE_BASE})
+SET(PC_REQUIRED "app-core-multi-window-cpp aul capi-appfw-app-control component-based-app-control ecore-wl2")
+
+CONFIGURE_FILE(${TARGET_COMPONENT_BASED_CORE_BASE}.pc.in
+  ${TARGET_COMPONENT_BASED_CORE_BASE}.pc @ONLY)
+INSTALL(FILES ${TARGET_COMPONENT_BASED_CORE_BASE}.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_CORE_BASE}
+  DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
        DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/base
-       FILES_MATCHING PATTERN "*.h")
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/api DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/base
-       FILES_MATCHING PATTERN "*.h")
-
+       FILES_MATCHING
+  PATTERN "*_implementation.h" EXCLUDE
+  PATTERN "*.h")
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/api
+  DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/base
+       FILES_MATCHING
+  PATTERN "*.h")
diff --git a/component_based/base/action_event_interface.h b/component_based/base/action_event_interface.h
new file mode 100644 (file)
index 0000000..8fa69e4
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2019 - 2021 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 COMPONENT_BASED_BASE_ACTION_EVENT_INTERFACE_H_
+#define COMPONENT_BASED_BASE_ACTION_EVENT_INTERFACE_H_
+
+#include <memory>
+#include <string>
+
+#include "component_based/app_control/component_based_app_control.h"
+
+namespace component_based {
+class IActionEvent {
+ public:
+  virtual ~IActionEvent() = default;
+
+  virtual void OnAction(std::string action_name, AppControl control) = 0;
+};
+
+}  // namespace component_based
+
+#endif  // COMPONENT_BASED_BASE_ACTION_EVENT_INTERFACE_H_
index 363a92af3eda13a1f78baf231306b1a73ff15c84..fa828e2f70efff53f201a5a96e56b0f6cfa8838d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -25,7 +25,7 @@
 namespace component_based {
 namespace internal {
 
-Action::Action(std::string name, Action::IEventListener* ev)
+Action::Action(std::string name, IActionEvent* ev)
   : ev_(ev) {
   if (app_control_add_action_handler(name.c_str(), OnActionCB, ev_, &handle_)
       != APP_CONTROL_ERROR_NONE) {
@@ -40,7 +40,7 @@ Action::~Action() {
 
 void Action::OnActionCB(const char* action, app_control_h app_control,
                         void* user_data) {
-  IEventListener* ev = static_cast<IEventListener*>(user_data);
+  IActionEvent* ev = static_cast<IActionEvent*>(user_data);
   try {
     app_control_h clone = nullptr;
     app_control_clone(&clone, app_control);
index 109c1071d2427fe2406b90b3d069b241bb51a1b1..b12d4aaa5dfe24e63ca61f246f77993825b23e7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
 #include <string>
 
 #include "component_based/app_control/component_based_app_control.h"
+#include "component_based/base/action_event_interface.h"
 
 namespace component_based {
 namespace internal {
 
 class Action {
  public:
-  class IEventListener {
-   public:
-    virtual void OnAction(std::string action_name, AppControl control) = 0;
-  };
-
-  Action(std::string name, IEventListener* ev);
+  Action(std::string name, IActionEvent* ev);
   virtual ~Action();
 
  private:
@@ -40,7 +36,7 @@ class Action {
                          void* user_data);
 
  private:
-  IEventListener* ev_;
+  IActionEvent* ev_;
   app_control_action_h handle_ = nullptr;
 };
 
index 753f0e37972157996152652ec384dbb30b05214d..d1e8ae8d7a80400a0d241c0509c448cd86b16a81 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 9f2b868294c6b148709f26a17f0b45f5880c7674..767b61e429c1cc74c4dac8c1b247d9aa7a3fe1b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 0f2cace6332c565555ac977fb0e47dde32df833a..c9cbd9c7b3055c16ea9e0c8fa4a27d1e0b8b69a3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index ced8b5a4f3ad437014db7585a4435a0840202a81..261fca76a760e36228a8345522e7a4d4615071c8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 9ffaa9e9d4d750cdbe226c1c47d8a6bbeab21a9a..e1bbef70fb80e7a64fa6dc024b93547f4d2beebc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 5a4e2c6d2ec60bfebcaf7bd9960c7251618d4502..e57cdb5665dd8cdec03ab53a4f3906e1b37aab58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <appcore_multiwindow_base.h>
 #include <app_control_internal.h>
 #include <app_common.h>
 #include <aul.h>
 #include <dlog.h>
 #include <Ecore_Wl2.h>
 #include <bundle_cpp.h>
+#include <glib.h>
 
 #include <memory>
+#include <utility>
 
 #include "component_based/common/exception.h"
-#include "component_based/base/application_base_implementation.h"
 #include "component_based/base/application_base.h"
-#include "component_based/base/component_manager_internal.h"
 #include "component_based/base/dlog_internal.h"
 
+using namespace tizen_cpp;
+
 namespace component_based {
 
+class ApplicationBase::Impl {
+ public:
+  const std::string& GetApplicationID() {
+    return app_id_;
+  }
+
+  ~Impl() {
+    if (idler_ > 0)
+      g_source_remove(idler_);
+  }
+
+ private:
+  friend class ApplicationBase;
+  explicit Impl(ApplicationBase* parent);
+
+ private:
+  ApplicationBase* parent_;
+  std::string app_id_;
+  bool exiting_ = false;
+  std::pair<std::string, ApplicationBase*> pending_context_;
+  int idler_ = 0;
+  tizen_base::Bundle data_;
+};
+
 ApplicationBase::Impl::Impl(ApplicationBase* parent)
-  : parent_(parent), core_base_(new internal::CoreBase(this)) {
+  : parent_(parent) {
   LOGD("");
   char* id = nullptr;
   int r = app_get_id(&id);
@@ -45,113 +70,112 @@ ApplicationBase::Impl::Impl(ApplicationBase* parent)
   app_id_ = std::string(p.get());
 }
 
-void ApplicationBase::Impl::OnBaseInit(int argc, char** argv) {
+int ApplicationBase::OnCreate() {
   LOGD("");
-  parent_->OnInit(argc, argv);
-}
-
-void ApplicationBase::Impl::OnBaseFinish() {
-}
+  int ret = AppCoreMultiWindowBase::OnCreate();
+  auto facs = OnCreateFactoryMap();
 
-void ApplicationBase::Impl::OnBaseRun() {
-  LOGD("");
-  parent_->OnRun();
-}
-
-void ApplicationBase::Impl::OnBaseExit() {
-  LOGD("");
-  if (exiting_) {
-    LOGD("Already exiting");
-    return;
-  }
-
-  exiting_ = true;
-  parent_->OnExit();
-}
-
-bool ApplicationBase::Impl::OnBaseCreate() {
-  LOGD("");
-  auto facs = parent_->OnCreate();
   if (facs.size() == 0) {
     LOGW("Failed to create component factory");
-    return false;
+    return -1;
   }
 
-  auto iter = facs.begin();
-  while (iter != facs.end()) {
-    auto i = iter;
-    iter++;
-
-    auto comp_id = i->first;
-    auto factory = std::move(i->second);
-    auto& mgr = internal::ComponentManager::GetInst();
+  for (auto& i : facs) {
+    auto* f = i.second.release();
     try {
-      mgr.RegisterComponent(std::move(comp_id), std::move(factory));
+      AddContextFactory(std::shared_ptr<AppCoreMultiWindowBase::Context::IFactory>(f),
+          i.first);
     } catch(Exception& ex) {
       LOGE("Exception occurred (%s)", ex.what());
-      throw;
+      return -1;
     }
   }
 
-  return true;
+  return ret;
 }
 
-void ApplicationBase::Impl::OnBaseTerminate() {
+int ApplicationBase::OnTerminate() {
   LOGD("");
-  auto& mgr = internal::ComponentManager::GetInst();
-  mgr.ExitAll();
-  parent_->OnTerminate();
+  return AppCoreMultiWindowBase::OnTerminate();
 }
 
-void ApplicationBase::Impl::OnBaseReceive(aul_type type, bundle* b) {
+int ApplicationBase::OnReceive(aul_type type, tizen_base::Bundle b) {
   LOGD("type : %d", type);
+  AppCoreMultiWindowBase::OnReceive(type,
+      tizen_base::Bundle(b.GetHandle(), false, false));
+
+  std::string comp_id = b.GetString(AUL_K_COMPONENT_ID);
+  std::string inst_id = b.GetString(AUL_K_INSTANCE_ID);
+  std::string rpc_port = b.GetString(AUL_K_RPC_PORT);
+  std::string new_inst = b.GetString(AUL_K_NEW_INSTANCE);
+  Component* c = nullptr;
+  impl_->data_ = std::move(b);
+  std::shared_ptr<AppCoreMultiWindowBase::Context> cxt;
+  if (!comp_id.empty() && !inst_id.empty()) {
+    cxt = FindById(inst_id);
+    if (cxt.get() != nullptr) {
+      c = dynamic_cast<Component*>(cxt.get());
+      if (c == nullptr)
+        return -1;
+    } else {
+      cxt = CreateContext(comp_id, inst_id);
+      c = dynamic_cast<Component*>(cxt.get());
+      if (c == nullptr)
+        return -1;
+      if (new_inst == "true")
+        c->SetContentMgr(comp_id);
+      else
+        c->SetContentMgr(inst_id);
+      cxt = RunContext(cxt);
+      if (cxt.get() == nullptr) {
+        impl_->data_ = tizen_base::Bundle();
+        return 0;
+      }
+    }
+
+    LOGD("component(%s), instance(%s)", comp_id.c_str(), inst_id.c_str());
+  }
 
-  tizen_base::Bundle data;
-  if (b)
-    data = std::move(tizen_base::Bundle(b));
-  std::string comp_id = data.GetString(AUL_K_COMPONENT_ID);
-  std::string inst_id = data.GetString(AUL_K_INSTANCE_ID);
-  std::string rpc_port;
-  auto& mgr = internal::ComponentManager::GetInst();
-  LOGD("component(%s), instance(%s)", comp_id.c_str(), inst_id.c_str());
   switch (type) {
   case AUL_START:
-    rpc_port = data.GetString(AUL_K_RPC_PORT);
     if (rpc_port.empty())
-      mgr.Resume(inst_id);
-    mgr.Resume(inst_id);
-    mgr.Start(comp_id, inst_id, b);
+      c->Resume();
+    c->Start(std::move(impl_->data_));
     break;
   case AUL_RESUME:
     if (inst_id.empty()) {
-      mgr.ResumeAll();
+      auto cxts = GetContexts();
+      for (auto& i : cxts)
+        i->Resume();
     } else {
-      mgr.Resume(inst_id);
+      c->Resume();
     }
     break;
   case AUL_PAUSE:
     if (inst_id.empty()) {
-      mgr.PauseAll();
+      auto cxts = GetContexts();
+      for (auto& i : cxts)
+        i->Pause();
     } else {
-      mgr.Pause(inst_id);
+      c->Pause();
     }
     break;
   case AUL_TERMINATE_INST:
-    mgr.Exit(inst_id);
-    if (mgr.IsEmpty())
+    ExitContext(cxt);
+    if (GetContextCnt() == 0)
       Exit();
     break;
   case AUL_TERMINATE_BG_INST:
-    if (!mgr.IsResumed(inst_id)) {
-      mgr.Exit(inst_id);
-      if (mgr.IsEmpty())
+    if (!c->IsResumed()) {
+      ExitContext(cxt);
+      if (GetContextCnt() == 0)
         Exit();
     }
     break;
   case AUL_TERMINATE:
     break;
   case AUL_TERMINATE_BGAPP:
-    if (!core_base_->IsResumed()) {
+    if (!IsResumed()) {
       Exit();
     }
     break;
@@ -164,127 +188,92 @@ void ApplicationBase::Impl::OnBaseReceive(aul_type type, bundle* b) {
   default:
     break;
   }
-}
 
-void ApplicationBase::Impl::OnBaseControl(bundle* b) {
-  LOGD("");
+  impl_->data_ = tizen_base::Bundle();
+  return 0;
 }
 
-void ApplicationBase::Impl::OnWindowShow(int type, void* event) {
+void ApplicationBase::OnShow(int type, void* event) {
+  AppCoreMultiWindowBase::OnShow(type, event);
   Ecore_Wl2_Event_Window_Show* ev =
       static_cast<Ecore_Wl2_Event_Window_Show*>(event);
   LOGD("win(%u), parent_win(%u), event_win(%u)",
       ev->win, ev->parent_win, ev->event_win);
+  auto cxt = FindByWindowId(ev->win);
+  auto* c = dynamic_cast<Component*>(cxt.get());
+  if (c == nullptr)
+    return;
   if (ev->data[0] != 0) {
-    auto& mgr = internal::ComponentManager::GetInst();
-    std::string inst_id = mgr.GetInstanceID(ev->win);
-    mgr.AddGroup(inst_id, ev->data[0]);
+    c->AddGroup(ev->data[0]);
   }
 }
 
-void ApplicationBase::Impl::OnWindowHide(int type, void* event) {
+void ApplicationBase::OnHide(int type, void* event) {
+  AppCoreMultiWindowBase::OnHide(type, event);
   Ecore_Wl2_Event_Window_Hide* ev =
       static_cast<Ecore_Wl2_Event_Window_Hide*>(event);
   LOGD("win(%u), parent_win(%u), event_win(%u)",
       ev->win, ev->parent_win, ev->event_win);
 }
 
-void ApplicationBase::Impl::OnWindowLower(int type, void* event) {
+void ApplicationBase::OnLower(int type, void* event) {
+  AppCoreMultiWindowBase::OnLower(type, event);
   Ecore_Wl2_Event_Window_Lower* ev =
       static_cast<Ecore_Wl2_Event_Window_Lower*>(event);
   LOGD("win(%u), timestamp(%u)", ev->win, ev->timestamp);
-  auto& mgr = internal::ComponentManager::GetInst();
-  std::string inst_id = mgr.GetInstanceID(ev->win);
-  mgr.Stop(inst_id);
-  mgr.RemoveGroup(inst_id);
+  auto cxt = FindByWindowId(ev->win);
+  auto* c = dynamic_cast<Component*>(cxt.get());
+  if (c == nullptr)
+    return;
+  c->Stop();
+  if (c->RemoveGroup())
+    ExitContext(cxt);
 }
 
-void ApplicationBase::Impl::OnWindowVisibility(int type, void* event) {
+void ApplicationBase::OnVisibility(int type, void* event) {
+  AppCoreMultiWindowBase::OnVisibility(type, event);
   Ecore_Wl2_Event_Window_Visibility_Change* ev =
       static_cast<Ecore_Wl2_Event_Window_Visibility_Change*>(event);
   LOGD("win(%u), fully_obscured(%d)", ev->win, ev->fully_obscured);
 }
 
-void ApplicationBase::Impl::OnWindowPreVisibility(int type, void* event) {
+void ApplicationBase::OnPreVisibility(int type, void* event) {
+  AppCoreMultiWindowBase::OnPreVisibility(type, event);
   Ecore_Wl2_Event_Window_Pre_Visibility_Change* ev =
       static_cast<Ecore_Wl2_Event_Window_Pre_Visibility_Change*>(event);
   LOGD("win(%u), type(%u)", ev->win, ev->type);
 }
 
-void ApplicationBase::Impl::OnWindowAuxMessage(int type, void* event) {
+void ApplicationBase::OnAuxMessage(int type, void* event) {
+  AppCoreMultiWindowBase::OnAuxMessage(type, event);
   Ecore_Wl2_Event_Aux_Message* ev =
       static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
   LOGD("win(%u), key(%s), val(%s)", ev->win, ev->key, ev->val);
 }
 
-int ApplicationBase::Impl::Run(int argc, char** argv) {
-  int r = core_base_->Init(argc, argv);
-  if (r < 0) {
-    LOGE("Failed to initialize application");
-    return -1;
-  }
-
-  core_base_->Fini();
-  parent_->OnFini();
-
-  return 0;
-}
-
-void ApplicationBase::Impl::Exit() {
-  core_base_->Exit();
-}
-
 ApplicationBase::ApplicationBase()
   : impl_(new Impl(this)) {
 }
 
-ApplicationBase::~ApplicationBase() {
-}
-
-void ApplicationBase::Run(int argc, char** argv) {
-  if (impl_->Run(argc, argv) < 0)
-    return;
-}
+ApplicationBase::~ApplicationBase() = default;
 
 std::string ApplicationBase::GetApplicationID() {
   return impl_->GetApplicationID();
 }
 
-void ApplicationBase::Exit() {
-  impl_->Exit();
-}
-
-// LCOV_EXCL_START
-void ApplicationBase::OnInit(int argc, char** argv) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ApplicationBase::OnFini() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ApplicationBase::OnRun() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ApplicationBase::OnExit() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-std::map<std::string, std::unique_ptr<Component::Factory>>
-ApplicationBase::OnCreate() {
-  std::map<std::string, std::unique_ptr<Component::Factory>> facs;
-  return facs;
+void ApplicationBase::ExitContextAtIdle(const std::string& inst_id) {
+  impl_->pending_context_ = { inst_id, this };
+  impl_->idler_ = g_idle_add([](gpointer data) -> gboolean {
+        ApplicationBase* app = static_cast<ApplicationBase*>(data);
+        auto cxt = app->FindById(app->impl_->pending_context_.first);
+        app->ExitContext(cxt);
+        app->impl_->idler_ = 0;
+        return G_SOURCE_REMOVE;
+      }, this);
 }
-// LCOV_EXCL_STOP
 
-// LCOV_EXCL_START
-void ApplicationBase::OnTerminate() {
+tizen_base::Bundle& ApplicationBase::GetData() {
+  return impl_->data_;
 }
-// LCOV_EXCL_STOP
 
 }  // namespace component_based
index f1fb55c15aedffb7831a48eda71452ac59b36e71..2741465d87648e0fd6a885844660745b7cf880bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -17,6 +17,8 @@
 #ifndef COMPONENT_BASED_BASE_APPLICATION_BASE_H_
 #define COMPONENT_BASED_BASE_APPLICATION_BASE_H_
 
+#include <app_core_multi_window_base.hh>
+
 #include <list>
 #include <memory>
 #include <map>
 
 namespace component_based {
 
-class EXPORT_API ApplicationBase {
+class EXPORT_API ApplicationBase : public tizen_cpp::AppCoreMultiWindowBase {
  public:
   ApplicationBase();
   virtual ~ApplicationBase();
-  void Run(int argc, char** argv);
-  void Exit();
-
-  virtual void OnInit(int argc, char** argv);
-  virtual void OnFini();
-  virtual void OnRun();
-  virtual void OnExit();
-
-  virtual std::map<std::string, std::unique_ptr<Component::Factory>> OnCreate();
-  virtual void OnTerminate();
 
+  virtual std::map<std::string, std::unique_ptr<Component::FactoryBase>>
+      OnCreateFactoryMap() = 0;
+  int OnTerminate() override;
   std::string GetApplicationID();
+  void ExitContextAtIdle(const std::string& inst_id);
+  tizen_base::Bundle& GetData();
+
+ protected:
+  int OnCreate() override;
+  int OnReceive(aul_type type, tizen_base::Bundle b) override;
+  void OnShow(int type, void* event) override;
+  void OnHide(int type, void* event) override;
+  void OnLower(int type, void* event) override;
+  void OnVisibility(int type, void* event) override;
+  void OnPreVisibility(int type, void* event) override;
+  void OnAuxMessage(int type, void* event) override;
 
  private:
   class Impl;
diff --git a/component_based/base/application_base_implementation.h b/component_based/base/application_base_implementation.h
deleted file mode 100644 (file)
index 5821cf8..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2019 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 COMPONENT_BASED_BASE_APPLICATION_BASE_IMPLEMENTATION_H_
-#define COMPONENT_BASED_BASE_APPLICATION_BASE_IMPLEMENTATION_H_
-
-#include <string>
-
-#include "component_based/base/application_base.h"
-#include "component_based/base/core_base_internal.h"
-
-namespace component_based {
-
-class ApplicationBase::Impl : internal::CoreBase::IEventListener {
- public:
-  virtual ~Impl() = default;
-  void OnBaseInit(int argc, char** argv) override;
-  void OnBaseFinish() override;
-  void OnBaseRun() override;
-  void OnBaseExit() override;
-  bool OnBaseCreate() override;
-  void OnBaseTerminate() override;
-  void OnBaseReceive(aul_type type, bundle* b) override;
-  void OnBaseControl(bundle* b) override;
-
-  void OnWindowShow(int type, void* event) override;
-  void OnWindowHide(int type, void* event) override;
-  void OnWindowLower(int type, void* event) override;
-  void OnWindowPreVisibility(int type, void* event) override;
-  void OnWindowVisibility(int type, void* event) override;
-  void OnWindowAuxMessage(int type, void* event) override;
-
-  int Run(int argc, char** argv);
-  void Exit(void);
-
-  const std::string& GetApplicationID() {
-    return app_id_;
-  }
-
- private:
-  friend class ApplicationBase;
-  explicit Impl(ApplicationBase* parent);
-
- private:
-  ApplicationBase* parent_;
-  std::unique_ptr<internal::CoreBase> core_base_;
-  std::string app_id_;
-  bool exiting_ = false;
-};
-
-}  // namespace component_based
-
-#endif  // COMPONENT_BASED_BASE_APPLICATION_BASE_IMPLEMENTATION_H_
index 8b2d1cf05d3a002fdcc7dd5609e364ea575ea9ec..b75133e0e0c190de6ebbb241a61a23f8a64f5d9c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
  */
 
 #include <aul.h>
+#include <aul_app_group.h>
 #include <aul_comp_status.h>
 #include <app_control_internal.h>
 #include <bundle_cpp.h>
 
 #include <memory>
+#include <utility>
 
 #include "component_based/common/exception.h"
+#include "component_based/base/application_base.h"
 #include "component_based/base/component.h"
-#include "component_based/base/component_implementation.h"
-#include "component_based/base/component_manager_internal.h"
 #include "component_based/base/dlog_internal.h"
+#include "component_based/base/action_internal.h"
+#include "component_based/base/system_event_internal.h"
+#include "component_based/base/content_manager_internal.h"
 
-namespace component_based {
-
-Component::Impl::Impl(Component* parent, std::string comp_id,
-    std::string inst_id)
-  : parent_(parent), comp_id_(std::move(comp_id)), inst_id_(std::move(inst_id)),
-    sys_ev_(new internal::SystemEvent(this)) {
-  auto& mgr = internal::ComponentManager::GetInst();
-  if (mgr.IsSingleInstance(inst_id_))
-    content_mgr_.reset(new (std::nothrow) internal::ContentManager(comp_id_));
-  else
-    content_mgr_.reset(new (std::nothrow) internal::ContentManager(inst_id_));
-
-  mgr.AddEventListener(inst_id_, this);
-}
-
-bool Component::Impl::OnCreate() {
-  aul_comp_notify_start(inst_id_.c_str());
-
-  if (!parent_->OnBaseCreate())
-    return false;
-
-  state_ = State::Created;
-  aul_comp_status_update(inst_id_.c_str(), COMP_STATUS_CREATED);
-
-  return true;
-}
-
-void Component::Impl::OnDestroy() {
-  aul_comp_status_update(inst_id_.c_str(), COMP_STATUS_DESTROYED);
-
-  state_ = State::Dying;
-  parent_->OnBaseDestroy();
-
-  aul_comp_notify_exit(inst_id_.c_str());
-}
-
-void Component::Impl::OnStart(AppControl control, bool restarted) {
-  parent_->OnBaseStart(control, restarted);
-  if (state_ == State::Created ||
-      state_ == State::Paused ||
-      state_ == State::Stopped) {
-    state_ = State::Started;
-    aul_comp_status_update(inst_id_.c_str(), COMP_STATUS_STARTED);
-  }
-}
-
-void Component::Impl::OnResume() {
-  parent_->OnBaseResume();
-}
-
-void Component::Impl::OnPause() {
-  parent_->OnBasePause();
-}
-
-void Component::Impl::OnStop() {
-  if (state_ == State::None ||
-      state_ == State::Created ||
-      state_ == State::Stopped)
-    return;
-
-  parent_->OnBaseStop();
-  state_ = State::Stopped;
-}
-
-void Component::Impl::OnAction(std::string action, AppControl app_control) {
-  parent_->OnBaseAction(std::move(action), std::move(app_control));
-}
-
-void Component::Impl::OnLowMemory(LowMemory::Status status) {
-  parent_->OnBaseLowMemory(status);
-}
-
-void Component::Impl::OnLowBattery(LowBattery::Status status) {
-  parent_->OnBaseLowBattery(status);
-}
-
-void Component::Impl::OnDeviceOrientationChanged(
-       DeviceOrientation::Orientation orientation) {
-  parent_->OnBaseDeviceOrientationChanged(orientation);
-}
-
-void Component::Impl::OnLanguageChanged(std::string lang) {
-  parent_->OnBaseLanguageChanged(std::move(lang));
-}
-
-void Component::Impl::OnRegionFormatChanged(std::string region) {
-  parent_->OnBaseRegionFormatChanged(std::move(region));
-}
-
-void Component::Impl::OnSuspendedStateChanged(SuspendedState::State state) {
-  parent_->OnBaseSuspendedStateChanged(state);
-}
-
-// LCOV_EXCL_START
-bool Component::OnBaseCreate() {
-  return true;
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void Component::OnBaseDestroy() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void Component::OnBaseStart(AppControl control, bool restarted) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void Component::OnBaseResume() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void Component::OnBasePause() {
-}
-// LCOV_EXCL_STOP
+using namespace tizen_cpp;
 
-// LCOV_EXCL_START
-void Component::OnBaseStop() {
-}
-// LCOV_EXCL_STOP
+namespace component_based {
 
-// LCOV_EXCL_START
-void Component::OnBaseRestoreContent(tizen_base::Bundle content) {
-}
-// LCOV_EXCL_STOP
+namespace {
 
-// LCOV_EXCL_START
-void Component::OnBaseSaveContent(tizen_base::Bundle& content) {
+Ecore_Wl2_Window* __GetWl2Window(int win_id) {
+  Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(nullptr);
+  Ecore_Wl2_Window* win = ecore_wl2_display_window_find(display, win_id);
+  return win;
 }
-// LCOV_EXCL_STOP
 
-// LCOV_EXCL_START
-void Component::OnBaseAction(std::string action, AppControl app_control) {
-}
-// LCOV_EXCL_STOP
+}  // namespace
 
-// LCOV_EXCL_START
-void Component::OnBaseDeviceOrientationChanged(
-    DeviceOrientation::Orientation orientation) {
-}
-// LCOV_EXCL_STOP
+class Component::Impl {
+ public:
+  virtual ~Impl() = default;
 
-// LCOV_EXCL_START
-void Component::OnBaseLanguageChanged(std::string language) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void Component::OnBaseRegionFormatChanged(std::string region) {
-}
-// LCOV_EXCL_STOP
+  void SendAsync(AppControl control, AppControl::IEventListener* ev);
+  AppControl Send(AppControl control);
 
-// LCOV_EXCL_START
-void Component::OnBaseLowBattery(LowBattery::Status status) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void Component::OnBaseLowMemory(LowMemory::Status status) {
-}
-// LCOV_EXCL_STOP
+ private:
+  static void OnAppControlReply(app_control_h request, app_control_h reply,
+                                app_control_result_e result, void* user_data);
+  static void OnAppControlResult(app_control_h request,
+                                 app_control_error_e result, void* user_data);
 
-// LCOV_EXCL_START
-void Component::OnBaseSuspendedStateChanged(SuspendedState::State state) {
-}
-// LCOV_EXCL_STOP
-
-void Component::Impl::RegisterAction(std::string app_control_name) {
-  auto act_iter = act_map_.find(app_control_name);
-  if (act_iter != act_map_.end()) {
-    LOGW("Already exists");
-    return;
-  }
-
-  try {
-    std::unique_ptr<internal::Action> action = std::unique_ptr<internal::Action>(
-        new (std::nothrow) internal::Action(app_control_name, this));
-    if (action.get() == nullptr)
-      THROW(Exception::ErrorCodes::OutOfMemory);
-    act_map_[app_control_name] = std::move(action);
-  } catch(Exception& ex) {
-    LOGE("Exception occurred (%s)", ex.what());
-    throw;
-  }
-}
+ private:
+  friend class Component;
+  explicit Impl(Component* parent);
 
-bool Component::Impl::DeregisterAction(std::string app_control_name) {
-  auto act_iter = act_map_.find(app_control_name);
-  if (act_iter == act_map_.end()) {
-    LOGW("Not found");
-    return false;
-  }
+ private:
+  Component* parent_;
+  std::unique_ptr<internal::SystemEvent> sys_ev_;
+  std::unique_ptr<internal::ContentManager> content_mgr_;
+  State state_ = State::None;
+  std::map<std::string, std::unique_ptr<internal::Action>> act_map_;
+  bool restarted_ = false;
+  bool group_added_ = false;
+};
 
-  act_map_.erase(app_control_name);
-  return true;
+Component::Impl::Impl(Component* parent)
+  : parent_(parent), sys_ev_(new internal::SystemEvent(parent, parent->GetApp())) {
 }
 
-// LCOV_EXCL_START
 void Component::Impl::OnAppControlReply(app_control_h request,
                                         app_control_h reply,
                                         app_control_result_e result,
@@ -245,9 +93,7 @@ void Component::Impl::OnAppControlReply(app_control_h request,
     LOGE("Exception occurred (%s)", ex.what());
   }
 }
-// LCOV_EXCL_STOP
 
-// LCOV_EXCL_START
 void Component::Impl::OnAppControlResult(app_control_h request,
                                          app_control_error_e result,
                                          void* user_data) {
@@ -262,23 +108,6 @@ void Component::Impl::OnAppControlResult(app_control_h request,
     LOGE("Exception occurred (%s)", ex.what());
   }
 }
-// LCOV_EXCL_STOP
-
-Component::State Component::GetState() {
-  return impl_->state_;
-}
-
-void Component::SetState(Component::State state) {
-  impl_->state_ = state;
-}
-
-tizen_base::Bundle Component::GetContent() {
-  return impl_->content_mgr_->GetContent();
-}
-
-void Component::SetContent(tizen_base::Bundle content) {
-  impl_->content_mgr_->SetContent(std::move(content));
-}
 
 void Component::Impl::SendAsync(AppControl control,
                                 AppControl::IEventListener* ev) {
@@ -289,9 +118,9 @@ void Component::Impl::SendAsync(AppControl control,
   if (handle == nullptr)
     THROW(Exception::ErrorCodes::InvalidParameter);
 
-  int r = app_control_set_caller_instance_id(handle, inst_id_.c_str());
+  int r = app_control_set_caller_instance_id(handle, parent_->GetInstId().c_str());
   if (r != APP_CONTROL_ERROR_NONE) {
-    LOGE("Failed to set caller instance(%s)", inst_id_.c_str());
+    LOGE("Failed to set caller instance(%s)", parent_->GetInstId().c_str());
     THROW(Exception::ErrorCodes::InvalidParameter);
   }
 
@@ -309,9 +138,9 @@ AppControl Component::Impl::Send(AppControl control) {
   if (handle == nullptr)
     THROW(Exception::ErrorCodes::InvalidParameter);
 
-  int r = app_control_set_caller_instance_id(handle, inst_id_.c_str());
+  int r = app_control_set_caller_instance_id(handle, parent_->GetInstId().c_str());
   if (r != APP_CONTROL_ERROR_NONE) {
-    LOGE("Failed to set caller instance(%s)", inst_id_.c_str());
+    LOGE("Failed to set caller instance(%s)", parent_->GetInstId().c_str());
     THROW(Exception::ErrorCodes::InvalidParameter);
   }
 
@@ -331,36 +160,134 @@ AppControl Component::Impl::Send(AppControl control) {
   }
 }
 
-Component::Component(std::string comp_id, std::string inst_id)
-  : impl_(new Impl(this, std::move(comp_id), std::move(inst_id))) {
+void Component::RegisterAction(std::string app_control_name) {
+  auto act_iter = impl_->act_map_.find(app_control_name);
+  if (act_iter != impl_->act_map_.end()) {
+    LOGW("Already exists");
+    return;
+  }
+
+  try {
+    std::unique_ptr<internal::Action> action = std::unique_ptr<internal::Action>(
+        new (std::nothrow) internal::Action(app_control_name, this));
+    if (action.get() == nullptr)
+      THROW(Exception::ErrorCodes::OutOfMemory);
+    impl_->act_map_[app_control_name] = std::move(action);
+  } catch(Exception& ex) {
+    LOGE("Exception occurred (%s)", ex.what());
+    throw;
+  }
 }
 
-Component::~Component() = default;
+bool Component::DeregisterAction(std::string app_control_name) {
+  auto act_iter = impl_->act_map_.find(app_control_name);
+  if (act_iter == impl_->act_map_.end()) {
+    LOGW("Not found");
+    return false;
+  }
 
-std::string Component::GetComponentID() {
-  return impl_->GetComponentID();
+  impl_->act_map_.erase(app_control_name);
+  return true;
 }
 
-std::string Component::GetInstanceID() {
-  return impl_->GetInstanceID();
+void Component::OnCreate() {
+  aul_comp_notify_start(GetInstId().c_str());
+  impl_->state_ = State::Created;
+  aul_comp_status_update(GetInstId().c_str(), COMP_STATUS_CREATED);
 }
 
-void Component::Finish() {
-  auto& mgr = internal::ComponentManager::GetInst();
-  mgr.ExitAtIdle(impl_->GetInstanceID());
+void Component::OnTerminate() {
+  OnDestroy();
+  RemoveGroup();
+  aul_comp_status_update(GetInstId().c_str(), COMP_STATUS_DESTROYED);
+
+  impl_->state_ = State::Dying;
+  aul_comp_notify_exit(GetInstId().c_str());
 }
 
-void Component::RegisterAction(std::string app_control_name) {
-  try {
-    impl_->RegisterAction(std::move(app_control_name));
-  } catch(Exception& ex) {
-    LOGE("Exception occurred (%s)", ex.what());
-    throw;
+void Component::OnDestroy() {
+}
+
+void Component::OnStart(AppControl control, bool restarted) {
+  if (impl_->state_ == State::Created ||
+      impl_->state_ == State::Paused ||
+      impl_->state_ == State::Stopped) {
+    impl_->state_ = State::Started;
+    aul_comp_status_update(GetInstId().c_str(), COMP_STATUS_STARTED);
   }
 }
 
-bool Component::DeregisterAction(std::string app_control_name) {
-  return impl_->DeregisterAction(std::move(app_control_name));
+void Component::OnResume() {
+}
+
+void Component::OnPause() {
+}
+
+void Component::OnStop() {
+  if (impl_->state_ == State::None ||
+      impl_->state_ == State::Created ||
+      impl_->state_ == State::Stopped)
+    return;
+  impl_->state_ = State::Stopped;
+}
+
+void Component::OnRestoreContent(tizen_base::Bundle content) {
+}
+
+void Component::OnSaveContent(tizen_base::Bundle& content) {
+}
+
+void Component::OnAction(std::string action, AppControl app_control) {
+}
+
+void Component::OnDeviceOrientationChanged(
+    DeviceOrientation::Orientation orientation) {
+}
+
+void Component::OnLanguageChanged(std::string language) {
+}
+
+void Component::OnRegionFormatChanged(std::string region) {
+}
+
+void Component::OnLowBattery(LowBattery::Status status) {
+}
+
+void Component::OnLowMemory(LowMemory::Status status) {
+}
+
+void Component::OnSuspendedStateChanged(SuspendedState::State state) {
+}
+
+Component::State Component::GetState() {
+  return impl_->state_;
+}
+
+void Component::SetState(Component::State state) {
+  impl_->state_ = state;
+}
+
+tizen_base::Bundle Component::GetContent() {
+  return impl_->content_mgr_->GetContent();
+}
+
+void Component::SetContent(tizen_base::Bundle content) {
+  impl_->content_mgr_->SetContent(std::move(content));
+}
+
+Component::Component(std::string comp_id, std::string inst_id, AppCoreMultiWindowBase* app)
+  : AppCoreMultiWindowBase::Context(std::move(comp_id), std::move(inst_id), app),
+  impl_(new Impl(this)) {
+}
+
+Component::~Component() = default;
+
+void Component::Finish() {
+  auto* app = GetApp();
+  auto* my_app = dynamic_cast<ApplicationBase*>(app);
+  if (!my_app)
+    return;
+  my_app->ExitContextAtIdle(GetInstId());
 }
 
 void Component::SendAsync(AppControl control, AppControl::IEventListener* ev) {
@@ -381,8 +308,62 @@ AppControl Component::Send(AppControl control) {
   }
 }
 
-IComponentManager& Component::GetComponentManager() {
-  return internal::ComponentManager::GetInst();
+void Component::Resume() {
+  Ecore_Wl2_Window* wl_win = __GetWl2Window(GetWindowId());
+  if (wl_win == nullptr)
+    return;
+  ecore_wl2_window_activate(wl_win);
+}
+
+void Component::Pause() {
+  Ecore_Wl2_Window* wl_win = __GetWl2Window(GetWindowId());
+  if (wl_win == nullptr)
+    return;
+  ecore_wl2_window_iconified_set(wl_win, EINA_TRUE);
+}
+
+void Component::Start(tizen_base::Bundle b) {
+  app_control_h handle = nullptr;
+  app_control_create_event(b.GetHandle(), &handle);
+  try {
+    AppControl control(handle);
+    OnStart(control, impl_->restarted_);
+    impl_->restarted_ = true;
+  } catch(Exception& ex) {
+    LOGE("Exception occurred (%s)", ex.what());
+  }
+}
+
+void Component::Stop() {
+  Context::Pause();
+  OnStop();
+}
+
+void Component::AddGroup(int surf_id) {
+  LOGD("Group attach. instance(%s), surf(%d)", GetInstId().c_str(), surf_id);
+
+  aul_app_group_set_window_v2(GetInstId().c_str(), surf_id);
+  impl_->group_added_ = true;
+}
+
+bool Component::RemoveGroup() {
+  if (!impl_->group_added_)
+    return false;
+  LOGD("Group lower. instance(%s)", GetInstId().c_str());
+  bool exit = false;
+  aul_app_group_lower_v2(GetInstId().c_str(), &exit);
+  impl_->group_added_ = false;
+  return exit;
+}
+
+void Component::SetContentMgr(const std::string& id) {
+  impl_->content_mgr_.reset(new internal::ContentManager(id));
+}
+
+void Component::Exit() {
+  Context::Pause();
+  OnStop();
+  OnTerminate();
 }
 
 }  // namespace component_based
index a4de4a53172c2497511dbf34e136223320d29ce0..8ec0f633657137009d2c622e96d9f5f89d5ae962 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
 #ifndef COMPONENT_BASED_BASE_COMPONENT_H_
 #define COMPONENT_BASED_BASE_COMPONENT_H_
 
+#include <app_core_multi_window_base.hh>
 #include <bundle_cpp.h>
 
 #include <memory>
 #include <string>
 
-#include "component_based/app_control/component_based_app_control.h"
-#include "component_based/base/device_orientation.h"
-#include "component_based/base/low_battery.h"
-#include "component_based/base/low_memory.h"
-#include "component_based/base/suspended_state.h"
-#include "component_based/base/component_manager_interface.h"
+#include "component_based/base/action_event_interface.h"
+#include "component_based/base/system_event_interface.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
@@ -35,7 +32,8 @@
 
 namespace component_based {
 
-class EXPORT_API Component {
+class EXPORT_API Component : public tizen_cpp::AppCoreMultiWindowBase::Context,
+    public ISystemEvent, public IActionEvent {
  public:
   enum class State {
     None,
@@ -47,55 +45,51 @@ class EXPORT_API Component {
     Dying,
   };
 
-  class Type {
+  class FactoryBase : public tizen_cpp::AppCoreMultiWindowBase::Context::IFactory {
    public:
-    virtual int GetHash() const {
-      return 0;
-    }
+    FactoryBase(std::string comp_id) : comp_id_(comp_id) {}
 
-    virtual std::string GetName() const {
-      return "base";
+    std::string GetCompId() {
+      return comp_id_;
     }
-  };
 
-  class Factory {
-   public:
-    virtual std::unique_ptr<Component> Create(std::string comp_id,
-                                            std::string inst_id,
-                                            tizen_base::Bundle& start_data) = 0;
+   private:
+    std::string comp_id_;
   };
 
-  Component(std::string comp_id, std::string inst_id);
+  Component(std::string comp_id, std::string inst_id,
+      tizen_cpp::AppCoreMultiWindowBase* app);
   virtual ~Component();
 
-  virtual bool OnBaseCreate();
-  virtual void OnBaseDestroy();
-  virtual void OnBaseStart(AppControl control, bool restarted);
-  virtual void OnBaseResume();
-  virtual void OnBasePause();
-  virtual void OnBaseStop();
-  virtual void OnBaseRestoreContent(tizen_base::Bundle content);
-  virtual void OnBaseSaveContent(tizen_base::Bundle& content);
-  virtual void OnBaseAction(std::string action, AppControl app_control);
-  virtual void OnBaseDeviceOrientationChanged(
-      DeviceOrientation::Orientation orientation);
-  virtual void OnBaseLanguageChanged(std::string language);
-  virtual void OnBaseRegionFormatChanged(std::string region);
-  virtual void OnBaseLowBattery(LowBattery::Status status);
-  virtual void OnBaseLowMemory(LowMemory::Status status);
-  virtual void OnBaseSuspendedStateChanged(SuspendedState::State state);
-  virtual std::unique_ptr<Type> GetType() const {
-    return std::unique_ptr<Type>(new Type());
-  }
-
-  std::string GetComponentID();
-  std::string GetInstanceID();
+  virtual void OnDestroy();
+  void OnCreate() override;
+  void OnResume() override;
+  void OnPause() override;
+  void Pause() override;
+  void Resume() override;
+  void Exit() override;
+  virtual void Start(tizen_base::Bundle b);
+  virtual void Stop();
+  virtual void OnStart(AppControl control, bool restarted);
+  virtual void OnStop();
+  virtual void OnRestoreContent(tizen_base::Bundle content);
+  virtual void OnSaveContent(tizen_base::Bundle& content);
+  void OnAction(std::string action, AppControl app_control) override;
+  void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) override;
+  void OnLanguageChanged(std::string language) override;
+  void OnRegionFormatChanged(std::string region) override;
+  void OnLowBattery(LowBattery::Status status) override;
+  void OnLowMemory(LowMemory::Status status) override;
+  void OnSuspendedStateChanged(SuspendedState::State state) override;
   void Finish();
   void RegisterAction(std::string app_control_name);
   bool DeregisterAction(std::string app_control_name);
   void SendAsync(AppControl control, AppControl::IEventListener* ev);
   AppControl Send(AppControl control);
-  IComponentManager& GetComponentManager();
+  void AddGroup(int surf_id);
+  bool RemoveGroup();
+  void SetContentMgr(const std::string& id);
 
  protected:
   State GetState();
@@ -103,6 +97,9 @@ class EXPORT_API Component {
   tizen_base::Bundle GetContent();
   void SetContent(tizen_base::Bundle content);
 
+ private:
+   void OnTerminate() final;
+
  private:
   class Impl;
   std::unique_ptr<Impl> impl_;
diff --git a/component_based/base/component_implementation.h b/component_based/base/component_implementation.h
deleted file mode 100644 (file)
index b7165d4..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2019 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 COMPONENT_BASED_BASE_COMPONENT_IMPLEMENTATION_H_
-#define COMPONENT_BASED_BASE_COMPONENT_IMPLEMENTATION_H_
-
-#include <app_control.h>
-#include <bundle_cpp.h>
-
-#include <string>
-#include <map>
-#include <memory>
-
-#include "component_based/base/action_internal.h"
-#include "component_based/base/component.h"
-#include "component_based/base/component_manager_internal.h"
-#include "component_based/base/system_event_internal.h"
-#include "component_based/base/content_manager_internal.h"
-
-namespace component_based {
-
-class Component::Impl : internal::ComponentManager::IEventListener,
-                        internal::SystemEvent::IEventListener,
-                        internal::Action::IEventListener {
- public:
-
-  virtual ~Impl() = default;
-  bool OnCreate() override;
-  void OnDestroy() override;
-  void OnStart(AppControl control, bool restarted) override;
-  void OnResume() override;
-  void OnPause() override;
-  void OnStop() override;
-
-  void OnAction(std::string action, AppControl app_control) override;
-
-  void OnLowMemory(LowMemory::Status status) override;
-  void OnLowBattery(LowBattery::Status status) override;
-  void OnDeviceOrientationChanged(
-      DeviceOrientation::Orientation orientation) override;
-  void OnLanguageChanged(std::string lang) override;
-  void OnRegionFormatChanged(std::string region) override;
-  void OnSuspendedStateChanged(SuspendedState::State state) override;
-
-  void RegisterAction(std::string app_control_name);
-  bool DeregisterAction(std::string app_control_name);
-
-  const std::string& GetComponentID() {
-    return comp_id_;
-  }
-
-  const std::string& GetInstanceID() {
-    return inst_id_;
-  }
-
-  void SendAsync(AppControl control, AppControl::IEventListener* ev);
-  AppControl Send(AppControl control);
-
- private:
-  static void OnAppControlReply(app_control_h request, app_control_h reply,
-                                app_control_result_e result, void* user_data);
-  static void OnAppControlResult(app_control_h request,
-                                 app_control_error_e result, void* user_data);
-
- private:
-  friend class Component;
-  Impl(Component* parent, std::string comp_id, std::string inst_id);
-
- private:
-  Component* parent_;
-  std::string comp_id_;
-  std::string inst_id_;
-  std::unique_ptr<internal::SystemEvent> sys_ev_;
-  std::unique_ptr<internal::ContentManager> content_mgr_;
-  State state_ = State::None;
-  std::map<std::string, std::unique_ptr<internal::Action>> act_map_;
-};
-
-}  // namespace component_base
-
-#endif  // COMPONENT_BASED_BASE_COMPONENT_IMPLEMENTATION_H_
diff --git a/component_based/base/component_manager_interface.h b/component_based/base/component_manager_interface.h
deleted file mode 100644 (file)
index 1e47244..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2020 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 COMPONENT_BASED_BASE_COMPONENT_MANAGER_INTERFACE_H_
-#define COMPONENT_BASED_BASE_COMPONENT_MANAGER_INTERFACE_H_
-
-#include <string>
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-namespace component_based {
-
-class EXPORT_API IComponentManager {
- public:
-  virtual bool IsResumed(const std::string& inst_id) = 0;
-};
-
-}  // namespace component_based
-
-#endif  // COMPONENT_BASED_BASE_COMPONENT_MANAGER_INTERFACE_H_
diff --git a/component_based/base/component_manager_internal.cc b/component_based/base/component_manager_internal.cc
deleted file mode 100644 (file)
index fd34a22..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Copyright (c) 2019 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 <aul.h>
-#include <aul_app_group.h>
-#include <app_control_internal.h>
-#include <bundle_internal.h>
-#include <glib.h>
-
-#include <algorithm>
-#include <memory>
-#include <string>
-
-#include "component_based/common/exception.h"
-#include "component_based/base/component_manager_internal.h"
-#include "component_based/base/dlog_internal.h"
-
-namespace component_based {
-namespace internal {
-
-void ComponentManager::RegisterComponent(const std::string& comp_id,
-    std::unique_ptr<Component::Factory> factory) {
-  auto i = fac_map_.find(comp_id);
-  if (i == fac_map_.end()) {
-    appcore_multiwindow_base_class cls =
-        appcore_multiwindow_base_class_get_default();
-    cls.id = strdup(comp_id.c_str());
-    if (cls.id == nullptr)
-      throw std::bad_alloc();
-    cls.data = this;
-    cls.create = OnCreateCB;
-    cls.terminate = OnTerminateCB;
-    cls.pause = OnPauseCB;
-    cls.resume = OnResumeCB;
-    appcore_multiwindow_base_class_add(cls);
-  }
-
-  fac_map_[comp_id] = std::move(factory);
-}
-
-void ComponentManager::AddEventListener(const std::string& inst_id,
-    ComponentManager::IEventListener* ev) {
-  ev_map_[inst_id] = ev;
-}
-
-void ComponentManager::Start(const std::string& comp_id,
-                             const std::string& inst_id,
-                             bundle* b) {
-  bool restarted = true;
-  auto inst_iter = inst_map_.find(inst_id);
-  if (inst_iter == inst_map_.end()) {
-    auto fac_iter = fac_map_.find(comp_id);
-    if (fac_iter == fac_map_.end()) {
-      LOGE("Failed to find factory map. %s", comp_id.c_str());
-      return;
-    }
-
-    const char *val = bundle_get_val(b, AUL_K_NEW_INSTANCE);
-    std::string new_inst(val ? val : "");
-    if (new_inst == "true")
-      multi_inst_list_.push_back(inst_id);
-
-    tizen_base::Bundle start_data(b, false, false);
-    std::unique_ptr<Component> component = fac_map_[comp_id]->Create(comp_id,
-        inst_id, start_data);
-    if (component == nullptr || component.get() == nullptr) {
-      LOGE("Fail to create component");
-      return;
-    }
-
-    inst_map_[inst_id] = std::move(component);
-    appcore_multiwindow_base_instance_run(comp_id.c_str(), inst_id.c_str(),
-        nullptr);
-    restarted = false;
-  }
-
-  auto ev_iter = ev_map_.find(inst_id);
-  if (ev_iter == ev_map_.end())
-    return;
-
-  app_control_h handle = nullptr;
-  app_control_create_event(b, &handle);
-  try {
-    AppControl control(handle);
-    ev_map_[inst_id]->OnStart(control, restarted);
-  } catch(Exception& ex) {
-    LOGE("Exception occurred (%s)", ex.what());
-  }
-}
-
-void ComponentManager::Resume(const std::string& inst_id) {
-  Ecore_Wl2_Window* wl_win = GetWl2Window(inst_id);
-  if (wl_win == nullptr)
-    return;
-  ecore_wl2_window_activate(wl_win);
-}
-
-void ComponentManager::Pause(const std::string& inst_id) {
-  Ecore_Wl2_Window* wl_win = GetWl2Window(inst_id);
-  if (wl_win == nullptr)
-    return;
-  ecore_wl2_window_iconified_set(wl_win, EINA_TRUE);
-}
-
-void ComponentManager::Stop(const std::string& inst_id) {
-  auto ev_iter = ev_map_.find(inst_id);
-  if (ev_iter == ev_map_.end())
-    return;
-
-  ev_map_[inst_id]->OnPause();
-  ev_map_[inst_id]->OnStop();
-}
-
-bool ComponentManager::IsResumed(const std::string& inst_id) {
-  appcore_multiwindow_base_instance_h context =
-    appcore_multiwindow_base_instance_find(inst_id.c_str());
-  if (!context) {
-    LOGE("Failed to find instance(%s)", inst_id.c_str());
-    return false;
-  }
-
-  return appcore_multiwindow_base_instance_is_resumed(context);
-}
-
-void ComponentManager::Exit(const std::string& inst_id) {
-  appcore_multiwindow_base_instance_h context =
-      appcore_multiwindow_base_instance_find(inst_id.c_str());
-  if (!context) {
-    LOGE("Failed to find instance(%s)", inst_id.c_str());
-    return;
-  }
-
-  appcore_multiwindow_base_instance_exit(context);
-}
-
-void ComponentManager::ExitAtIdle(const std::string& inst_id) {
-  g_idle_add([](gpointer data) -> gboolean {
-        char* inst_id = static_cast<char*>(data);
-        ComponentManager::GetInst().Exit(inst_id);
-        free(inst_id);
-        return G_SOURCE_REMOVE;
-      }, strdup(inst_id.c_str()));
-}
-
-void ComponentManager::ExitAll() {
-  if (inst_map_.empty())
-    return;
-
-  auto iter = inst_map_.begin();
-  while (iter != inst_map_.end()) {
-    auto i = iter;
-    LOGD("Exit instance(%s)", i->first.c_str());
-    iter++;
-    Exit(i->first);
-  }
-}
-
-bool ComponentManager::Bind(const std::string& inst_id,
-                            std::unique_ptr<IWindow> win) {
-  appcore_multiwindow_base_instance_h context =
-      appcore_multiwindow_base_instance_find(inst_id.c_str());
-  if (!context) {
-    LOGE("Failed to find instance(%s)", inst_id.c_str());
-    return false;
-  }
-
-  win_map_[inst_id] = std::move(win);
-  Ecore_Wl2_Window* wl_win = GetWl2Window(inst_id);
-  if (!wl_win) {
-    LOGE("Failed to get wayland window(%s)", inst_id.c_str());
-    return false;
-  }
-
-  appcore_multiwindow_base_window_bind(context, wl_win);
-  LOGI("Bind instance(%s)", inst_id.c_str());
-  return true;
-}
-
-void ComponentManager::Unbind(const std::string& inst_id) {
-  auto win_iter = win_map_.find(inst_id);
-  if (win_iter == win_map_.end()) {
-    return;
-  }
-
-  appcore_multiwindow_base_instance_h context =
-      appcore_multiwindow_base_instance_find(inst_id.c_str());
-  if (context) {
-    appcore_multiwindow_base_window_unbind(context);
-  }
-  win_map_.erase(inst_id);
-  LOGI("Unbind instance(%s)", inst_id.c_str());
-}
-
-ComponentManager::IEventListener* ComponentManager::GetEventListener(
-    const std::string& inst_id) {
-  auto ev_iter = ev_map_.find(inst_id);
-  if (ev_iter == ev_map_.end())
-    return nullptr;
-
-  return ev_map_[inst_id];
-}
-
-std::string ComponentManager::GetInstanceID(int win_id) {
-  for (auto i = win_map_.begin(); i != win_map_.end(); i++) {
-    auto& win = *i->second;
-    if (win.GetResID() == win_id)
-      return i->first;
-  }
-
-  return std::string("");
-}
-
-const IWindow* ComponentManager::GetWindow(const std::string& inst_id) {
-  auto win_iter = win_map_.find(inst_id);
-  if (win_iter == win_map_.end())
-    return nullptr;
-
-  return &*win_map_[inst_id];
-}
-
-void ComponentManager::AddGroup(const std::string& inst_id, int surf_id) {
-  auto group_iter = group_map_.find(inst_id);
-  if (group_iter != group_map_.end())
-    return;
-
-  LOGD("Group attach. instance(%s), surf(%d)", inst_id.c_str(), surf_id);
-
-  aul_app_group_set_window_v2(inst_id.c_str(), surf_id);
-  group_map_[inst_id] = surf_id;
-}
-
-void ComponentManager::RemoveGroup(const std::string& inst_id) {
-  auto group_iter = group_map_.find(inst_id);
-  if (group_iter == group_map_.end())
-    return;
-
-  LOGD("Group lower. instance(%s)", inst_id.c_str());
-  bool exit = false;
-  aul_app_group_lower_v2(inst_id.c_str(), &exit);
-  if (exit) {
-    Exit(inst_id);
-  }
-
-  group_map_.erase(inst_id);
-}
-
-bool ComponentManager::IsEmpty() {
-  return inst_map_.empty();
-}
-
-void ComponentManager::ResumeAll() {
-  if (inst_map_.empty())
-    return;
-
-  for (auto i = inst_map_.begin(); i != inst_map_.end(); i++) {
-    LOGD("Resume instance(%s)", i->first.c_str());
-    Resume(i->first);
-  }
-}
-
-void ComponentManager::PauseAll() {
-  if (inst_map_.empty())
-    return;
-
-  for (auto i = inst_map_.begin(); i != inst_map_.end(); i++) {
-    LOGD("Pause instance(%s)", i->first.c_str());
-    Pause(i->first);
-  }
-}
-
-bool ComponentManager::IsSingleInstance(const std::string& inst_id) {
-  auto it = std::find(multi_inst_list_.begin(), multi_inst_list_.end(),
-      inst_id);
-  if (it == multi_inst_list_.end())
-    return true;
-
-  return false;
-}
-
-Ecore_Wl2_Window* ComponentManager::GetWl2Window(const std::string& inst_id) {
-  auto win_iter = win_map_.find(inst_id);
-  if (win_iter == win_map_.end())
-    return nullptr;
-
-  int win_id = win_map_[inst_id]->GetResID();
-  Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
-  Ecore_Wl2_Window* win = ecore_wl2_display_window_find(display, win_id);
-  return win;
-}
-
-void ComponentManager::Remove(const std::string& inst_id) {
-  multi_inst_list_.remove(inst_id);
-  RemoveGroup(inst_id);
-  ev_map_.erase(inst_id);
-  inst_map_.erase(inst_id);
-  win_map_.erase(inst_id);
-}
-
-void ComponentManager::OnCreateCB(appcore_multiwindow_base_instance_h context,
-                                  void* data) {
-  std::string inst_id = appcore_multiwindow_base_instance_get_id(context);
-  auto& mgr = ComponentManager::GetInst();
-  ComponentManager::IEventListener* ev = mgr.GetEventListener(inst_id);
-  if (!ev->OnCreate()) {
-    mgr.Exit(inst_id);
-  }
-}
-
-void ComponentManager::OnTerminateCB(
-    appcore_multiwindow_base_instance_h context, void* data) {
-  std::string inst_id = appcore_multiwindow_base_instance_get_id(context);
-  auto& mgr = ComponentManager::GetInst();
-  ComponentManager::IEventListener* ev = mgr.GetEventListener(inst_id);
-  ev->OnPause();
-  ev->OnStop();
-  ev->OnDestroy();
-  mgr.Remove(inst_id);
-
-  if (appcore_multiwindow_base_instance_get_cnt() == 1) {
-    LOGD("Exit");
-    appcore_multiwindow_base_exit();
-  }
-}
-
-void ComponentManager::OnPauseCB(appcore_multiwindow_base_instance_h context,
-                                 void* data) {
-  std::string inst_id = appcore_multiwindow_base_instance_get_id(context);
-  auto& mgr = ComponentManager::GetInst();
-  ComponentManager::IEventListener* ev = mgr.GetEventListener(inst_id);
-  ev->OnPause();
-}
-
-void ComponentManager::OnResumeCB(appcore_multiwindow_base_instance_h context,
-                                  void* data) {
-  std::string inst_id = appcore_multiwindow_base_instance_get_id(context);
-  auto& mgr = ComponentManager::GetInst();
-  ComponentManager::IEventListener* ev = mgr.GetEventListener(inst_id);
-  ev->OnResume();
-}
-
-}  // namespace internal
-}  // namespace component_based
diff --git a/component_based/base/component_manager_internal.h b/component_based/base/component_manager_internal.h
deleted file mode 100644 (file)
index be5470e..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2019 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 COMPONENT_BASED_BASE_COMPONENT_MANAGER_INTERNAL_H_
-#define COMPONENT_BASED_BASE_COMPONENT_MANAGER_INTERNAL_H_
-
-#include <appcore_multiwindow_base.h>
-
-#include <list>
-#include <map>
-#include <memory>
-#include <string>
-
-#include "component_based/base/component.h"
-#include "component_based/base/window_interface.h"
-#include "component_based/base/window_component_manager_interface.h"
-
-namespace component_based {
-namespace internal {
-
-class ComponentManager : public IWindowComponentManager {
- private:
-  ComponentManager() = default;
-  ~ComponentManager() = default;
-
- public:
-  class IEventListener {
-   public:
-    virtual bool OnCreate() = 0;
-    virtual void OnDestroy() = 0;
-    virtual void OnStart(AppControl app_control, bool restarted) = 0;
-    virtual void OnPause() = 0;
-    virtual void OnResume() = 0;
-    virtual void OnStop() = 0;
-  };
-
- public:
-  static ComponentManager& GetInst() {
-    static ComponentManager inst;
-    return inst;
-  }
-
-  void AddEventListener(const std::string& inst_id, IEventListener* ev);
-  void RegisterComponent(const std::string& comp_id,
-                         std::unique_ptr<Component::Factory> factory);
-
-  void Start(const std::string& comp_id, const std::string& inst_id, bundle* b);
-  void Resume(const std::string& inst_id);
-  void Pause(const std::string& inst_id);
-  bool IsResumed(const std::string& inst_id) override;
-  void Stop(const std::string& inst_id);
-
-  void Exit(const std::string& inst_id);
-  void ExitAtIdle(const std::string& inst_id);
-  void ExitAll();
-  bool Bind(const std::string& inst_id, std::unique_ptr<IWindow> win) override;
-  void Unbind(const std::string& inst_id);
-  std::string GetInstanceID(int win_id);
-  const IWindow* GetWindow(const std::string& inst_id) override;
-  void AddGroup(const std::string& inst_id, int surf_id);
-  void RemoveGroup(const std::string& inst_id);
-  bool IsEmpty();
-  void ResumeAll();
-  void PauseAll();
-  bool IsSingleInstance(const std::string& inst_id);
-
- private:
-  IEventListener* GetEventListener(const std::string& inst_id);
-  Ecore_Wl2_Window* GetWl2Window(const std::string& inst_id);
-  void Remove(const std::string& inst_id);
-
- private:
-  static void OnCreateCB(appcore_multiwindow_base_instance_h context,
-                         void* data);
-  static void OnTerminateCB(appcore_multiwindow_base_instance_h context,
-                            void* data);
-  static void OnPauseCB(appcore_multiwindow_base_instance_h context,
-                        void* data);
-  static void OnResumeCB(appcore_multiwindow_base_instance_h context,
-                         void* data);
-
- private:
-  std::map<std::string, IEventListener*> ev_map_;
-  std::map<std::string, std::unique_ptr<Component::Factory>> fac_map_;
-  std::map<std::string, std::unique_ptr<Component>> inst_map_;
-  std::map<std::string, std::unique_ptr<IWindow>> win_map_;
-  std::map<std::string, int> group_map_;
-  std::list<std::string> multi_inst_list_;
-};
-
-}  // namespace internal
-}  // namespace component_based
-
-#endif  // COMPONENT_BASED_BASE_COMPONENT_MANAGER_INTERNAL_H_
index 0a7301abe82006fd2d2623d6523d96d7c10070b0..f39cd87decfd42f48111ece42a1520c89ca28471 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -23,6 +23,7 @@
 #include <bundle_cpp.h>
 
 #include <algorithm>
+#include <utility>
 
 #include "component_based/base/content_manager_internal.h"
 #include "component_based/base/dlog_internal.h"
index 2b4722aa3fffa3dcdfc98731cbad14b06ecfcac7..441ca90922775f7514856fdb93966cac48db48c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
 #ifndef COMPONENT_BASED_BASE_CONTENT_MANAGER_INTERNAL_H_
 #define COMPONENT_BASED_BASE_CONTENT_MANAGER_INTERNAL_H_
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 #include <app_common.h>
 #include <bundle_cpp.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 
 #include <memory>
 #include <string>
diff --git a/component_based/base/core_base_internal.h b/component_based/base/core_base_internal.h
deleted file mode 100644 (file)
index 75b058a..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 2019 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 COMPONENT_BASED_BASE_CORE_BASE_INTERNAL_H_
-#define COMPONENT_BASED_BASE_CORE_BASE_INTERNAL_H_
-
-#include <appcore_multiwindow_base.h>
-
-#include <string>
-
-namespace component_based {
-namespace internal {
-
-class CoreBase {
- public:
-  class IEventListener {
-   public:
-    virtual void OnBaseInit(int argc, char** argv) = 0;
-    virtual void OnBaseFinish() = 0;
-    virtual void OnBaseRun() = 0;
-    virtual void OnBaseExit() = 0;
-    virtual bool OnBaseCreate() = 0;
-    virtual void OnBaseTerminate() = 0;
-    virtual void OnBaseReceive(aul_type type, bundle* b) = 0;
-    virtual void OnBaseControl(bundle* b) = 0;
-
-    virtual void OnWindowShow(int type, void* event) = 0;
-    virtual void OnWindowHide(int type, void* event) = 0;
-    virtual void OnWindowLower(int type, void* event) = 0;
-    virtual void OnWindowVisibility(int type, void* event) = 0;
-    virtual void OnWindowPreVisibility(int type, void* event) = 0;
-    virtual void OnWindowAuxMessage(int type, void* event) = 0;
-  };
-
-  explicit CoreBase(IEventListener* ev)
-    : ev_(ev), ops_(appcore_multiwindow_base_get_default_ops()) {
-    ops_.base.init = OnInitCB;
-    ops_.base.finish = OnFinishCB;
-    ops_.base.run = OnRunCB;
-    ops_.base.exit = OnExitCB;
-    ops_.base.create = OnCreateCB;
-    ops_.base.terminate = OnTerminateCB;
-    ops_.base.control = OnControlCB;
-    ops_.base.receive = OnReceiveCB;
-
-    ops_.window.show = OnShowCB;
-    ops_.window.hide = OnHideCB;
-    ops_.window.lower = OnLowerCB;
-    ops_.window.visibility = OnVisibilityCB;
-    ops_.window.pre_visibility = OnPreVisibilityCB;
-    ops_.window.aux_message = OnAuxMessageCB;
-  }
-
-  int Init(int argc, char** argv) {
-    return appcore_multiwindow_base_init(ops_, argc, argv, ev_);
-  }
-
-  void Fini() {
-    appcore_multiwindow_base_fini();
-  }
-
-  void Exit() {
-    appcore_multiwindow_base_exit();
-  }
-
-  bool IsResumed() {
-    return appcore_multiwindow_base_window_is_resumed();
-  }
-
-  virtual ~CoreBase() = default;
-
- private:
-  static void OnInitCB(int argc, char** argv, void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnBaseInit(argc, argv);
-  }
-
-  static void OnFinishCB(void) {
-  }
-
-  static void OnRunCB(void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnBaseRun();
-  }
-
-  static void OnExitCB(void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnBaseExit();
-  }
-
-  static int OnCreateCB(void* data) {
-    appcore_multiwindow_base_on_create();
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    if (!ev->OnBaseCreate())
-      return -1;
-
-    return 0;
-  }
-
-  static int OnTerminateCB(void* data) {
-    appcore_multiwindow_base_on_terminate();
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnBaseTerminate();
-    return 0;
-  }
-
-  static int OnReceiveCB(aul_type type, bundle* b, void* data) {
-    appcore_multiwindow_base_on_receive(type, b);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnBaseReceive(type, b);
-    return 0;
-  }
-
-  static int OnControlCB(bundle* b, void *data) {
-    appcore_multiwindow_base_on_control(b);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnBaseControl(b);
-    return 0;
-  }
-
-  static void OnShowCB(int type, void* event, void* data) {
-    appcore_multiwindow_base_window_on_show(type, event);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnWindowShow(type, event);
-  }
-
-  static void OnHideCB(int type, void* event, void* data) {
-    appcore_multiwindow_base_window_on_hide(type, event);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnWindowHide(type, event);
-  }
-
-  static void OnLowerCB(int type, void* event, void* data) {
-    appcore_multiwindow_base_window_on_lower(type, event);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnWindowLower(type, event);
-  }
-
-  static void OnVisibilityCB(int type, void* event, void* data) {
-    appcore_multiwindow_base_window_on_visibility(type, event);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnWindowVisibility(type, event);
-  }
-
-  static void OnPreVisibilityCB(int type, void* event, void* data) {
-    appcore_multiwindow_base_window_on_pre_visibility(type, event);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnWindowPreVisibility(type, event);
-  }
-
-  static void OnAuxMessageCB(int type, void* event, void* data) {
-    appcore_multiwindow_base_window_on_aux_message(type, event);
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    ev->OnWindowAuxMessage(type, event);
-  }
-
- private:
-  IEventListener* ev_;
-  appcore_multiwindow_base_ops ops_;
-};
-
-}  // namespace internal
-}  // namespace component_based
-
-#endif  // COMPONENT_BASED_BASE_CORE_BASE_INTERNAL_H_
index b290a27bdd33208b566d4a24a82d542e4fda8c94..6ed456ecdb58d482e84ca93e7354438490c8d65a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index e63d1f1c7cdc358150484dca79cd65d2c944729e..149eec1c5bff5cf1a5e6f2cdfdfd1d563a6e4115 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 5d7646fcc5a6301d67f26eb038e5973969513d70..510e1dcfdf11ae9d41429706f6411728df930fa9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
 #include <aul_comp_status.h>
 
 #include <memory>
+#include <utility>
 
-#include "component_based/base/component_manager_internal.h"
 #include "component_based/base/dlog_internal.h"
 #include "component_based/base/frame_component.h"
 
 namespace component_based {
 
-FrameComponent::FrameComponent(std::string comp_id, std::string inst_id)
-  : Component::Component(std::move(comp_id), std::move(inst_id)) {
+FrameComponent::FrameComponent(std::string comp_id, std::string inst_id,
+    tizen_cpp::AppCoreMultiWindowBase* app)
+    : Component::Component(std::move(comp_id), std::move(inst_id), app) {
 }
 
 FrameComponent::~FrameComponent() = default;
 
-FrameComponent::DisplayStatus FrameComponent::GetDisplayStatus() {
+FrameComponent::DisplayStatus FrameComponent::GetDisplayStatus() const {
   app_display_state_e state;
   int r = app_get_display_state(&state);
   if (r != APP_ERROR_NONE) {
@@ -46,128 +47,61 @@ FrameComponent::DisplayStatus FrameComponent::GetDisplayStatus() {
   return FrameComponent::DisplayStatus::Off;
 }
 
-const IWindow* FrameComponent::GetWindow() {
-  IComponentManager& manager = GetComponentManager();
-  IWindowComponentManager& w_manager =
-      static_cast<IWindowComponentManager&>(manager);
-  return w_manager.GetWindow(GetInstanceID());
+const IWindow* FrameComponent::GetWindow() const {
+  return win_.get();
 }
 
-bool FrameComponent::OnBaseCreate() {
-  std::unique_ptr<IWindow> win = OnCreate();
+void FrameComponent::OnCreate() {
+  Component::OnCreate();
+  std::unique_ptr<IWindow> win = OnCreateWindow();
   if (win == nullptr) {
     LOGE("OnCreate() returns nullptr");
-    return false;
+    throw std::runtime_error("Can't create window");
   }
 
-  IComponentManager& manager = GetComponentManager();
-  IWindowComponentManager& w_manager =
-      static_cast<IWindowComponentManager&>(manager);
-  if (!w_manager.Bind(GetInstanceID(), std::move(win))) {
-    LOGE("Bind window fail");
-    return false;
+  Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(nullptr);
+  Ecore_Wl2_Window* wl2_win = ecore_wl2_display_window_find(display, win->GetResID());
+  if (!wl2_win) {
+    LOGE("invalid window id");
+    throw std::runtime_error("invalid window id");
   }
 
-  return true;
+  WindowBind(wl2_win);
+  win_ = std::move(win);
 }
 
-void FrameComponent::OnBaseDestroy() {
-  OnDestroy();
-}
-
-void FrameComponent::OnBaseStart(AppControl control, bool restarted) {
+void FrameComponent::OnStart(AppControl control, bool restarted) {
+  Component::OnStart(control, restarted);
   if (GetState() == State::Running)
     return;
 
   tizen_base::Bundle content = GetContent();
-  OnBaseRestoreContent(content);
-  OnStart(control, restarted);
+  OnRestoreContent(content);
 }
 
-void FrameComponent::OnBaseResume() {
+void FrameComponent::OnResume() {
+  Component::OnResume();
   if (GetState() == State::Paused ||
       GetState() == State::Started ||
       GetState() == State::Stopped) {
-    OnResume();
     SetState(State::Running);
-    aul_comp_status_update(GetInstanceID().c_str(), COMP_STATUS_RESUMED);
+    aul_comp_status_update(GetInstId().c_str(), COMP_STATUS_RESUMED);
   }
 }
 
-void FrameComponent::OnBasePause() {
+void FrameComponent::OnPause() {
   if (GetState() == State::Running) {
-    OnPause();
     SetState(State::Paused);
-    aul_comp_status_update(GetInstanceID().c_str(), COMP_STATUS_PAUSED);
+    aul_comp_status_update(GetInstId().c_str(), COMP_STATUS_PAUSED);
   }
+  Component::OnPause();
 }
 
-void FrameComponent::OnBaseStop() {
-  OnStop();
+void FrameComponent::OnStop() {
   tizen_base::Bundle content = GetContent();
-  OnBaseSaveContent(content);
+  OnSaveContent(content);
   SetContent(std::move(content));
-}
-
-void FrameComponent::OnBaseRestoreContent(tizen_base::Bundle content) {
-}
-
-void FrameComponent::OnBaseSaveContent(tizen_base::Bundle& content) {
-}
-
-// LCOV_EXCL_START
-void FrameComponent::OnBaseAction(std::string action, AppControl app_control) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void FrameComponent::OnBaseDeviceOrientationChanged(
-    DeviceOrientation::Orientation orientation) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void FrameComponent::OnBaseLanguageChanged(std::string language) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void FrameComponent::OnBaseRegionFormatChanged(std::string region) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void FrameComponent::OnBaseLowBattery(LowBattery::Status status) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void FrameComponent::OnBaseLowMemory(LowMemory::Status status) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void FrameComponent::OnBaseSuspendedStateChanged(SuspendedState::State state) {
-}
-// LCOV_EXCL_STOP
-
-std::unique_ptr<IWindow> FrameComponent::OnCreate() {
-  return nullptr;
-}
-
-void FrameComponent::OnStart(AppControl app_control, bool restarted) {
-}
-
-void FrameComponent::OnResume() {
-}
-
-void FrameComponent::OnPause() {
-}
-
-void FrameComponent::OnStop() {
-}
-
-void FrameComponent::OnDestroy() {
+  Component::OnStop();
 }
 
 }  // namespace component_based
index 2e4b9ef3cd4980b54d5ab26dfdad4ebde588560b..911d4b36e826c880203c257b76cb9f3de9521adb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -30,71 +30,30 @@ namespace component_based {
 
 class EXPORT_API FrameComponent : public Component {
  public:
-  class Factory : public Component::Factory {
-   public:
-    std::unique_ptr<Component> Create(std::string comp_id,
-                                      std::string inst_id,
-                                      tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<Component>(
-          new (std::nothrow) FrameComponent(
-            std::move(comp_id), std::move(inst_id)));
-    }
-  };
-
   enum class DisplayStatus {
     Unknown,
     On,
     Off,
   };
 
-  class FrameType : public Type {
-   public:
-    enum {
-      Hash = 0x1111
-    };
-
-    int GetHash() const override {
-      return Hash;
-    }
-
-    std::string GetName() const override {
-      return "frame";
-    }
-  };
-
-  FrameComponent(std::string comp_id, std::string inst_id);
+  FrameComponent(std::string comp_id, std::string inst_id,
+      tizen_cpp::AppCoreMultiWindowBase* app);
   virtual ~FrameComponent();
 
-  DisplayStatus GetDisplayStatus();
-  const IWindow* GetWindow();
+  DisplayStatus GetDisplayStatus() const;
+  const IWindow* GetWindow() const;
 
-  std::unique_ptr<Type> GetType() const override {
-    return std::unique_ptr<Type>(new FrameType());
-  }
+  virtual std::unique_ptr<IWindow> OnCreateWindow() = 0;
+  void OnStart(AppControl control, bool restarted) override;
+  void OnResume() override;
+  void OnPause() override;
+  void OnStop() override;
 
-  bool OnBaseCreate() override;
-  void OnBaseDestroy() override;
-  void OnBaseStart(AppControl control, bool restarted) override;
-  void OnBaseResume() override;
-  void OnBasePause() override;
-  void OnBaseStop() override;
-  void OnBaseRestoreContent(tizen_base::Bundle content) override;
-  void OnBaseSaveContent(tizen_base::Bundle& content) override;
-  void OnBaseAction(std::string action, AppControl app_control) override;
-  void OnBaseDeviceOrientationChanged(
-      DeviceOrientation::Orientation orientation) override;
-  void OnBaseLanguageChanged(std::string language) override;
-  void OnBaseRegionFormatChanged(std::string region) override;
-  void OnBaseLowBattery(LowBattery::Status status) override;
-  void OnBaseLowMemory(LowMemory::Status status) override;
-  void OnBaseSuspendedStateChanged(SuspendedState::State state) override;
+ private:
+  void OnCreate() final;
 
-  virtual std::unique_ptr<IWindow> OnCreate();
-  virtual void OnStart(AppControl app_control, bool restarted);
-  virtual void OnResume();
-  virtual void OnPause();
-  virtual void OnStop();
-  virtual void OnDestroy();
+ private:
+  std::unique_ptr<IWindow> win_;
 };
 
 }  // namespace component_based
index 156a3326cc86acf57bad392a8cec006393cd58b9..83c8d0f1d01e7c6038063e2a1f4c280c75b147e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 20ab243ebb7051f3d8a0615019bd8b41f6e0fd79..4aabd731e2451efe7152a02e02cc42f2c6648f08 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 42b612cb1febab2cecc996d6bda058babd31af31..6e2d35c88e3df4427453a111936ec1bb239da9ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 56cf17741ed79774de2a1be6b3dbcdd311c7688c..9bf8f471b563a1ce3e323e506831788df0d463da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index a61be0638c20a4d8fb5730e7fad86f91ecd545bb..f9b9c6b7c5a0834807750e6d68eaba7a2b92d5d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
  */
 
 #include <memory>
+#include <utility>
 
 #include "component_based/base/dlog_internal.h"
 #include "component_based/base/service_component.h"
 
 namespace component_based {
 
-ServiceComponent::ServiceComponent(std::string comp_id, std::string inst_id)
-  : Component::Component(std::move(comp_id), std::move(inst_id)) {
+ServiceComponent::ServiceComponent(std::string comp_id, std::string inst_id,
+    tizen_cpp::AppCoreMultiWindowBase* app)
+  : Component::Component(std::move(comp_id), std::move(inst_id), app) {
 }
 
 ServiceComponent::~ServiceComponent() = default;
 
-bool ServiceComponent::OnBaseCreate() {
-  bool r = OnCreate();
-  if (!r) {
-    LOGE("OnCreate() returns false");
-    return false;
-  }
-  return true;
-}
-
-void ServiceComponent::OnBaseDestroy() {
-  OnDestroy();
-}
-
-void ServiceComponent::OnBaseStart(AppControl control, bool restarted) {
+void ServiceComponent::OnStart(AppControl control, bool restarted) {
+  Component::OnStart(control, restarted);
   tizen_base::Bundle content = GetContent();
-  OnBaseRestoreContent(content);
+  OnRestoreContent(content);
   OnStartCommand(control, restarted);
-  OnBaseSaveContent(content);
+  OnSaveContent(content);
   SetContent(std::move(content));
 }
 
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseResume() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBasePause() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseStop() {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseRestoreContent(tizen_base::Bundle content) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseSaveContent(tizen_base::Bundle& content) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseAction(std::string action, AppControl app_control) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseDeviceOrientationChanged(
-    DeviceOrientation::Orientation orientation) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseLanguageChanged(std::string language) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseRegionFormatChanged(std::string region) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseLowBattery(LowBattery::Status status) {
+void ServiceComponent::OnStartCommand(AppControl app_control, bool restarted) {
 }
-// LCOV_EXCL_STOP
 
 // LCOV_EXCL_START
-void ServiceComponent::OnBaseLowMemory(LowMemory::Status status) {
+void ServiceComponent::OnResume() {
 }
-// LCOV_EXCL_STOP
 
-// LCOV_EXCL_START
-void ServiceComponent::OnBaseSuspendedStateChanged(SuspendedState::State state) {
+void ServiceComponent::OnPause() {
 }
 // LCOV_EXCL_STOP
 
-bool ServiceComponent::OnCreate() {
-  return false;
-}
-
-void ServiceComponent::OnStartCommand(AppControl app_control, bool restarted) {
-}
-
-void ServiceComponent::OnDestroy() {
-}
-
 }  // namespace component_based
index f43de7f5d85dffd871dd6c36dc31a9f2c9d1ba95..47737c78536917e930d6af0e614dbbe6a90654d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -29,59 +29,15 @@ namespace component_based {
 
 class EXPORT_API ServiceComponent : public Component {
  public:
-  class Factory : public Component::Factory {
-   public:
-    std::unique_ptr<Component> Create(std::string comp_id,
-                                      std::string inst_id,
-                                      tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<Component>(
-          new (std::nothrow) ServiceComponent(
-            std::move(comp_id), std::move(inst_id)));
-    }
-  };
-
-  class ServiceType : public Type {
-   public:
-    enum {
-      Hash = 0x2222
-    };
-
-    int GetHash() const override {
-      return Hash;
-    }
-
-    std::string GetName() const override {
-      return "service";
-    }
-  };
-
-  ServiceComponent(std::string comp_id, std::string inst_id);
+  ServiceComponent(std::string comp_id, std::string inst_id,
+      tizen_cpp::AppCoreMultiWindowBase* app);
   virtual ~ServiceComponent();
-
-  std::unique_ptr<Type> GetType() const override {
-    return std::unique_ptr<Type>(new ServiceType());
-  }
-
-  bool OnBaseCreate() override;
-  void OnBaseDestroy() override;
-  void OnBaseStart(AppControl control, bool restarted) override;
-  void OnBaseResume() override;
-  void OnBasePause() override;
-  void OnBaseStop() override;
-  void OnBaseRestoreContent(tizen_base::Bundle content) override;
-  void OnBaseSaveContent(tizen_base::Bundle& content) override;
-  void OnBaseAction(std::string action, AppControl app_control) override;
-  void OnBaseDeviceOrientationChanged(
-      DeviceOrientation::Orientation orientation) override;
-  void OnBaseLanguageChanged(std::string language) override;
-  void OnBaseRegionFormatChanged(std::string region) override;
-  void OnBaseLowBattery(LowBattery::Status status) override;
-  void OnBaseLowMemory(LowMemory::Status status) override;
-  void OnBaseSuspendedStateChanged(SuspendedState::State state) override;
-
-  virtual bool OnCreate();
   virtual void OnStartCommand(AppControl app_control, bool restarted);
-  virtual void OnDestroy();
+
+ private:
+  void OnStart(AppControl control, bool restarted) final;
+  void OnResume() final;
+  void OnPause() final;
 };
 
 }  // namespace component_based
index e27fa47b8c365cf93df4bb680904da3f3afd9d23..3ecf3644764f5cbec309828b023be548942f9964 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
  * limitations under the License.
  */
 
+#include <app_control_internal.h>
 #include <dlog.h>
 #include <glib.h>
 #include <unistd.h>
-#include <app_control_internal.h>
 
 #include <list>
 
+#include "component_based/base/api/base_component.h"
+#include "component_based/base/api/base_frame_component.h"
+#include "component_based/base/api/base_service_component.h"
+#include "component_based/base/api/component_based_app_base.h"
 #include "component_based/base/api/component_common.h"
-#include "component_based/common/exception.h"
+#include "component_based/base/application_base.h"
 #include "component_based/base/component.h"
-#include "component_based/base/frame_window.h"
 #include "component_based/base/frame_component.h"
+#include "component_based/base/frame_window.h"
 #include "component_based/base/service_component.h"
-#include "component_based/base/application_base.h"
-#include "component_based/base/api/component_based_app_base.h"
-#include "component_based/base/api/base_component.h"
-#include "component_based/base/api/base_frame_component.h"
-#include "component_based/base/api/base_service_component.h"
+#include "component_based/common/exception.h"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
@@ -43,6 +43,9 @@
 #endif
 #define EXPORT_API __attribute__((visibility("default")))
 
+using namespace tizen_cpp;
+using namespace component_based;
+
 struct frame_window_s {
   int id;
   void* raw;
@@ -53,7 +56,7 @@ namespace {
 class ComponentClass {
  public:
   void Add(std::string comp_id,
-           std::unique_ptr<component_based::Component::Factory> factory) {
+           std::unique_ptr<Component::FactoryBase> factory) {
     auto iter = facs_.find(comp_id);
     if (iter != facs_.end())
       LOGW("Already exists");
@@ -61,16 +64,16 @@ class ComponentClass {
     facs_[comp_id] = std::move(factory);
   }
 
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>>
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>>
   Detach() {
     return std::move(facs_);
   }
 
  private:
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>> facs_;
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>> facs_;
 };
 
-class StubApplicationBase : public component_based::ApplicationBase {
+class StubApplicationBase : public ApplicationBase {
  private:
   StubApplicationBase() = default;
   ~StubApplicationBase() = default;
@@ -101,35 +104,31 @@ class StubApplicationBase : public component_based::ApplicationBase {
   }
 
  private:
-  void OnInit(int argc, char** argv) override {
-    component_based::ApplicationBase::OnInit(argc, argv);
+  void OnLoopInit(int argc, char** argv) override {
     if (cb_.init)
       cb_.init(argc, argv, user_data_);
   }
 
-  void OnFini() override {
+  void OnLoopFinish() override {
     state_ = State::DYING;
-    component_based::ApplicationBase::OnFini();
     if (cb_.fini)
       cb_.fini(user_data_);
   }
 
-  void OnRun() override {
+  void OnLoopRun() override {
     state_ = State::RUNNING;
-    component_based::ApplicationBase::OnRun();
     if (cb_.run)
       cb_.run(user_data_);
   }
 
-  void OnExit() override {
-    component_based::ApplicationBase::OnExit();
+  void OnLoopExit() override {
     if (cb_.exit)
       cb_.exit(user_data_);
   }
 
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>>
-  OnCreate() override {
-    std::map<std::string, std::unique_ptr<component_based::Component::Factory>> facs;
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>>
+  OnCreateFactoryMap() override {
+    std::map<std::string, std::unique_ptr<Component::FactoryBase>> facs;
     component_class_h h = nullptr;
     if (cb_.create)
       h = cb_.create(user_data_);
@@ -145,9 +144,10 @@ class StubApplicationBase : public component_based::ApplicationBase {
     return facs;
   }
 
-  void OnTerminate() override {
+  int OnTerminate() override {
     if (cb_.terminate)
       cb_.terminate(user_data_);
+    return ApplicationBase::OnTerminate();
   }
 
  private:
@@ -156,19 +156,20 @@ class StubApplicationBase : public component_based::ApplicationBase {
   void* user_data_ = nullptr;
 };
 
-class StubBaseComponent : public component_based::Component {
+class StubBaseComponent : public Component {
  public:
-  class Factory : public component_based::Component::Factory {
+  class Factory : public Component::FactoryBase {
    public:
-    Factory(base_component_lifecycle_callback_s cb, void* user_data)
-      : cb_(cb), user_data_(user_data) {
+    Factory(std::string comp_id, base_component_lifecycle_callback_s cb,
+        void* user_data) : Component::FactoryBase(std::move(comp_id)), cb_(cb),
+        user_data_(user_data) {
     }
 
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-        std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
-          new (std::nothrow) StubBaseComponent(std::move(comp_id),
-              std::move(inst_id), cb_, user_data_));
+    std::unique_ptr<AppCoreMultiWindowBase::Context> Create(std::string inst_id,
+          AppCoreMultiWindowBase* app) override {
+      return std::unique_ptr<AppCoreMultiWindowBase::Context>(
+          new (std::nothrow) StubBaseComponent(GetCompId(),
+              std::move(inst_id), app, cb_, user_data_));
     }
 
    private:
@@ -178,27 +179,31 @@ class StubBaseComponent : public component_based::Component {
 
   StubBaseComponent(std::string comp_id,
                     std::string inst_id,
+                    AppCoreMultiWindowBase* app,
                     base_component_lifecycle_callback_s cb,
                     void* user_data)
-    : component_based::Component(std::move(comp_id), std::move(inst_id)),
+    : Component(std::move(comp_id), std::move(inst_id), app),
       cb_(cb), user_data_(user_data) {
   }
 
   ~StubBaseComponent() = default;
 
  public:
-  void OnBaseRestoreContent(tizen_base::Bundle content) override {
+  void OnRestoreContent(tizen_base::Bundle content) override {
+    Component::OnRestoreContent(content);
     if (cb_.restore_content)
       cb_.restore_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseSaveContent(tizen_base::Bundle& content) override {
+  void OnSaveContent(tizen_base::Bundle& content) override {
     if (cb_.save_content)
       cb_.save_content(this, content.GetHandle(), user_data_);
+    Component::OnSaveContent(content);
   }
 
-  void OnBaseDeviceOrientationChanged(
-      component_based::DeviceOrientation::Orientation orientation) override {
+  void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) override {
+    Component::OnDeviceOrientationChanged(orientation);
     if (cb_.device_orientation_changed) {
       cb_.device_orientation_changed(this,
           static_cast<component_device_orientation_e>(orientation),
@@ -206,17 +211,20 @@ class StubBaseComponent : public component_based::Component {
     }
   }
 
-  void OnBaseLanguageChanged(std::string language) override {
+  void OnLanguageChanged(std::string language) override {
+    Component::OnLanguageChanged(language);
     if (cb_.language_changed)
       cb_.language_changed(this, language.c_str(), user_data_);
   }
 
-  void OnBaseRegionFormatChanged(std::string region) override {
+  void OnRegionFormatChanged(std::string region) override {
+    Component::OnRegionFormatChanged(region);
     if (cb_.region_format_changed)
       cb_.region_format_changed(this, region.c_str(), user_data_);
   }
 
-  void OnBaseLowBattery(component_based::LowBattery::Status status) override {
+  void OnLowBattery(LowBattery::Status status) override {
+    Component::OnLowBattery(status);
     if (cb_.low_battery) {
       cb_.low_battery(this,
           static_cast<component_low_battery_status_e>(status),
@@ -224,7 +232,8 @@ class StubBaseComponent : public component_based::Component {
     }
   }
 
-  void OnBaseLowMemory(component_based::LowMemory::Status status) override {
+  void OnLowMemory(LowMemory::Status status) override {
+    Component::OnLowMemory(status);
     if (cb_.low_memory) {
       cb_.low_memory(this,
           static_cast<component_low_memory_status_e>(status),
@@ -232,8 +241,8 @@ class StubBaseComponent : public component_based::Component {
     }
   }
 
-  void OnBaseSuspendedStateChanged(
-      component_based::SuspendedState::State state) override {
+  void OnSuspendedStateChanged(SuspendedState::State state) override {
+    Component::OnSuspendedStateChanged(state);
     if (cb_.suspended_state_changed) {
       cb_.suspended_state_changed(this,
           static_cast<component_suspended_state_e>(state),
@@ -246,19 +255,20 @@ class StubBaseComponent : public component_based::Component {
   void* user_data_;
 };
 
-class StubFrameComponent : public component_based::FrameComponent {
+class StubFrameComponent : public FrameComponent {
  public:
-  class Factory : public component_based::FrameComponent::Factory {
+  class Factory : public Component::FactoryBase {
    public:
-    Factory(base_frame_component_lifecycle_callback_s cb, void* user_data)
-      : cb_(cb), user_data_(user_data) {
+    Factory(std::string comp_id, base_frame_component_lifecycle_callback_s cb,
+        void* user_data)
+      : Component::FactoryBase(std::move(comp_id)), cb_(cb), user_data_(user_data) {
     }
 
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-        std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
+    std::unique_ptr<AppCoreMultiWindowBase::Context> Create(std::string inst_id,
+          AppCoreMultiWindowBase* app) override {
+      return std::unique_ptr<AppCoreMultiWindowBase::Context>(
           new (std::nothrow) StubFrameComponent(
-            std::move(comp_id), std::move(inst_id), cb_, user_data_));
+            GetCompId(), std::move(inst_id), app, cb_, user_data_));
     }
 
    private:
@@ -268,9 +278,10 @@ class StubFrameComponent : public component_based::FrameComponent {
 
   StubFrameComponent(std::string comp_id,
                      std::string inst_id,
+                     AppCoreMultiWindowBase* app,
                      base_frame_component_lifecycle_callback_s cb,
                      void* user_data)
-    : component_based::FrameComponent(std::move(comp_id), std::move(inst_id)),
+    : FrameComponent(std::move(comp_id), std::move(inst_id), app),
       cb_(cb),
       user_data_(user_data) {
   }
@@ -278,15 +289,15 @@ class StubFrameComponent : public component_based::FrameComponent {
   ~StubFrameComponent() = default;
 
  public:
-  std::unique_ptr<component_based::IWindow> OnCreate() override {
+  std::unique_ptr<component_based::IWindow> OnCreateWindow() override {
     frame_window_h win = cb_.create(this, user_data_);
     if (win == nullptr) {
       LOGE("window is nullptr");
       return nullptr;
     }
 
-    component_based::FrameWindow* frm_win =
-        new (std::nothrow) component_based::FrameWindow(win->id, win->raw);
+    FrameWindow* frm_win =
+        new (std::nothrow) FrameWindow(win->id, win->raw);
     base_frame_destroy_window(win);
     if (frm_win == nullptr) {
       LOGE("Out of memory");
@@ -297,13 +308,15 @@ class StubFrameComponent : public component_based::FrameComponent {
         static_cast<component_based::IWindow*>(frm_win));
   }
 
-  void OnStart(component_based::AppControl app_control,
+  void OnStart(AppControl app_control,
                bool restarted) override {
+    FrameComponent::OnStart(app_control, restarted);
     if (cb_.start)
       cb_.start(this, app_control.GetHandle(), restarted, user_data_);
   }
 
   void OnResume() override {
+    FrameComponent::OnResume();
     if (cb_.resume)
       cb_.resume(this, user_data_);
   }
@@ -311,36 +324,42 @@ class StubFrameComponent : public component_based::FrameComponent {
   void OnPause() override {
     if (cb_.pause)
       cb_.pause(this, user_data_);
+    FrameComponent::OnPause();
   }
 
   void OnStop() override {
     if (cb_.stop)
       cb_.stop(this, user_data_);
+    FrameComponent::OnStop();
   }
 
   void OnDestroy() override {
     if (cb_.destroy)
       cb_.destroy(this, user_data_);
+    FrameComponent::OnDestroy();
   }
 
-  void OnBaseRestoreContent(tizen_base::Bundle content) override {
+  void OnRestoreContent(tizen_base::Bundle content) override {
+    FrameComponent::OnRestoreContent(content);
     if (cb_.restore_content)
       cb_.restore_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseSaveContent(tizen_base::Bundle& content) override {
+  void OnSaveContent(tizen_base::Bundle& content) override {
     if (cb_.save_content)
       cb_.save_content(this, content.GetHandle(), user_data_);
+    FrameComponent::OnSaveContent(content);
   }
 
-  void OnBaseAction(std::string action,
-                component_based::AppControl app_control) override {
+  void OnAction(std::string action, AppControl app_control) override {
+    FrameComponent::OnAction(action, app_control);
     if (cb_.action)
       cb_.action(this, action.c_str(), app_control.GetHandle(), user_data_);
   }
 
-  void OnBaseDeviceOrientationChanged(
-      component_based::DeviceOrientation::Orientation orientation) override {
+  void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) override {
+    FrameComponent::OnDeviceOrientationChanged(orientation);
     if (cb_.device_orientation_changed) {
       cb_.device_orientation_changed(this,
           static_cast<component_device_orientation_e>(orientation),
@@ -348,17 +367,20 @@ class StubFrameComponent : public component_based::FrameComponent {
     }
   }
 
-  void OnBaseLanguageChanged(std::string language) override {
+  void OnLanguageChanged(std::string language) override {
+    FrameComponent::OnLanguageChanged(language);
     if (cb_.language_changed)
       cb_.language_changed(this, language.c_str(), user_data_);
   }
 
-  void OnBaseRegionFormatChanged(std::string region) override {
+  void OnRegionFormatChanged(std::string region) override {
+    FrameComponent::OnRegionFormatChanged(region);
     if (cb_.region_format_changed)
       cb_.region_format_changed(this, region.c_str(), user_data_);
   }
 
-  void OnBaseLowBattery(component_based::LowBattery::Status status) override {
+  void OnLowBattery(LowBattery::Status status) override {
+    FrameComponent::OnLowBattery(status);
     if (cb_.low_battery) {
       cb_.low_battery(this,
           static_cast<component_low_battery_status_e>(status),
@@ -366,7 +388,8 @@ class StubFrameComponent : public component_based::FrameComponent {
     }
   }
 
-  void OnBaseLowMemory(component_based::LowMemory::Status status) override {
+  void OnLowMemory(LowMemory::Status status) override {
+    FrameComponent::OnLowMemory(status);
     if (cb_.low_memory) {
       cb_.low_memory(this,
           static_cast<component_low_memory_status_e>(status),
@@ -374,8 +397,8 @@ class StubFrameComponent : public component_based::FrameComponent {
     }
   }
 
-  void OnBaseSuspendedStateChanged(
-      component_based::SuspendedState::State state) override {
+  void OnSuspendedStateChanged(SuspendedState::State state) override {
+    FrameComponent::OnSuspendedStateChanged(state);
     if (cb_.suspended_state_changed) {
       cb_.suspended_state_changed(this,
           static_cast<component_suspended_state_e>(state),
@@ -388,19 +411,20 @@ class StubFrameComponent : public component_based::FrameComponent {
   void* user_data_;
 };
 
-class StubServiceComponent : public component_based::ServiceComponent {
+class StubServiceComponent : public ServiceComponent {
  public:
-  class Factory : public component_based::ServiceComponent::Factory {
+  class Factory : public Component::FactoryBase {
    public:
-    Factory(base_service_component_lifecycle_callback_s cb, void* user_data)
-      : cb_(cb), user_data_(user_data) {
+    Factory(std::string comp_id, base_service_component_lifecycle_callback_s cb,
+        void* user_data) : Component::FactoryBase(std::move(comp_id)),
+        cb_(cb), user_data_(user_data) {
     }
 
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-        std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
-          new (std::nothrow) StubServiceComponent(std::move(comp_id),
-              std::move(inst_id), cb_, user_data_));
+    std::unique_ptr<AppCoreMultiWindowBase::Context> Create(std::string inst_id,
+          AppCoreMultiWindowBase* app) override {
+      return std::unique_ptr<AppCoreMultiWindowBase::Context>(
+          new (std::nothrow) StubServiceComponent(GetCompId(),
+              std::move(inst_id), app, cb_, user_data_));
     }
 
    private:
@@ -410,9 +434,10 @@ class StubServiceComponent : public component_based::ServiceComponent {
 
   StubServiceComponent(std::string comp_id,
                        std::string inst_id,
+                       AppCoreMultiWindowBase* app,
                        base_service_component_lifecycle_callback_s cb,
                        void* user_data)
-    : component_based::ServiceComponent(std::move(comp_id), std::move(inst_id)),
+    : ServiceComponent(std::move(comp_id), std::move(inst_id), app),
       cb_(cb),
       user_data_(user_data) {
   }
@@ -420,12 +445,15 @@ class StubServiceComponent : public component_based::ServiceComponent {
   ~StubServiceComponent() = default;
 
  public:
-  bool OnCreate() override {
-    return cb_.create(this, user_data_);
+  void OnCreate() override {
+    ServiceComponent::OnCreate();
+    if (!cb_.create(this, user_data_))
+      THROW(Exception::ErrorCodes::IOError);
   }
 
-  void OnStartCommand(component_based::AppControl app_control,
+  void OnStartCommand(AppControl app_control,
                       bool restarted) override {
+    ServiceComponent::OnStartCommand(app_control, restarted);
     if (cb_.start_command)
       cb_.start_command(this, app_control.GetHandle(), restarted, user_data_);
   }
@@ -433,26 +461,30 @@ class StubServiceComponent : public component_based::ServiceComponent {
   void OnDestroy() override {
     if (cb_.destroy)
       cb_.destroy(this, user_data_);
+    ServiceComponent::OnDestroy();
   }
 
-  void OnBaseRestoreContent(tizen_base::Bundle content) override {
+  void OnRestoreContent(tizen_base::Bundle content) override {
+    ServiceComponent::OnRestoreContent(content);
     if (cb_.restore_content)
       cb_.restore_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseSaveContent(tizen_base::Bundle& content) override {
+  void OnSaveContent(tizen_base::Bundle& content) override {
     if (cb_.save_content)
       cb_.save_content(this, content.GetHandle(), user_data_);
+    ServiceComponent::OnSaveContent(content);
   }
 
-  void OnBaseAction(std::string action,
-                component_based::AppControl app_control) override {
+  void OnAction(std::string action, AppControl app_control) override {
+    ServiceComponent::OnAction(action, app_control);
     if (cb_.action)
       cb_.action(this, action.c_str(), app_control.GetHandle(), user_data_);
   }
 
-  void OnBaseDeviceOrientationChanged(
-      component_based::DeviceOrientation::Orientation orientation) override {
+  void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) override {
+    ServiceComponent::OnDeviceOrientationChanged(orientation);
     if (cb_.device_orientation_changed) {
       cb_.device_orientation_changed(this,
           static_cast<component_device_orientation_e>(orientation),
@@ -460,17 +492,20 @@ class StubServiceComponent : public component_based::ServiceComponent {
     }
   }
 
-  void OnBaseLanguageChanged(std::string language) override {
+  void OnLanguageChanged(std::string language) override {
+    ServiceComponent::OnLanguageChanged(language);
     if (cb_.language_changed)
       cb_.language_changed(this, language.c_str(), user_data_);
   }
 
-  void OnBaseRegionFormatChanged(std::string region) override {
+  void OnRegionFormatChanged(std::string region) override {
+    ServiceComponent::OnRegionFormatChanged(region);
     if (cb_.region_format_changed)
       cb_.region_format_changed(this, region.c_str(), user_data_);
   }
 
-  void OnBaseLowBattery(component_based::LowBattery::Status status) override {
+  void OnLowBattery(LowBattery::Status status) override {
+    ServiceComponent::OnLowBattery(status);
     if (cb_.low_battery) {
       cb_.low_battery(this,
           static_cast<component_low_battery_status_e>(status),
@@ -478,7 +513,8 @@ class StubServiceComponent : public component_based::ServiceComponent {
     }
   }
 
-  void OnBaseLowMemory(component_based::LowMemory::Status status) override {
+  void OnLowMemory(LowMemory::Status status) override {
+    ServiceComponent::OnLowMemory(status);
     if (cb_.low_memory) {
       cb_.low_memory(this,
           static_cast<component_low_memory_status_e>(status),
@@ -486,8 +522,9 @@ class StubServiceComponent : public component_based::ServiceComponent {
     }
   }
 
-  void OnBaseSuspendedStateChanged(
-      component_based::SuspendedState::State state) override {
+  void OnSuspendedStateChanged(
+      SuspendedState::State state) override {
+    ServiceComponent::OnSuspendedStateChanged(state);
     if (cb_.suspended_state_changed) {
       cb_.suspended_state_changed(this,
           static_cast<component_suspended_state_e>(state),
@@ -557,14 +594,7 @@ extern "C" EXPORT_API int base_frame_get_display_status(
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
-  if (component->GetType()->GetHash() !=
-      component_based::FrameComponent::FrameType::Hash) {
-    LOGE("Invalid parameter");
-    return COMPONENT_ERROR_INVALID_PARAMETER;
-  }
-
+  Component* component = static_cast<Component*>(context);
   ::StubFrameComponent* frame_component =
     dynamic_cast<::StubFrameComponent*>(component);
   if (frame_component == nullptr) {
@@ -573,12 +603,12 @@ extern "C" EXPORT_API int base_frame_get_display_status(
   }
 
   auto status = frame_component->GetDisplayStatus();
-  if (status == component_based::FrameComponent::DisplayStatus::Unknown) {
+  if (status == FrameComponent::DisplayStatus::Unknown) {
     LOGE("Invalid context");
     return COMPONENT_ERROR_INVALID_CONTEXT;
-  } else if (status == component_based::FrameComponent::DisplayStatus::On) {
+  } else if (status == FrameComponent::DisplayStatus::On) {
     *display_status = COMPONENT_DISPLAY_STATUS_ON;
-  } else if (status == component_based::FrameComponent::DisplayStatus::Off) {
+  } else if (status == FrameComponent::DisplayStatus::Off) {
     *display_status = COMPONENT_DISPLAY_STATUS_OFF;
   }
 
@@ -643,16 +673,14 @@ component_based_app_base_add_frame_component(
   }
 
   ::StubFrameComponent::Factory* factory =
-      new (std::nothrow) ::StubFrameComponent::Factory(*callback, user_data);
+      new (std::nothrow) ::StubFrameComponent::Factory(comp_id, *callback, user_data);
   if (factory == nullptr) {
     LOGE("Out of memory");
     set_last_result(APP_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
-  handle->Add(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(factory));
-
+  handle->Add(comp_id, std::unique_ptr<Component::FactoryBase>(factory));
   comp_class = static_cast<component_class_h>(handle);
   return comp_class;
 }
@@ -688,15 +716,14 @@ component_based_app_base_add_service_component(
   }
 
   ::StubServiceComponent::Factory* factory =
-      new (std::nothrow) ::StubServiceComponent::Factory(*callback, user_data);
+      new (std::nothrow) ::StubServiceComponent::Factory(comp_id, *callback, user_data);
   if (factory == nullptr) {
     LOGE("Out of memory");
     set_last_result(APP_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
-  handle->Add(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(factory));
+  handle->Add(comp_id, std::unique_ptr<Component::FactoryBase>(factory));
 
   comp_class = static_cast<component_class_h>(handle);
   return comp_class;
@@ -728,16 +755,14 @@ component_based_app_base_add_base_component(
   }
 
   ::StubBaseComponent::Factory* factory =
-      new (std::nothrow) ::StubBaseComponent::Factory(*callback, user_data);
+      new (std::nothrow) ::StubBaseComponent::Factory(comp_id, *callback, user_data);
   if (factory == nullptr) {
     LOGE("Out of memory");
     set_last_result(APP_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
-  handle->Add(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(factory));
-
+  handle->Add(comp_id, std::unique_ptr<Component::FactoryBase>(factory));
   comp_class = static_cast<component_class_h>(handle);
   return comp_class;
 }
@@ -749,9 +774,8 @@ extern "C" EXPORT_API int component_get_id(component_h context,
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
-  *id = strdup(component->GetComponentID().c_str());
+  Component* component = static_cast<Component*>(context);
+  *id = strdup(component->GetContextId().c_str());
   if (*id == nullptr) {
     LOGE("Out of memory");
     return COMPONENT_ERROR_OUT_OF_MEMORY;
@@ -767,9 +791,8 @@ extern "C" EXPORT_API int component_get_instance_id(component_h context,
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
-  *instance_id = strdup(component->GetInstanceID().c_str());
+  Component* component = static_cast<Component*>(context);
+  *instance_id = strdup(component->GetInstId().c_str());
   if (*instance_id == nullptr) {
     LOGE("Out of memory");
     return COMPONENT_ERROR_OUT_OF_MEMORY;
@@ -785,11 +808,10 @@ extern "C" EXPORT_API int component_register_action(component_h context,
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
+  Component* component = static_cast<Component*>(context);
   try {
     component->RegisterAction(action);
-  } catch (component_based::Exception& ex) {
+  } catch (Exception& ex) {
     LOGE("Exception occurred (%s)", ex.what());
     return COMPONENT_ERROR_INVALID_CONTEXT;
   }
@@ -804,8 +826,7 @@ extern "C" EXPORT_API int component_deregister_action(
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
+  Component* component = static_cast<Component*>(context);
   if (!component->DeregisterAction(action)) {
     LOGE("Deregister fail");
     return COMPONENT_ERROR_INVALID_PARAMETER;
@@ -887,10 +908,9 @@ extern "C" EXPORT_API int component_send_launch_request_async(
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
+  Component* component = static_cast<Component*>(context);
   int r = __app_control_send_launch_request_async(
-      component->GetInstanceID().c_str(), app_control, result_cb, reply_cb,
+      component->GetInstId().c_str(), app_control, result_cb, reply_cb,
       user_data);
   if (r != COMPONENT_ERROR_NONE) {
     LOGE("Failed to send launch request async. error(%d)", r);
@@ -910,10 +930,9 @@ extern "C" EXPORT_API int component_send_launch_request_sync(
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
+  Component* component = static_cast<Component*>(context);
   int r = __app_control_send_launch_request_sync(
-      component->GetInstanceID().c_str(), app_control, reply, result);
+      component->GetInstId().c_str(), app_control, reply, result);
   if (r != COMPONENT_ERROR_NONE) {
     LOGE("Failed to send launch request sync. error(%d)", r);
     return r;
@@ -928,8 +947,7 @@ extern "C" EXPORT_API int component_finish(component_h context) {
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
+  Component* component = static_cast<Component*>(context);
   component->Finish();
 
   return COMPONENT_ERROR_NONE;
index 5ae645778b3a566cf518941f2fa615d808db98a7..12e79d9e59363f4a212dc02603992811f76743fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
diff --git a/component_based/base/system_event_interface.h b/component_based/base/system_event_interface.h
new file mode 100644 (file)
index 0000000..145ad84
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019 - 2021 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 COMPONENT_BASED_BASE_SYSTEM_EVENT_INTERFACE_H_
+#define COMPONENT_BASED_BASE_SYSTEM_EVENT_INTERFACE_H_
+
+#include <vconf.h>
+
+#include <string>
+
+#include "component_based/base/device_orientation.h"
+#include "component_based/base/low_battery.h"
+#include "component_based/base/low_memory.h"
+#include "component_based/base/suspended_state.h"
+
+namespace component_based {
+
+class ISystemEvent {
+ public:
+  virtual ~ISystemEvent() = default;
+
+  virtual void OnLowMemory(LowMemory::Status status) = 0;
+  virtual void OnLowBattery(LowBattery::Status status) = 0;
+  virtual void OnLanguageChanged(std::string lang) = 0;
+  virtual void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) = 0;
+  virtual void OnRegionFormatChanged(std::string region) = 0;
+  virtual void OnSuspendedStateChanged(SuspendedState::State state) = 0;
+};
+
+}  // namespace component_based
+
+#endif  // COMPONENT_BASED_BASE_SYSTEM_EVENT_INTERFACE_H_
index 5c4fbd1bf3a0f4274cda666284e2924a3109bd3c..235bdc5b14a027187e27257d0f1a658c7ff0162d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
 #ifndef COMPONENT_BASED_BASE_SYSTEM_EVENT_INTERNAL_H_
 #define COMPONENT_BASED_BASE_SYSTEM_EVENT_INTERNAL_H_
 
-#include <appcore_multiwindow_base.h>
+#include <app_core_base.hh>
 #include <vconf.h>
 
 #include <string>
 
-#include "component_based/base/low_battery.h"
-#include "component_based/base/low_memory.h"
-#include "component_based/base/device_orientation.h"
-#include "component_based/base/suspended_state.h"
+#include "component_based/base/system_event_interface.h"
 
 namespace component_based {
 namespace internal {
 
-class SystemEvent {
+class LowMemoryEvent : public tizen_cpp::AppCoreBase::EventBase {
  public:
-  class IEventListener {
-   public:
-    virtual void OnLowMemory(LowMemory::Status status) = 0;
-    virtual void OnLowBattery(LowBattery::Status status) = 0;
-    virtual void OnLanguageChanged(std::string lang) = 0;
-    virtual void OnDeviceOrientationChanged(
-        DeviceOrientation::Orientation orientation) = 0;
-    virtual void OnRegionFormatChanged(std::string region) = 0;
-    virtual void OnSuspendedStateChanged(SuspendedState::State state) = 0;
-  };
-
-  explicit SystemEvent(IEventListener* ev) : ev_(ev) {
-    low_memory_ = appcore_base_add_event(APPCORE_BASE_EVENT_LOW_MEMORY,
-        OnLowMemoryCB, ev_);
-    low_battery_ = appcore_base_add_event(APPCORE_BASE_EVENT_LOW_BATTERY,
-        OnLowBatteryCB, ev_);
-    language_changed_ = appcore_base_add_event(APPCORE_BASE_EVENT_LANG_CHANGE,
-        OnLanguageChangedCB, ev_);
-    device_orientation_changed_ = appcore_base_add_event(
-        APPCORE_BASE_EVENT_DEVICE_ORIENTATION_CHANGED,
-        OnDeviceOrientationChangedCB, ev_);
-    region_format_changed_ = appcore_base_add_event(
-        APPCORE_BASE_EVENT_REGION_CHANGE,
-        OnRegionFormatChangedCB, ev_);
-    suspended_state_changed_ = appcore_base_add_event(
-        APPCORE_BASE_EVENT_SUSPENDED_STATE_CHANGE,
-        OnSuspendedStateChangedCB, ev_);
-  }
-
-  virtual ~SystemEvent() {
-    appcore_base_remove_event(suspended_state_changed_);
-    appcore_base_remove_event(region_format_changed_);
-    appcore_base_remove_event(device_orientation_changed_);
-    appcore_base_remove_event(language_changed_);
-    appcore_base_remove_event(low_battery_);
-    appcore_base_remove_event(low_memory_);
+  LowMemoryEvent(ISystemEvent* ev)
+      : tizen_cpp::AppCoreBase::EventBase(
+            tizen_cpp::AppCoreBase::IEvent::Type::LOW_MEMORY), ev_(ev) {
   }
 
- private:
-  static int OnLowMemoryCB(void* event, void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
+  void OnEvent(const std::string& val) override {
+  }
+
+  void OnEvent(int val) override {
     LowMemory::Status status;
-    int* val = static_cast<int*>(event);
-    switch (*val) {
+    switch (val) {
     case VCONFKEY_SYSMAN_LOW_MEMORY_NORMAL:
       status = LowMemory::Status::Normal;
       break;
@@ -90,15 +54,26 @@ class SystemEvent {
       break;
     }
 
-    ev->OnLowMemory(status);
-    return 0;
+    ev_->OnLowMemory(status);
   }
 
-  static int OnLowBatteryCB(void* event, void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
+ private:
+  ISystemEvent* ev_;
+};
+
+class LowBatteryEvent : public tizen_cpp::AppCoreBase::EventBase {
+ public:
+  LowBatteryEvent(ISystemEvent* ev)
+      : tizen_cpp::AppCoreBase::EventBase(
+            tizen_cpp::AppCoreBase::IEvent::Type::LOW_BATTERY), ev_(ev) {
+  }
+
+  void OnEvent(const std::string& val) override {
+  }
+
+  void OnEvent(int val) override {
     LowBattery::Status status;
-    int* val = static_cast<int*>(event);
-    switch (*val) {
+    switch (val) {
     case VCONFKEY_SYSMAN_BAT_POWER_OFF:
       status = LowBattery::Status::PowerOff;
       break;
@@ -110,32 +85,54 @@ class SystemEvent {
       break;
     }
 
-    ev->OnLowBattery(status);
-    return 0;
+    ev_->OnLowBattery(status);
   }
 
-  static int OnLanguageChangedCB(void* event, void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    std::string lang(static_cast<char*>(event));
-    ev->OnLanguageChanged(std::move(lang));
-    return 0;
+ private:
+  ISystemEvent* ev_;
+};
+
+class LangChangeEvent : public tizen_cpp::AppCoreBase::EventBase {
+ public:
+  LangChangeEvent(ISystemEvent* ev)
+      : tizen_cpp::AppCoreBase::EventBase(
+            tizen_cpp::AppCoreBase::IEvent::Type::LANG_CHANGE), ev_(ev) {
+  }
+
+  void OnEvent(const std::string& val) override {
+    ev_->OnLanguageChanged(val);
+  }
+
+  void OnEvent(int val) override {
   }
 
-  static int OnDeviceOrientationChangedCB(void* event, void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
+ private:
+  ISystemEvent* ev_;
+};
+
+class DeviceOrientationChangedEvent : public tizen_cpp::AppCoreBase::EventBase {
+ public:
+  DeviceOrientationChangedEvent(ISystemEvent* ev)
+      : tizen_cpp::AppCoreBase::EventBase(
+            tizen_cpp::AppCoreBase::IEvent::Type::DEVICE_ORIENTATION_CHANGED), ev_(ev) {
+  }
+
+  void OnEvent(const std::string& val) override {
+  }
+
+  void OnEvent(int val) override {
     DeviceOrientation::Orientation orientation;
-    int* val = static_cast<int*>(event);
-    switch (*val) {
-    case APPCORE_BASE_RM_PORTRAIT_NORMAL:
+    switch (val) {
+    case tizen_cpp::AppCoreBase::ROTATION_PORTRAIT_NORMAL:
       orientation = DeviceOrientation::Orientation::Orientation_0;
       break;
-    case APPCORE_BASE_RM_PORTRAIT_REVERSE:
+    case tizen_cpp::AppCoreBase::ROTATION_PORTRAIT_REVERSE:
       orientation = DeviceOrientation::Orientation::Orientation_180;
       break;
-    case APPCORE_BASE_RM_LANDSCAPE_NORMAL:
+    case tizen_cpp::AppCoreBase::ROTATION_LANDSCAPE_NORMAL:
       orientation = DeviceOrientation::Orientation::Orientation_270;
       break;
-    case APPCORE_BASE_RM_LANDSCAPE_REVERSE:
+    case tizen_cpp::AppCoreBase::ROTATION_LANDSCAPE_REVERSE:
       orientation = DeviceOrientation::Orientation::Orientation_90;
       break;
     default:
@@ -143,39 +140,66 @@ class SystemEvent {
       break;
     }
 
-    ev->OnDeviceOrientationChanged(orientation);
-    return 0;
+    ev_->OnDeviceOrientationChanged(orientation);
+  }
+
+ private:
+  ISystemEvent* ev_;
+};
+
+class RegionChangeEvent : public tizen_cpp::AppCoreBase::EventBase {
+ public:
+  RegionChangeEvent(ISystemEvent* ev)
+      : tizen_cpp::AppCoreBase::EventBase(
+            tizen_cpp::AppCoreBase::IEvent::Type::REGION_CHANGE), ev_(ev) {
+  }
+
+  void OnEvent(const std::string& val) override {
+    ev_->OnRegionFormatChanged(val);
+  }
+
+  void OnEvent(int val) override {
+  }
+
+ private:
+  ISystemEvent* ev_;
+};
+
+class SuspendedStateChangeEvent : public tizen_cpp::AppCoreBase::EventBase {
+ public:
+  SuspendedStateChangeEvent(ISystemEvent* ev)
+      : tizen_cpp::AppCoreBase::EventBase(
+            tizen_cpp::AppCoreBase::IEvent::Type::SUSPENDED_STATE_CHANGE), ev_(ev) {
   }
 
-  static int OnRegionFormatChangedCB(void* event, void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
-    std::string region(static_cast<char*>(event));
-    ev->OnRegionFormatChanged(std::move(region));
-    return 0;
+  void OnEvent(const std::string& val) override {
   }
 
-  static int OnSuspendedStateChangedCB(void* event, void* data) {
-    IEventListener* ev = static_cast<IEventListener*>(data);
+  void OnEvent(int val) override {
     SuspendedState::State state;
-    int* val = static_cast<int*>(event);
-    if ((*val) == 0) {
+    if (val == 0) {
       state = SuspendedState::State::Will_Enter;
     } else {
       state = SuspendedState::State::Did_Exit;
     }
 
-    ev->OnSuspendedStateChanged(state);
-    return 0;
+    ev_->OnSuspendedStateChanged(state);
   }
 
  private:
-  IEventListener* ev_;
-  appcore_base_event_h low_memory_;
-  appcore_base_event_h low_battery_;
-  appcore_base_event_h language_changed_;
-  appcore_base_event_h device_orientation_changed_;
-  appcore_base_event_h region_format_changed_;
-  appcore_base_event_h suspended_state_changed_;
+  ISystemEvent* ev_;
+};
+
+class SystemEvent {
+ public:
+  explicit SystemEvent(ISystemEvent* ev, tizen_cpp::AppCoreBase* app) {
+    app->AddEvent(std::make_shared<LowMemoryEvent>(ev));
+    app->AddEvent(std::make_shared<LowBatteryEvent>(ev));
+    app->AddEvent(std::make_shared<LangChangeEvent>(ev));
+    app->AddEvent(std::make_shared<DeviceOrientationChangedEvent>(ev));
+    app->AddEvent(std::make_shared<RegionChangeEvent>(ev));
+    app->AddEvent(std::make_shared<SuspendedStateChangeEvent>(ev));
+  }
 };
 
 }  // namespace internal
index 1fd6a9706bff79f37fb5f9d035a1f66c040a260b..792c62bf27fe160d077edf72e86b8adbb67f5bab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
 #ifndef COMPONENT_BASED_BASE_WINDOW_COMPONENT_MANAGER_INTERFACE_H_
 #define COMPONENT_BASED_BASE_WINDOW_COMPONENT_MANAGER_INTERFACE_H_
 
-#include <string>
 #include <memory>
+#include <string>
 
-#include "component_based/base/window_interface.h"
 #include "component_based/base/component_manager_interface.h"
+#include "component_based/base/window_interface.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
index 7e4912a289ca8597b51fa41757c49c13a19c754d..5df50e843d9d51d46b44bcc9c60d7345ae837c17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 2058d99cbabcd4a5f4f15e1e9b4744d6b461b554..89ab0e91775a7ff40c25a4acdb4b1aeff7600a71 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
 #ifndef COMPONENT_BASED_COMMON_EXCEPTION_H_
 #define COMPONENT_BASED_COMMON_EXCEPTION_H_
 
-#include <exception>
+#include <stdexcept>
 #include <string>
 
 #define THROW(error_code) throw Exception(error_code, __FILE__, __LINE__)
 
 namespace component_based {
 
-class Exception : public std::exception {
+class Exception : public std::runtime_error {
  public:
   enum class ErrorCodes {
     InvalidParameter,
     OutOfMemory,
     IOError,
   };
+
   explicit Exception(ErrorCodes error_code, std::string file = __FILE__,
-      int line = __LINE__ ) {
+      int line = __LINE__ ) : std::runtime_error("exception") {
     error_code_ = error_code;
     message_ = file.substr(file.find_last_of("/") + 1) + ":"
         + std::to_string(line) + GetErrorString(error_code);
   }
+
   virtual ~Exception() {}
+
   virtual const char *what(void) const noexcept {
     return message_.c_str();
   }
+
   ErrorCodes GetErrorCode() {
     return error_code_;
   }
index 0fb1e42d6983bc207fc27ccd21ca8251de3b9999..7432e1dc06d4fca39dc81329c6cc356693c5d2af 100644 (file)
@@ -1,54 +1,46 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based-application CXX)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION ${FULLVER})
-
-INCLUDE(FindPkgConfig)
-SET(requires "glib-2.0 bundle dlog ecore-wl2 elementary capi-appfw-app-control")
-SET(pc_requires "elementary component-based-core-base")
-pkg_check_modules(component-based-application REQUIRED ${requires})
-
-FOREACH(flag ${component-based-application_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -std=c++11")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/api/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/api/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based-application_LDFLAGS} component-based-core-base)
-
-SET(PC_NAME component-based-application)
-SET(PC_REQUIRED ${pc_requires})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APPLICATION_SRCS)
+
+ADD_LIBRARY(${TARGET_COMPONENT_BASED_APPLICATION} SHARED ${APPLICATION_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_APPLICATION} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../base/
+  ${CMAKE_CURRENT_SOURCE_DIR}/../base/api/
+  ${CMAKE_CURRENT_SOURCE_DIR}/api)
+
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_APPLICATION} PROPERTIES
+  VERSION ${FULLVER})
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_APPLICATION} PROPERTIES
+  SOVERSION ${MAJORVER})
+TARGET_LINK_LIBRARIES(${TARGET_COMPONENT_BASED_APPLICATION} PUBLIC
+  ${TARGET_COMPONENT_BASED_CORE_BASE})
+
+APPLY_PKG_CONFIG(${TARGET_COMPONENT_BASED_APPLICATION} PUBLIC
+  BUNDLE_DEPS
+  CAPI_APPFW_APP_CONTROL_DEPS
+  DLOG_DEPS
+  ECORE_WL2_DEPS
+  ELEMENTARY_DEPS
+  GLIB_DEPS
+)
+
+SET(PC_NAME ${TARGET_COMPONENT_BASED_APPLICATION})
+SET(PC_REQUIRED "elementary component-based-core-base app-core-multi-window-cpp")
+
+CONFIGURE_FILE(${TARGET_COMPONENT_BASED_APPLICATION}.pc.in
+  ${TARGET_COMPONENT_BASED_APPLICATION}.pc @ONLY)
+INSTALL(FILES ${TARGET_COMPONENT_BASED_APPLICATION}.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_APPLICATION}
+  DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
        DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/efl_base
-       FILES_MATCHING PATTERN "*.h")
+       FILES_MATCHING
+  PATTERN "*.h")
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/api
        DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/efl_base
-       FILES_MATCHING PATTERN "*.h")
-
-
+       FILES_MATCHING
+  PATTERN "*.h")
index a319d0fe6a18291079a53e3435300b08ebefa5ab..660003fb118d90c6ff83f0b9a503631d6086f2ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -18,7 +18,6 @@
 #define __TIZEN_COMPONENT_BASED_APPLICATION_H__
 
 #include <app_common.h>
-
 #include <component_common.h>
 #include <frame_component.h>
 #include <service_component.h>
index 70ea3d9f78fd186df583657c936bc767a0d85367..1e8577da5ff5ac43f9ca2f1876430453ecda94fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -20,7 +20,6 @@
 #include <Elementary.h>
 #include <app_control.h>
 #include <bundle.h>
-
 #include <component_common.h>
 
 #ifdef __cplusplus
index f89f4858aee13e7f496d18362ac0dcd2f7be139e..4b64b5f1e85c262a62b683aecc22ddf9ac938f53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index e7b3aa1ec75f563407997448107f3d374f3adb2d..06d60a6d8d70b0e10965d656e90b22c5bbba963b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -21,7 +21,6 @@
 
 #include <app_control.h>
 #include <bundle.h>
-
 #include <component_common.h>
 
 #ifdef __cplusplus
index 78ff3e68367c8df6569b1e862c1696876e7776d4..5af17ec29e94452eeb8ca291fb8e25c47040d8db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#include <dlog.h>
 #include <Elementary.h>
+#include <dlog.h>
 
 #include <memory>
 
@@ -34,7 +34,7 @@ Application::Application() {
 
 Application::~Application() = default;
 
-void Application::OnInit(int argc, char** argv) {
+void Application::OnLoopInit(int argc, char** argv) {
   LOGD("");
   elm_init(argc, argv);
   const char* hwacc = getenv("HWACC");
@@ -49,7 +49,7 @@ void Application::OnInit(int argc, char** argv) {
   }
 }
 
-void Application::OnFini() {
+void Application::OnLoopFinish() {
   LOGD("");
   elm_shutdown();
 
@@ -60,14 +60,19 @@ void Application::OnFini() {
   }
 }
 
-void Application::OnRun() {
+void Application::OnLoopRun() {
   LOGD("");
   elm_run();
 }
 
-void Application::OnExit() {
+void Application::OnLoopExit() {
   LOGD("");
   elm_exit();
 }
 
+std::map<std::string, std::unique_ptr<Component::FactoryBase>>
+Application::OnCreateFactoryMap() {
+  return {};
+}
+
 }  // namespace component_based
index 58fa21e7261fae8a332a5786dd7f517ce6283de9..4847b11704d9a90877e5fc87e01ba6717bde3ad6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -33,10 +33,12 @@ class EXPORT_API Application : public ApplicationBase {
   Application();
   virtual ~Application();
 
-  void OnInit(int argc, char** argv) override;
-  void OnFini() override;
-  void OnRun() override;
-  void OnExit() override;
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>>
+      OnCreateFactoryMap() override;
+  void OnLoopInit(int argc, char** argv) override;
+  void OnLoopFinish() override;
+  void OnLoopRun() override;
+  void OnLoopExit() override;
 };
 
 }  // namespace component_based
index e3919e9cb8d4b91a2dffde044697ee05656d3eb4..7e4aefc54679a873d42053b5d3a47d371de6e05e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index c1442f9795207a6516c90af82ab03c06ffd6bafa..ebd403249ed76d80b068c91bca5e39ff52735191 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
old mode 100755 (executable)
new mode 100644 (file)
index 1907d1d..07b2067
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
  * limitations under the License.
  */
 
+#include <Ecore_Wl2.h>
+#include <app_control_internal.h>
 #include <dlog.h>
 #include <glib.h>
 #include <unistd.h>
-#include <app_control_internal.h>
-#include <Ecore_Wl2.h>
 
 #include <list>
 
 #include "component_based/base/api/component_common.h"
-#include "component_based/efl_base/api/service_component.h"
+#include "component_based/common/exception.h"
 #include "component_based/efl_base/api/frame_component.h"
+#include "component_based/efl_base/api/service_component.h"
 #include "component_based/efl_base/api/component_based_app.h"
-
-#include "component_based/common/exception.h"
 #include "component_based/efl_base/application.h"
 #include "component_based/efl_base/elm_window.h"
 
 #endif
 #define EXPORT_API __attribute__((visibility("default")))
 
+using namespace component_based;
+using namespace tizen_cpp;
+
 namespace {
 
 class ComponentClass {
  public:
   void Add(std::string comp_id,
-           std::unique_ptr<component_based::Component::Factory> factory) {
+      std::unique_ptr<Component::FactoryBase> factory) {
     auto iter = facs_.find(comp_id);
     if (iter != facs_.end())
       LOGW("Already exists");
@@ -54,16 +56,16 @@ class ComponentClass {
     facs_[comp_id] = std::move(factory);
   }
 
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>>
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>>
   Detach() {
     return std::move(facs_);
   }
 
  private:
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>> facs_;
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>> facs_;
 };
 
-class StubApplication : public component_based::Application {
+class StubApplication : public Application {
  private:
   StubApplication() = default;
   ~StubApplication() = default;
@@ -94,27 +96,19 @@ class StubApplication : public component_based::Application {
   }
 
  private:
-  void OnInit(int argc, char** argv) override {
-    component_based::Application::OnInit(argc, argv);
-  }
-
-  void OnFini() override {
+  void OnLoopFinish() override {
     state_ = State::DYING;
-    component_based::Application::OnFini();
+    Application::OnLoopFinish();
   }
 
-  void OnRun() override {
+  void OnLoopRun() override {
     state_ = State::RUNNING;
-    component_based::Application::OnRun();
-  }
-
-  void OnExit() override {
-    component_based::Application::OnExit();
+    Application::OnLoopRun();
   }
 
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>>
-  OnCreate() override {
-    std::map<std::string, std::unique_ptr<component_based::Component::Factory>> facs;
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>>
+  OnCreateFactoryMap() override {
+    std::map<std::string, std::unique_ptr<Component::FactoryBase>> facs;
     component_class_h h = nullptr;
     if (cb_.create)
       h = cb_.create(user_data_);
@@ -130,9 +124,11 @@ class StubApplication : public component_based::Application {
     return facs;
   }
 
-  void OnTerminate() override {
+  int OnTerminate() override {
     if (cb_.terminate)
       cb_.terminate(user_data_);
+    Application::OnTerminate();
+    return 0;
   }
 
  private:
@@ -141,19 +137,19 @@ class StubApplication : public component_based::Application {
   void* user_data_ = nullptr;
 };
 
-class StubFrameComponent : public component_based::FrameComponent {
+class StubFrameComponent : public FrameComponent {
  public:
-  class Factory : public component_based::FrameComponent::Factory {
+  class Factory : public Component::FactoryBase {
    public:
-    Factory(frame_component_lifecycle_callback_s cb, void* user_data)
-      : cb_(cb), user_data_(user_data) {
+    Factory(std::string comp_id, frame_component_lifecycle_callback_s cb, void* user_data)
+      : FactoryBase(std::move(comp_id)), cb_(cb), user_data_(user_data) {
     }
 
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-        std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
+    std::unique_ptr<AppCoreMultiWindowBase::Context> Create(std::string inst_id,
+          AppCoreMultiWindowBase* app) override {
+      return std::unique_ptr<AppCoreMultiWindowBase::Context>(
           new (std::nothrow) StubFrameComponent(
-            std::move(comp_id), std::move(inst_id), cb_, user_data_));
+            std::move(GetCompId()), std::move(inst_id), app, cb_, user_data_));
     }
 
    private:
@@ -163,9 +159,10 @@ class StubFrameComponent : public component_based::FrameComponent {
 
   StubFrameComponent(std::string comp_id,
                      std::string inst_id,
+                     AppCoreMultiWindowBase* app,
                      frame_component_lifecycle_callback_s cb,
                      void* user_data)
-    : component_based::FrameComponent(std::move(comp_id), std::move(inst_id)),
+    : FrameComponent(std::move(comp_id), std::move(inst_id), app),
       cb_(cb),
       user_data_(user_data) {
   }
@@ -173,15 +170,14 @@ class StubFrameComponent : public component_based::FrameComponent {
   ~StubFrameComponent() = default;
 
  public:
-  std::unique_ptr<component_based::IWindow> OnCreate() override {
+  std::unique_ptr<component_based::IWindow> OnCreateWindow() override {
     Evas_Object* win = cb_.create(this, user_data_);
     if (win == nullptr) {
       LOGE("window is nullptr");
       return nullptr;
     }
 
-    component_based::ElmWindow* elm_win =
-        new (std::nothrow) component_based::ElmWindow(win);
+    ElmWindow* elm_win = new (std::nothrow) ElmWindow(win);
     if (elm_win == nullptr) {
       LOGE("Out of memory");
       return nullptr;
@@ -191,13 +187,14 @@ class StubFrameComponent : public component_based::FrameComponent {
         static_cast<component_based::IWindow*>(elm_win));
   }
 
-  void OnStart(component_based::AppControl app_control,
-               bool restarted) override {
+  void OnStart(AppControl app_control, bool restarted) override {
+    FrameComponent::OnStart(app_control, restarted);
     if (cb_.start)
       cb_.start(this, app_control.GetHandle(), restarted, user_data_);
   }
 
   void OnResume() override {
+    FrameComponent::OnResume();
     if (cb_.resume)
       cb_.resume(this, user_data_);
   }
@@ -205,36 +202,42 @@ class StubFrameComponent : public component_based::FrameComponent {
   void OnPause() override {
     if (cb_.pause)
       cb_.pause(this, user_data_);
+    FrameComponent::OnPause();
   }
 
   void OnStop() override {
     if (cb_.stop)
       cb_.stop(this, user_data_);
+    FrameComponent::OnStop();
   }
 
   void OnDestroy() override {
     if (cb_.destroy)
       cb_.destroy(this, user_data_);
+    FrameComponent::OnDestroy();
   }
 
-  void OnBaseRestoreContent(tizen_base::Bundle content) override {
+  void OnRestoreContent(tizen_base::Bundle content) override {
+    FrameComponent::OnRestoreContent(content);
     if (cb_.restore_content)
       cb_.restore_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseSaveContent(tizen_base::Bundle& content) override {
+  void OnSaveContent(tizen_base::Bundle& content) override {
     if (cb_.save_content)
       cb_.save_content(this, content.GetHandle(), user_data_);
+    FrameComponent::OnSaveContent(content);
   }
 
-  void OnBaseAction(std::string action,
-                component_based::AppControl app_control) override {
+  void OnAction(std::string action, AppControl app_control) override {
+    FrameComponent::OnAction(action, app_control);
     if (cb_.action)
       cb_.action(this, action.c_str(), app_control.GetHandle(), user_data_);
   }
 
-  void OnBaseDeviceOrientationChanged(
+  void OnDeviceOrientationChanged(
       component_based::DeviceOrientation::Orientation orientation) override {
+    FrameComponent::OnDeviceOrientationChanged(orientation);
     if (cb_.device_orientation_changed) {
       cb_.device_orientation_changed(this,
           static_cast<component_device_orientation_e>(orientation),
@@ -242,17 +245,20 @@ class StubFrameComponent : public component_based::FrameComponent {
     }
   }
 
-  void OnBaseLanguageChanged(std::string language) override {
+  void OnLanguageChanged(std::string language) override {
+    FrameComponent::OnLanguageChanged(language);
     if (cb_.language_changed)
       cb_.language_changed(this, language.c_str(), user_data_);
   }
 
-  void OnBaseRegionFormatChanged(std::string region) override {
+  void OnRegionFormatChanged(std::string region) override {
+    FrameComponent::OnRegionFormatChanged(region);
     if (cb_.region_format_changed)
       cb_.region_format_changed(this, region.c_str(), user_data_);
   }
 
-  void OnBaseLowBattery(component_based::LowBattery::Status status) override {
+  void OnLowBattery(LowBattery::Status status) override {
+    FrameComponent::OnLowBattery(status);
     if (cb_.low_battery) {
       cb_.low_battery(this,
           static_cast<component_low_battery_status_e>(status),
@@ -260,7 +266,8 @@ class StubFrameComponent : public component_based::FrameComponent {
     }
   }
 
-  void OnBaseLowMemory(component_based::LowMemory::Status status) override {
+  void OnLowMemory(LowMemory::Status status) override {
+    FrameComponent::OnLowMemory(status);
     if (cb_.low_memory) {
       cb_.low_memory(this,
           static_cast<component_low_memory_status_e>(status),
@@ -268,8 +275,8 @@ class StubFrameComponent : public component_based::FrameComponent {
     }
   }
 
-  void OnBaseSuspendedStateChanged(
-      component_based::SuspendedState::State state) override {
+  void OnSuspendedStateChanged(SuspendedState::State state) override {
+    FrameComponent::OnSuspendedStateChanged(state);
     if (cb_.suspended_state_changed) {
       cb_.suspended_state_changed(this,
           static_cast<component_suspended_state_e>(state),
@@ -282,19 +289,19 @@ class StubFrameComponent : public component_based::FrameComponent {
   void* user_data_;
 };
 
-class StubServiceComponent : public component_based::ServiceComponent {
+class StubServiceComponent : public ServiceComponent {
  public:
-  class Factory : public component_based::ServiceComponent::Factory {
+  class Factory : public Component::FactoryBase {
    public:
-    Factory(service_component_lifecycle_callback_s cb, void* user_data)
-      : cb_(cb), user_data_(user_data) {
+    Factory(std::string comp_id, service_component_lifecycle_callback_s cb, void* user_data)
+      : FactoryBase(std::move(comp_id)), cb_(cb), user_data_(user_data) {
     }
 
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-        std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
-          new (std::nothrow) StubServiceComponent(std::move(comp_id),
-              std::move(inst_id), cb_, user_data_));
+    std::unique_ptr<AppCoreMultiWindowBase::Context> Create(std::string inst_id,
+          AppCoreMultiWindowBase* app) override {
+      return std::unique_ptr<AppCoreMultiWindowBase::Context>(
+          new (std::nothrow) StubServiceComponent(std::move(GetCompId()),
+              std::move(inst_id), app, cb_, user_data_));
     }
 
    private:
@@ -304,9 +311,10 @@ class StubServiceComponent : public component_based::ServiceComponent {
 
   StubServiceComponent(std::string comp_id,
                        std::string inst_id,
+                       AppCoreMultiWindowBase* app,
                        service_component_lifecycle_callback_s cb,
                        void* user_data)
-    : component_based::ServiceComponent(std::move(comp_id), std::move(inst_id)),
+    : component_based::ServiceComponent(std::move(comp_id), std::move(inst_id), app),
       cb_(cb),
       user_data_(user_data) {
   }
@@ -314,8 +322,10 @@ class StubServiceComponent : public component_based::ServiceComponent {
   ~StubServiceComponent() = default;
 
  public:
-  bool OnCreate() override {
-    return cb_.create(this, user_data_);
+  void OnCreate() override {
+    ServiceComponent::OnCreate();
+    if (!cb_.create(this, user_data_))
+      throw std::runtime_error("The callback returns false");
   }
 
   void OnStartCommand(component_based::AppControl app_control,
@@ -327,26 +337,30 @@ class StubServiceComponent : public component_based::ServiceComponent {
   void OnDestroy() override {
     if (cb_.destroy)
       cb_.destroy(this, user_data_);
+    ServiceComponent::OnDestroy();
   }
 
-  void OnBaseRestoreContent(tizen_base::Bundle content) override {
+  void OnRestoreContent(tizen_base::Bundle content) override {
+    ServiceComponent::OnRestoreContent(content);
     if (cb_.restore_content)
       cb_.restore_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseSaveContent(tizen_base::Bundle& content) override {
+  void OnSaveContent(tizen_base::Bundle& content) override {
     if (cb_.save_content)
       cb_.save_content(this, content.GetHandle(), user_data_);
+    ServiceComponent::OnSaveContent(content);
   }
 
-  void OnBaseAction(std::string action,
-                    component_based::AppControl app_control) override {
+  void OnAction(std::string action, AppControl app_control) override {
+    ServiceComponent::OnAction(action, app_control);
     if (cb_.action)
       cb_.action(this, action.c_str(), app_control.GetHandle(), user_data_);
   }
 
-  void OnBaseDeviceOrientationChanged(
-      component_based::DeviceOrientation::Orientation orientation) override {
+  void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) override {
+    ServiceComponent::OnDeviceOrientationChanged(orientation);
     if (cb_.device_orientation_changed) {
       cb_.device_orientation_changed(this,
           static_cast<component_device_orientation_e>(orientation),
@@ -354,17 +368,20 @@ class StubServiceComponent : public component_based::ServiceComponent {
     }
   }
 
-  void OnBaseLanguageChanged(std::string language) override {
+  void OnLanguageChanged(std::string language) override {
+    ServiceComponent::OnLanguageChanged(language);
     if (cb_.language_changed)
       cb_.language_changed(this, language.c_str(), user_data_);
   }
 
-  void OnBaseRegionFormatChanged(std::string region) override {
+  void OnRegionFormatChanged(std::string region) override {
+    ServiceComponent::OnRegionFormatChanged(region);
     if (cb_.region_format_changed)
       cb_.region_format_changed(this, region.c_str(), user_data_);
   }
 
-  void OnBaseLowBattery(component_based::LowBattery::Status status) override {
+  void OnLowBattery(LowBattery::Status status) override {
+    ServiceComponent::OnLowBattery(status);
     if (cb_.low_battery) {
       cb_.low_battery(this,
           static_cast<component_low_battery_status_e>(status),
@@ -372,7 +389,8 @@ class StubServiceComponent : public component_based::ServiceComponent {
     }
   }
 
-  void OnBaseLowMemory(component_based::LowMemory::Status status) override {
+  void OnLowMemory(LowMemory::Status status) override {
+    ServiceComponent::OnLowMemory(status);
     if (cb_.low_memory) {
       cb_.low_memory(this,
           static_cast<component_low_memory_status_e>(status),
@@ -380,8 +398,8 @@ class StubServiceComponent : public component_based::ServiceComponent {
     }
   }
 
-  void OnBaseSuspendedStateChanged(
-      component_based::SuspendedState::State state) override {
+  void OnSuspendedStateChanged(SuspendedState::State state) override {
+    ServiceComponent::OnSuspendedStateChanged(state);
     if (cb_.suspended_state_changed) {
       cb_.suspended_state_changed(this,
           static_cast<component_suspended_state_e>(state),
@@ -454,16 +472,14 @@ component_based_app_add_frame_component(
   }
 
   ::StubFrameComponent::Factory* factory =
-      new (std::nothrow) ::StubFrameComponent::Factory(*callback, user_data);
+      new (std::nothrow) ::StubFrameComponent::Factory(comp_id, *callback, user_data);
   if (factory == nullptr) {
     LOGE("Out of memory");
     set_last_result(APP_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
-  handle->Add(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(factory));
-
+  handle->Add(comp_id, std::unique_ptr<Component::FactoryBase>(factory));
   comp_class = static_cast<component_class_h>(handle);
 
   set_last_result(APP_ERROR_NONE);
@@ -501,16 +517,14 @@ component_based_app_add_service_component(
   }
 
   ::StubServiceComponent::Factory* factory =
-      new (std::nothrow) ::StubServiceComponent::Factory(*callback, user_data);
+      new (std::nothrow) ::StubServiceComponent::Factory(comp_id, *callback, user_data);
   if (factory == nullptr) {
     LOGE("Out of memory");
     set_last_result(APP_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
-  handle->Add(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(factory));
-
+  handle->Add(comp_id, std::unique_ptr<Component::FactoryBase>(factory));
   comp_class = static_cast<component_class_h>(handle);
 
   set_last_result(APP_ERROR_NONE);
@@ -524,14 +538,7 @@ extern "C" EXPORT_API int frame_component_get_display_status(
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
-  if (component->GetType()->GetHash() !=
-      component_based::FrameComponent::FrameType::Hash) {
-    LOGE("Invalid parameter");
-    return COMPONENT_ERROR_INVALID_PARAMETER;
-  }
-
+  Component* component = static_cast<Component*>(context);
   ::StubFrameComponent* frame_component =
     dynamic_cast<::StubFrameComponent*>(component);
   if (frame_component == nullptr) {
@@ -540,13 +547,15 @@ extern "C" EXPORT_API int frame_component_get_display_status(
   }
 
   auto status = frame_component->GetDisplayStatus();
-  if (status == component_based::FrameComponent::DisplayStatus::Unknown) {
+  if (status == FrameComponent::DisplayStatus::Unknown) {
     LOGE("Invalid context");
     return COMPONENT_ERROR_INVALID_CONTEXT;
+  } else if (status == FrameComponent::DisplayStatus::On) {
+    *display_status = COMPONENT_DISPLAY_STATUS_ON;
+  } else if (status == FrameComponent::DisplayStatus::Off) {
+    *display_status = COMPONENT_DISPLAY_STATUS_OFF;
   }
 
-  *display_status = static_cast<component_display_status_e>(status);
-
   return COMPONENT_ERROR_NONE;
 }
 
@@ -558,25 +567,16 @@ extern "C" EXPORT_API int frame_component_get_window(
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  component_based::Component* component =
-      static_cast<component_based::Component*>(context);
-  if (component->GetType()->GetHash() !=
-      component_based::FrameComponent::FrameType::Hash) {
-    LOGE("Invalid parameter");
-    return COMPONENT_ERROR_INVALID_PARAMETER;
-  }
-
+  Component* component = static_cast<Component*>(context);
   ::StubFrameComponent* frame_component =
       dynamic_cast<::StubFrameComponent*>(component);
   if (frame_component == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
-  const component_based::ElmWindow* win =
-      static_cast<const component_based::ElmWindow*>(
+  const ElmWindow* win = static_cast<const ElmWindow*>(
           frame_component->GetWindow());
-  component_based::ElmWindow* elm_win =
-      const_cast<component_based::ElmWindow*>(win);
+  ElmWindow* elm_win = const_cast<ElmWindow*>(win);
   *window = static_cast<Evas_Object*>(elm_win->GetRaw());
 
   return COMPONENT_ERROR_NONE;
index 61b314684d5aa8c61fafff7be6c89d8fe9f10782..2af537c1d4843bcfff4e88f28eb2e1c7c8c767b4 100644 (file)
@@ -1,54 +1,36 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based-efl-widget CXX)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION ${FULLVER})
-
-INCLUDE(FindPkgConfig)
-SET(requires "glib-2.0 bundle dlog ecore-wl2 elementary capi-appfw-app-control")
-SET(pc_requires "elementary component-based-core-widget-base")
-pkg_check_modules(component-based-efl-widget REQUIRED ${requires})
-
-FOREACH(flag ${component-based-efl-widget_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -std=c++11")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/api/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/api/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based-efl-widget_LDFLAGS} component-based-core-widget-base)
-
-SET(PC_NAME component-based-efl-widget)
-SET(PC_REQUIRED ${pc_requires})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} EFL_WIDGET_SRCS)
+
+ADD_LIBRARY(${TARGET_COMPONENT_BASED_EFL_WIDGET} SHARED ${EFL_WIDGET_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_EFL_WIDGET} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../base/
+  ${CMAKE_CURRENT_SOURCE_DIR}/../base/api/)
+
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_EFL_WIDGET} PROPERTIES
+  SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_EFL_WIDGET} PROPERTIES
+  VERSION ${FULLVER})
+TARGET_LINK_LIBRARIES(${TARGET_COMPONENT_BASED_EFL_WIDGET} PUBLIC
+  ${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE})
+
+SET(PC_NAME ${TARGET_COMPONENT_BASED_EFL_WIDGET})
+SET(PC_REQUIRED "elementary component-based-core-widget-base app-core-multi-window-cpp")
+
+CONFIGURE_FILE(${TARGET_COMPONENT_BASED_EFL_WIDGET}.pc.in
+  ${TARGET_COMPONENT_BASED_EFL_WIDGET}.pc @ONLY)
+INSTALL(FILES ${TARGET_COMPONENT_BASED_EFL_WIDGET}.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_EFL_WIDGET}
+  DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
        DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/efl_widget_base
-       FILES_MATCHING PATTERN "*.h")
+       FILES_MATCHING
+  PATTERN "*.h")
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/api
        DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/efl_widget_base
-       FILES_MATCHING PATTERN "*.h")
-
-
+       FILES_MATCHING
+  PATTERN "*.h")
index 00504dc6e4846b0c1fc815ddd576cecd16692a43..ac69ff0c84361d2dc78ee6268a862c637e4f8fe4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index b3e35d210fa4fa3daeba571bf2ec4170cca6ee2e..27a7a33c47ad27d565f21dee32723fb2aa76f682 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 6c5bf60e084accc21214425a67b4ff11e8c36c29..f6f94f71d33af31f2911f34142e5036d659632f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 2c1cd77a5e4056f485895b5c9ba7d587b4f84bd4..746ecd072ae0cb716c54b12b280d721f58d50da0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
  * limitations under the License.
  */
 
+#include <Ecore_Wl2.h>
+#include <app_common.h>
 #include <dlog.h>
 #include <unistd.h>
 
-#include <app_common.h>
-#include <Ecore_Wl2.h>
-
 #include "component_based/base/api/component_common.h"
 #include "component_based/common/exception.h"
 #include "component_based/efl_base/application.h"
 #endif
 #define EXPORT_API __attribute__((visibility("default")))
 
+using namespace component_based;
+using namespace tizen_cpp;
+
 namespace {
 
 class ComponentClass {
  public:
   void Add(std::string comp_id,
-      std::unique_ptr<component_based::Component::Factory> factory) {
+      std::unique_ptr<Component::FactoryBase> factory) {
     auto iter = facs_.find(comp_id);
     if (iter != facs_.end())
       LOGW("Already exists");
@@ -50,28 +52,34 @@ class ComponentClass {
     facs_[comp_id] = std::move(factory);
   }
 
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>>
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>>
   Detach() {
     return std::move(facs_);
   }
 
  private:
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>> facs_;
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>> facs_;
 };
 
-class StubWidgetComponent : public component_based::WidgetComponent {
+class StubWidgetComponent : public WidgetComponent {
  public:
-  class Factory : public component_based::WidgetComponent::Factory {
+  class Factory : public Component::FactoryBase {
    public:
-    Factory(widget_component_lifecycle_callback_s cb, void* user_data)
-      : cb_(cb), user_data_(user_data) {
+    Factory(std::string comp_id, widget_component_lifecycle_callback_s cb,
+        void* user_data) : Component::FactoryBase(std::move(comp_id)),
+        cb_(cb), user_data_(user_data) {
     }
 
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-        std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
-          new (std::nothrow) StubWidgetComponent(std::move(comp_id),
-          std::move(inst_id), start_data, cb_, user_data_));
+    std::unique_ptr<AppCoreMultiWindowBase::Context> Create(std::string inst_id,
+          AppCoreMultiWindowBase* app) override {
+      auto* widget_app = dynamic_cast<ApplicationBase*>(app);
+      if (!widget_app)
+        return nullptr;
+
+      return std::unique_ptr<AppCoreMultiWindowBase::Context>(
+          new (std::nothrow) StubWidgetComponent(
+              GetCompId(), std::move(inst_id),
+              widget_app->GetData(), app, cb_, user_data_));
     }
 
    private:
@@ -80,10 +88,11 @@ class StubWidgetComponent : public component_based::WidgetComponent {
   };
 
   StubWidgetComponent(std::string comp_id, std::string inst_id,
-      tizen_base::Bundle& start_data,
+      const tizen_base::Bundle& start_data,
+      tizen_cpp::AppCoreMultiWindowBase* app,
       widget_component_lifecycle_callback_s cb, void* user_data)
-      : component_based::WidgetComponent(std::move(comp_id), std::move(inst_id),
-          start_data),
+      : WidgetComponent(std::move(comp_id), std::move(inst_id),
+          start_data, app),
       cb_(cb),
       user_data_(user_data) {
   }
@@ -98,7 +107,7 @@ class StubWidgetComponent : public component_based::WidgetComponent {
       return nullptr;
     }
 
-    auto elm_win = new (std::nothrow) component_based::ElmWidgetWindow(win);
+    auto elm_win = new (std::nothrow) ElmWidgetWindow(win);
     if (elm_win == nullptr) {
       LOGE("Out of memory");
       return nullptr;
@@ -133,18 +142,18 @@ class StubWidgetComponent : public component_based::WidgetComponent {
       cb_.destroy(this, permanent, user_data_);
   }
 
-  void OnBaseRestoreContent(tizen_base::Bundle content) override {
+  void OnRestoreContent(tizen_base::Bundle content) override {
     if (cb_.restore_content)
       cb_.restore_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseSaveContent(tizen_base::Bundle& content) override {
+  void OnSaveContent(tizen_base::Bundle& content) override {
     if (cb_.save_content)
       cb_.save_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseDeviceOrientationChanged(
-      component_based::DeviceOrientation::Orientation orientation) override {
+  void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) override {
     if (cb_.device_orientation_changed) {
       cb_.device_orientation_changed(this,
           static_cast<component_device_orientation_e>(orientation),
@@ -152,17 +161,17 @@ class StubWidgetComponent : public component_based::WidgetComponent {
     }
   }
 
-  void OnBaseLanguageChanged(std::string language) override {
+  void OnLanguageChanged(std::string language) override {
     if (cb_.language_changed)
       cb_.language_changed(this, language.c_str(), user_data_);
   }
 
-  void OnBaseRegionFormatChanged(std::string region) override {
+  void OnRegionFormatChanged(std::string region) override {
     if (cb_.region_format_changed)
       cb_.region_format_changed(this, region.c_str(), user_data_);
   }
 
-  void OnBaseLowBattery(component_based::LowBattery::Status status) override {
+  void OnLowBattery(LowBattery::Status status) override {
     if (cb_.low_battery) {
       cb_.low_battery(this,
           static_cast<component_low_battery_status_e>(status),
@@ -170,7 +179,7 @@ class StubWidgetComponent : public component_based::WidgetComponent {
     }
   }
 
-  void OnBaseLowMemory(component_based::LowMemory::Status status) override {
+  void OnLowMemory(LowMemory::Status status) override {
     if (cb_.low_memory) {
       cb_.low_memory(this,
           static_cast<component_low_memory_status_e>(status),
@@ -178,8 +187,7 @@ class StubWidgetComponent : public component_based::WidgetComponent {
     }
   }
 
-  void OnBaseSuspendedStateChanged(
-      component_based::SuspendedState::State state) override {
+  void OnSuspendedStateChanged(SuspendedState::State state) override {
     if (cb_.suspended_state_changed) {
       cb_.suspended_state_changed(this,
           static_cast<component_suspended_state_e>(state),
@@ -225,16 +233,14 @@ component_based_app_add_widget_component(
   }
 
   ::StubWidgetComponent::Factory* factory =
-      new (std::nothrow) ::StubWidgetComponent::Factory(*callback, user_data);
+      new (std::nothrow) ::StubWidgetComponent::Factory(comp_id, *callback, user_data);
   if (factory == nullptr) {
     LOGE("Out of memory");
     set_last_result(APP_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
-  handle->Add(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(factory));
-
+  handle->Add(comp_id, std::unique_ptr<Component::FactoryBase>(factory));
   comp_class = static_cast<component_class_h>(handle);
 
   set_last_result(APP_ERROR_NONE);
@@ -249,30 +255,24 @@ extern "C" EXPORT_API int widget_component_get_window(
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  auto component = static_cast<component_based::Component*>(context);
-  if (component->GetType()->GetHash() !=
-      component_based::WidgetComponent::WidgetType::Hash) {
-    LOGE("Invalid parameter");
-    return COMPONENT_ERROR_INVALID_PARAMETER;
-  }
-
-  auto widget_component = dynamic_cast<::StubWidgetComponent*>(component);
+  auto* component = static_cast<Component*>(context);
+  auto* widget_component = dynamic_cast<::StubWidgetComponent*>(component);
   if (widget_component == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
-  auto* win = static_cast<const component_based::ElmWidgetWindow*>(
+  auto* win = static_cast<const ElmWidgetWindow*>(
       widget_component->GetWindow());
   if (win == nullptr) {
-    win = new (std::nothrow) component_based::ElmWidgetWindow(
-        widget_component->GetInstanceID());
+    win = new (std::nothrow) ElmWidgetWindow(
+        widget_component->GetInstId());
     if (win == nullptr) {
       LOGE("Out of memory");
       return COMPONENT_ERROR_OUT_OF_MEMORY;
     }
   }
 
-  auto elm_win = const_cast<component_based::ElmWidgetWindow*>(win);
+  auto* elm_win = const_cast<ElmWidgetWindow*>(win);
   *window = static_cast<Evas_Object*>(elm_win->GetRaw());
 
   return COMPONENT_ERROR_NONE;
index 0c42c5ee40ca34e3af3da27dc58a72b1ba63dac1..f0285dfe966f385f8e282f8549eefffc02a41580 100644 (file)
@@ -1,44 +1,37 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based-port CXX)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION ${FULLVER})
-
-INCLUDE(FindPkgConfig)
-
-SET(requires "glib-2.0 gio-2.0 dlog parcel cynara-client cynara-creds-socket aul")
-
-pkg_check_modules(component-based-port REQUIRED ${requires})
-
-FOREACH(flag ${component-based-port_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++14")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} PORT_SRCS)
+
+ADD_LIBRARY(${TARGET_COMPONENT_BASED_PORT} SHARED ${PORT_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_PORT} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../)
+
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_PORT} PROPERTIES
+  VERSION ${FULLVER})
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_PORT} PROPERTIES
+  SOVERSION ${MAJORVER})
+TARGET_LINK_LIBRARIES(${TARGET_COMPONENT_BASED_PORT} PUBLIC -lpthread)
+
+APPLY_PKG_CONFIG(${TARGET_COMPONENT_BASED_PORT} PUBLIC
+  AUL_DEPS
+  CYNARA_CLIENT_DEPS
+  CYNARA_CREDS_SOCKET_DEPS
+  DLOG_DEPS
+  GIO_DEPS
+  GLIB_DEPS
+  PARCEL_DEPS
+)
 
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based-port_LDFLAGS} -lpthread)
+SET(PC_NAME ${TARGET_COMPONENT_BASED_PORT})
+SET(PC_REQUIRED "parcel")
 
-SET(PC_NAME component-based-port)
-SET(PC_REQUIRED ${pc_requires})
+CONFIGURE_FILE(${TARGET_COMPONENT_BASED_PORT}.pc.in
+  ${TARGET_COMPONENT_BASED_PORT}.pc @ONLY)
+INSTALL(FILES ${TARGET_COMPONENT_BASED_PORT}.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_PORT} DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/api/component_port.h
   DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/port/api)
 
index ecf74c22a729b80a6a4739e5594c3ab2b6698ab6..ad1bde1835a267df63e2aaf0e86156bf09713a1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 5b60b76dccb8868e936655690bba63b67eb45e4b..09f9f637d771d960268232aec0d81993c3b9e300 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 55768536e60bcff94436856ac8d445e54c523d42..cfbb0e7fefb040699bfa60259dacd8221801c3a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 4539f21b36f311a41aea0da90f83325774e28f6e..24820f0c9c9b83b795cdb5e59237481876227c00 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
@@ -17,8 +17,8 @@
 #ifndef COMPONENT_BASED_PORT_EXCEPTION_HH_
 #define COMPONENT_BASED_PORT_EXCEPTION_HH_
 
-#include <string>
 #include <exception>
+#include <string>
 
 #include "component_based/port/log_private.hh"
 
index fe31fe06f48d5358a20c076da6f1b72dea830f3d..d62bd49e28b7f5a640caf6eca82114357308353b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index d4b7d6b20b5cc81db8deb663e1bee98c95cda6a1..ad585dac030c1b6fcce30006c060e85210807acc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 0a465ad3cbcac313052bebddfeb60a5ebc68c992..d9e358b3c6182eaa04527b8bddfe574ec9021c21 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 06060f35ad6d12fb59bd2b1cf89d7fddbf930ebc..68b2a8e4c13cdd1043225049051370e669a9a4dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 424a1355ee7316c0421eb295dee3387f1976d654..22850d1e67441869a11a0184c7791241c0e7bb41 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 420b66e65431cbdf2fc2ae35174bc6b07fc2da97..fb70d4da55b42e724cc829552ad05e930d249751 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index bd7e0d7c931379bac2cecb9fdae830417790b158..caf712d97c45cb4171c9d12aa5bb7a89fc695085 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 09e63d6add370e63506da5d593387e795c208a54..50ef12386ac0248c8f803ce10bc2e980fe303132 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index e3716b53d603d78f5c190b66101fcae0c4a41857..6029181bb65d07fc6d273d2d3172e92a08b97cf5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 9c26ab8823fbf9e1566591734d2399918c884ae7..a00f695a342c4ae5b66c98ba744a03c6842e4bf4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 84ce8fa57337757511dd5da48f4e10642ef2c908..ae5f1eef6753521a260ed5201d2b0e4d9fd0133f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 5543273876ff6e0cb3ab2a6c08fcfbe573459e07..941d21ad3c81c7f3f67d80cb6ae79b1d91f014d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index db0755b0b1f929f3826539b12485bf326d3c35cf..cb3589c27a73125a152c88c84aab881a0270358a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 62142b57704bdaeb66105fc5ffcff6d34016a2eb..ca4ed4fd0531a18bafe7f11a84659ea63a8c3759 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 77500ffb8f922c83fd0743bd1df6f25fe5a63148..9c8bdac2f7b78f8c81393d3ed0c9bf7bb8718099 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 24ccee79c920ffb888476f3dea98d76d1a523e24..fdd1025ea8a4224df53199847f35e3e74b7a03ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index d9e67f6aaf98277be0138c0d9c23e8380efdcd89..44c11526a8fd2b9e8ed338eee1360e6fd4b34b1b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index c392db91da195e3b4f02991b008e55ff2dbe584b..c59d974a70163f9ef9ad7078c6cd48cb8424305d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 023897cb263c8fe490488bf9d868cfd28eae4719..fc650c314209001ce27086892f6613d46e702f14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 043a8a601a87aefb8c10e045ef7b5519d3ef894f..a0bf4ae43ef80ac5d56c669267b3c5fbce04f84a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 86ee29bcbd3a4278c49dce6d7141374e11d847f9..ccec6da59355184cb210803cd70a7a360f54b162 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 2e8f62c4bd057a6a22f89ee19f81115fad38673e..1fd3e66220dd169c4ff977da819b484e1e604295 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index b0278ecbe413a7668422e8bcb1b46e93480bd416..c032f2707a586193eb476b80632b4ed53cd7f936 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index f91b9fb93b85ba9b5a4234f9d893896156c398cb..aa7d09be495fb4dbd22598330871ca4ac3bf0990 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index c10e51e9a65a101389655c89754b5448b5735b7f..f63f82ba9c236465761639e95c43e04c1ebc37d1 100644 (file)
@@ -1,42 +1,32 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based-uri CXX)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION ${FULLVER})
-
-INCLUDE(FindPkgConfig)
-SET(requires "glib-2.0 dlog")
-SET(pc_requires "")
-
-pkg_check_modules(component-based-uri REQUIRED ${requires})
-
-FOREACH(flag ${component-based-uri_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based-uri_LDFLAGS})
-
-SET(PC_NAME component-based-uri)
-SET(PC_REQUIRED ${pc_requires})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/uri
-       FILES_MATCHING PATTERN "*.h")
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} URI_SRCS)
+
+ADD_LIBRARY(${TARGET_COMPONENT_BASED_URI} SHARED ${URI_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_URI} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../)
+
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_URI} PROPERTIES
+  SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_URI} PROPERTIES
+  VERSION ${FULLVER})
+
+APPLY_PKG_CONFIG(${TARGET_COMPONENT_BASED_URI} PUBLIC
+  DLOG_DEPS
+  GLIB_DEPS
+)
+
+SET(PC_NAME ${TARGET_COMPONENT_BASED_URI})
+SET(PC_REQUIRED "")
+
+CONFIGURE_FILE(${TARGET_COMPONENT_BASED_URI}.pc.in
+  ${TARGET_COMPONENT_BASED_URI}.pc @ONLY)
+INSTALL(FILES ${TARGET_COMPONENT_BASED_URI}.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_URI} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
+  DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/uri
+       FILES_MATCHING
+  PATTERN "*.h")
index 8ab5e157ef3301673584e688c14521f7cdbbe883..38344f322160e3430b6ffadc80ab716cdf535351 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 3965d3f6d97575de84f11487c621375234712333..e8234f5ad3ba03354194963722e6426005a20863 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
@@ -17,6 +17,7 @@
 #include <glib.h>
 
 #include <memory>
+#include <utility>
 
 #include "component_based/uri/component_based_uri.h"
 
index 8b6797f7ea3dae2b6eac3ee55b02539fb76c6fc8..39446be141566751c089e31ae8ef781a9556dfc7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 - 2021 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.
index 5175100d6a9ad9f37e9f0cadf30546259a36f3df..39d90fb3372b48a4310f1255d50dc5a10db85b63 100644 (file)
@@ -1,53 +1,51 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based-core-widget-base CXX)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION ${FULLVER})
-
-INCLUDE(FindPkgConfig)
-SET(requires "glib-2.0 bundle dlog ecore-wl2 appcore-multiwindow elementary capi-appfw-app-control widget_service screen_connector_provider")
-SET(pc_requires "elementary component-based-core-base appcore-multiwindow widget_service screen_connector_provider")
-pkg_check_modules(component-based-core-widget-base REQUIRED ${requires})
-
-FOREACH(flag ${component-based-core-widget-base_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -std=c++11")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/api/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/api/)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based-core-widget-base_LDFLAGS} component-based-core-base)
-
-SET(PC_NAME component-based-core-widget-base)
-SET(PC_REQUIRED ${pc_requires})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} CORE_WIDGET_BASE_SRCS)
+
+ADD_LIBRARY(${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE} SHARED
+  ${CORE_WIDGET_BASE_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../base/
+  ${CMAKE_CURRENT_SOURCE_DIR}/../base/api/
+  ${CMAKE_CURRENT_SOURCE_DIR}/api)
+
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE} PROPERTIES
+  SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE} PROPERTIES
+  VERSION ${FULLVER})
+TARGET_LINK_LIBRARIES(${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE} PUBLIC
+  ${TARGET_COMPONENT_BASED_CORE_BASE})
+
+APPLY_PKG_CONFIG(${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE} PUBLIC
+  APP_CORE_MULTI_WINDOW_NEXT_DEPS
+  BUNDLE_DEPS
+  CAPI_APPFW_APP_CONTROL_DEPS
+  DLOG_DEPS
+  ECORE_WL2_DEPS
+  ELEMENTARY_DEPS
+  GLIB_DEPS
+  SCREEN_CONNECTOR_PROVIDER_DEPS
+  WIDGET_SERVICE_DEPS
+)
+
+SET(PC_NAME ${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE})
+SET(PC_REQUIRED "elementary component-based-core-base app-core-multi-window-cpp widget_service screen_connector_provider")
+
+CONFIGURE_FILE(${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE}.pc.in
+  ${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE}.pc @ONLY)
+INSTALL(FILES ${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE}.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE}
+  DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
        DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/widget_base
-       FILES_MATCHING PATTERN "*.h")
+       FILES_MATCHING
+  PATTERN "*_implementation.h" EXCLUDE
+  PATTERN "*.h")
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/api
        DESTINATION ${INCLUDE_INSTALL_DIR}/component_based/widget_base
-       FILES_MATCHING PATTERN "*.h")
-
+       FILES_MATCHING
+  PATTERN "*.h")
index 3ca68e361bac1ce51f8622589f80d3e71ab7c0cf..cd012fc6e1eff486948c168ce0735a9e0cc251e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index bda012de911f56c00d373afbc1e7600349d0270e..63cd5d152f446295bb220cb1cb62fbf79f95704e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
@@ -37,6 +37,9 @@
 #endif
 #define EXPORT_API __attribute__((visibility("default")))
 
+using namespace component_based;
+using namespace tizen_cpp;
+
 struct widget_window_s {
   int id;
   void* raw;
@@ -47,7 +50,7 @@ namespace {
 class ComponentClass {
  public:
   void Add(std::string comp_id,
-      std::unique_ptr<component_based::Component::Factory> factory) {
+      std::unique_ptr<Component::FactoryBase> factory) {
     auto iter = facs_.find(comp_id);
     if (iter != facs_.end())
       LOGW("Already exists");
@@ -55,29 +58,34 @@ class ComponentClass {
     facs_[comp_id] = std::move(factory);
   }
 
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>>
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>>
   Detach() {
     return std::move(facs_);
   }
 
  private:
-  std::map<std::string, std::unique_ptr<component_based::Component::Factory>> facs_;
+  std::map<std::string, std::unique_ptr<Component::FactoryBase>> facs_;
 };
 
-class StubWidgetComponent : public component_based::WidgetComponent {
+class StubWidgetComponent : public WidgetComponent {
  public:
-  class Factory : public component_based::WidgetComponent::Factory {
+  class Factory : public Component::FactoryBase {
    public:
-    Factory(base_widget_component_lifecycle_callback_s cb, void* user_data)
-      : cb_(cb), user_data_(user_data) {
+    Factory(std::string comp_id, base_widget_component_lifecycle_callback_s cb,
+        void* user_data) : Component::FactoryBase(std::move(comp_id)),
+        cb_(cb), user_data_(user_data) {
     }
 
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-        std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
+    std::unique_ptr<AppCoreMultiWindowBase::Context> Create(std::string inst_id,
+          AppCoreMultiWindowBase* app) override {
+      auto* widget_app = dynamic_cast<ApplicationBase*>(app);
+      if (!widget_app)
+        return nullptr;
+
+      return std::unique_ptr<AppCoreMultiWindowBase::Context>(
           new (std::nothrow) StubWidgetComponent(
-              std::move(comp_id), std::move(inst_id),
-              start_data, cb_, user_data_));
+              GetCompId(), std::move(inst_id), app,
+              widget_app->GetData(), cb_, user_data_));
     }
 
    private:
@@ -86,10 +94,11 @@ class StubWidgetComponent : public component_based::WidgetComponent {
   };
 
   StubWidgetComponent(std::string comp_id, std::string inst_id,
-      tizen_base::Bundle &start_data,
+      AppCoreMultiWindowBase* app,
+      const tizen_base::Bundle& start_data,
       base_widget_component_lifecycle_callback_s cb, void* user_data)
-      : component_based::WidgetComponent(std::move(comp_id), std::move(inst_id),
-          start_data),
+      : WidgetComponent(std::move(comp_id), std::move(inst_id),
+          start_data, app),
       cb_(cb),
       user_data_(user_data) {
   }
@@ -105,8 +114,7 @@ class StubWidgetComponent : public component_based::WidgetComponent {
       return nullptr;
     }
 
-    component_based::WidgetWindow* wgt_win =
-        new (std::nothrow) component_based::WidgetWindow(win->id, win->raw);
+    WidgetWindow* wgt_win = new (std::nothrow) WidgetWindow(win->id, win->raw);
     base_widget_destroy_window(win);
     if (wgt_win == nullptr) {
       LOGE("Out of memory");
@@ -118,21 +126,25 @@ class StubWidgetComponent : public component_based::WidgetComponent {
   }
 
   void OnStart(bool restarted) override {
+    WidgetComponent::OnStart(restarted);
     if (cb_.start)
       cb_.start(this, restarted, user_data_);
   }
 
   void OnResume() override {
+    WidgetComponent::OnResume();
     if (cb_.resume)
       cb_.resume(this, user_data_);
   }
 
   void OnPause() override {
+    WidgetComponent::OnPause();
     if (cb_.pause)
       cb_.pause(this, user_data_);
   }
 
   void OnStop() override {
+    WidgetComponent::OnStop();
     if (cb_.stop)
       cb_.stop(this, user_data_);
   }
@@ -140,20 +152,24 @@ class StubWidgetComponent : public component_based::WidgetComponent {
   void OnDestroy(bool permanent) override {
     if (cb_.destroy)
       cb_.destroy(this, permanent, user_data_);
+    WidgetComponent::OnDestroy(permanent);
   }
 
-  void OnBaseRestoreContent(tizen_base::Bundle content) override {
+  void OnRestoreContent(tizen_base::Bundle content) override {
+    WidgetComponent::OnRestoreContent(content);
     if (cb_.restore_content)
       cb_.restore_content(this, content.GetHandle(), user_data_);
   }
 
-  void OnBaseSaveContent(tizen_base::Bundle& content) override {
+  void OnSaveContent(tizen_base::Bundle& content) override {
     if (cb_.save_content)
       cb_.save_content(this, content.GetHandle(), user_data_);
+    WidgetComponent::OnSaveContent(content);
   }
 
-  void OnBaseDeviceOrientationChanged(
-      component_based::DeviceOrientation::Orientation orientation) override {
+  void OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation orientation) override {
+    WidgetComponent::OnDeviceOrientationChanged(orientation);
     if (cb_.device_orientation_changed) {
       cb_.device_orientation_changed(this,
           static_cast<component_device_orientation_e>(orientation),
@@ -161,17 +177,20 @@ class StubWidgetComponent : public component_based::WidgetComponent {
     }
   }
 
-  void OnBaseLanguageChanged(std::string language) override {
+  void OnLanguageChanged(std::string language) override {
+    WidgetComponent::OnLanguageChanged(language);
     if (cb_.language_changed)
       cb_.language_changed(this, language.c_str(), user_data_);
   }
 
-  void OnBaseRegionFormatChanged(std::string region) override {
+  void OnRegionFormatChanged(std::string region) override {
+    WidgetComponent::OnRegionFormatChanged(region);
     if (cb_.region_format_changed)
       cb_.region_format_changed(this, region.c_str(), user_data_);
   }
 
-  void OnBaseLowBattery(component_based::LowBattery::Status status) override {
+  void OnLowBattery(LowBattery::Status status) override {
+    WidgetComponent::OnLowBattery(status);
     if (cb_.low_battery) {
       cb_.low_battery(this,
           static_cast<component_low_battery_status_e>(status),
@@ -179,7 +198,8 @@ class StubWidgetComponent : public component_based::WidgetComponent {
     }
   }
 
-  void OnBaseLowMemory(component_based::LowMemory::Status status) override {
+  void OnLowMemory(LowMemory::Status status) override {
+    WidgetComponent::OnLowMemory(status);
     if (cb_.low_memory) {
       cb_.low_memory(this,
           static_cast<component_low_memory_status_e>(status),
@@ -187,8 +207,8 @@ class StubWidgetComponent : public component_based::WidgetComponent {
     }
   }
 
-  void OnBaseSuspendedStateChanged(
-      component_based::SuspendedState::State state) override {
+  void OnSuspendedStateChanged(SuspendedState::State state) override {
+    WidgetComponent::OnSuspendedStateChanged(state);
     if (cb_.suspended_state_changed) {
       cb_.suspended_state_changed(this,
           static_cast<component_suspended_state_e>(state),
@@ -282,16 +302,14 @@ component_based_app_base_add_widget_component(
   }
 
   ::StubWidgetComponent::Factory* factory =
-      new (std::nothrow) ::StubWidgetComponent::Factory(*callback, user_data);
+      new (std::nothrow) ::StubWidgetComponent::Factory(comp_id, *callback, user_data);
   if (factory == nullptr) {
     LOGE("Out of memory");
     set_last_result(APP_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
-  handle->Add(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(factory));
-
+  handle->Add(comp_id, std::unique_ptr<Component::FactoryBase>(factory));
   comp_class = static_cast<component_class_h>(handle);
   return comp_class;
 }
index f97d88c850992201997d38781718407a030309b6..7c3f8254d68ba22582fb524ba7ac13251b0ae44c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
@@ -24,8 +24,9 @@
 #include <app_control_internal.h>
 
 #include <memory>
+#include <utility>
+#include <vector>
 
-#include "component_based/base/component_manager_internal.h"
 #include "component_based/base/dlog_internal.h"
 #include "component_based/common/exception.h"
 #include "component_based/widget_base/widget_component.h"
@@ -34,6 +35,8 @@
 #define STATUS_FOREGROUND "fg"
 #define STATUS_BACKGROUND "bg"
 
+using namespace tizen_cpp;
+
 namespace component_based {
 
 WidgetComponent::Impl::Impl(WidgetComponent* parent)
@@ -42,9 +45,9 @@ WidgetComponent::Impl::Impl(WidgetComponent* parent)
 }
 
 WidgetComponent::WidgetComponent(std::string comp_id, std::string inst_id,
-    tizen_base::Bundle& start_data)
+    const tizen_base::Bundle& start_data, AppCoreMultiWindowBase* app)
   : Component::Component(std::move(comp_id),
-                         std::move(inst_id)), impl_(new Impl(this))  {
+                         std::move(inst_id), app), impl_(new Impl(this))  {
   char pkgid[256] = {0, };
   if (aul_app_get_pkgid_bypid(getpid(), pkgid, sizeof(pkgid)) != 0)
     THROW(Exception::ErrorCodes::IOError);
@@ -55,7 +58,7 @@ WidgetComponent::WidgetComponent(std::string comp_id, std::string inst_id,
 
   impl_->pkgid_ = std::string(pkgid);
   impl_->appid_ = std::string(appid);
-  impl_->widget_id_ = GetComponentID() + "@" + impl_->appid_;
+  impl_->widget_id_ = GetContextId() + "@" + impl_->appid_;
   impl_->viewer_endpoint_ = start_data.GetString(AUL_K_WIDGET_VIEWER);
   std::string width_str = start_data.GetString(WIDGET_K_WIDTH);
   std::string height_str = start_data.GetString(WIDGET_K_HEIGHT);
@@ -79,16 +82,13 @@ WidgetComponent::~WidgetComponent() {
 }
 
 const IWindow* WidgetComponent::GetWindow() {
-  IComponentManager& manager = GetComponentManager();
-  IWindowComponentManager& w_manager =
-      static_cast<IWindowComponentManager&>(manager);
-  return w_manager.GetWindow(GetInstanceID());
+  return impl_->win_.get();
 }
 
 bool WidgetComponent::Impl::SendStatus(int status, tizen_base::Bundle extra) {
   int lifecycle;
   int ret = aul_widget_send_status_to_viewer(widget_id_.c_str(),
-      parent_->GetInstanceID().c_str(), viewer_endpoint_.c_str(),
+      parent_->GetInstId().c_str(), viewer_endpoint_.c_str(),
       status, -1, extra.GetCount() != 0 ? extra.GetHandle() : nullptr);
   if (ret != 0)
     return false;
@@ -96,7 +96,7 @@ bool WidgetComponent::Impl::SendStatus(int status, tizen_base::Bundle extra) {
   lifecycle = widget_instance_convert_event_to_lifecycle_status(status);
   if (lifecycle > -1) {
     ret = aul_widget_send_status_to_service(
-      widget_id_.c_str(), parent_->GetInstanceID().c_str(),
+      widget_id_.c_str(), parent_->GetInstId().c_str(),
       pkgid_.c_str(), lifecycle);
     if (ret != 0)
       return false;
@@ -134,56 +134,52 @@ gboolean WidgetComponent::Impl::PeriodTimeoutCb(gpointer user_data) {
   return G_SOURCE_CONTINUE;
 }
 
-bool WidgetComponent::OnBaseCreate() {
+void WidgetComponent::OnCreate() {
+  Component::OnCreate();
   screen_connector_provider_init();
-  std::unique_ptr<IWindow> win = OnCreate(impl_->width_, impl_->height_);
+  std::unique_ptr<component_based::IWindow> win = OnCreate(
+      impl_->width_, impl_->height_);
   if (win == nullptr) {
     LOGE("OnCreate() returns nullptr");
     impl_->SendStatus(WIDGET_INSTANCE_EVENT_CREATE_ABORTED);
-    return false;
-  }
-
-  IComponentManager& manager = GetComponentManager();
-  IWindowComponentManager& w_manager =
-      static_cast<IWindowComponentManager&>(manager);
-  if (!w_manager.Bind(GetInstanceID(), std::move(win))) {
-    LOGE("Bind window fail");
-    if (!impl_->SendStatus(WIDGET_INSTANCE_EVENT_CREATE_ABORTED))
-      LOGE("Fail to send abort event");
-    return false;
+    throw std::runtime_error("OnCreate() returns nullptr");
   }
 
-  int win_id = GetWindow()->GetResID();
-  Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
+  int win_id = win->GetResID();
+  Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(nullptr);
   Ecore_Wl2_Window* wl_win = ecore_wl2_display_window_find(display, win_id);
+  WindowBind(wl_win);
+
   struct wl_surface* surface = ecore_wl2_window_surface_get(wl_win);
   int ret = screen_connector_provider_remote_enable(
-      GetInstanceID().c_str(), surface);
+      GetInstId().c_str(), surface);
   if (ret != 0) {
     LOGE("Fail to enable sc provider");
-    return false;
+    throw std::runtime_error("Fail to enable sc provider");
   }
 
   LOGD("%s is created", impl_->widget_id_.c_str());
   ret = aul_widget_instance_add(
-      impl_->widget_id_.c_str(), GetInstanceID().c_str());
+      impl_->widget_id_.c_str(), GetInstId().c_str());
   if (ret != 0) {
     LOGE("Fail to add instance");
-    return false;
+    throw std::runtime_error("Fail to add instance");
   }
 
   if (!impl_->SendStatus(WIDGET_INSTANCE_EVENT_CREATE)) {
     LOGE("Fail to send create event");
-    return false;
+    throw std::runtime_error("Fail to send create event");
   }
-  return true;
+
+  impl_->win_ = std::move(win);
 }
 
-void WidgetComponent::OnBaseDestroy() {
+void WidgetComponent::OnDestroy() {
   if (impl_->last_operation_ == "destroy")
     impl_->DestroyProcess();
   else
     impl_->TerminateProcess();
+  Component::OnDestroy();
 }
 
 void WidgetComponent::Impl::ResizeProcess(tizen_base::Bundle data) {
@@ -217,7 +213,7 @@ void WidgetComponent::Impl::DestroyProcess() {
   LOGE("destroy process!!");
   parent_->OnDestroy(true);
   int ret = aul_widget_instance_del(widget_id_.c_str(),
-      parent_->GetInstanceID().c_str());
+      parent_->GetInstId().c_str());
   if (ret != 0)
     LOGE("Fail to delete widget instance (%d)", ret);
 
@@ -251,7 +247,7 @@ void WidgetComponent::Impl::PeriodProcess(tizen_base::Bundle data) {
   }
 }
 
-void WidgetComponent::OnBaseStart(AppControl control, bool restarted) {
+void WidgetComponent::OnStart(AppControl control, bool restarted) {
   bundle* raw_data;
   app_control_to_bundle(control.GetHandle(), &raw_data);
   tizen_base::Bundle data(raw_data, true, true);
@@ -269,10 +265,10 @@ void WidgetComponent::OnBaseStart(AppControl control, bool restarted) {
     Finish();
     return;
   } else if (impl_->last_operation_ == "resume") {
-    OnBaseResume();
+    OnResume();
     return;
   } else if (impl_->last_operation_ == "pause") {
-    OnBasePause();
+    OnPause();
     return;
   } else if (impl_->last_operation_ == "period") {
     impl_->PeriodProcess(data);
@@ -281,14 +277,13 @@ void WidgetComponent::OnBaseStart(AppControl control, bool restarted) {
   std::string content_str = data.GetString("__WIDGET_CONTENT_INFO__");
   if (!content_str.empty()) {
     tizen_base::Bundle content(content_str);
-    OnBaseRestoreContent(content);
+    OnRestoreContent(content);
   } else {
-    OnBaseRestoreContent(GetContent());
+    OnRestoreContent(GetContent());
   }
-  OnStart(restarted);
 }
 
-void WidgetComponent::OnBaseResume() {
+void WidgetComponent::OnResume() {
   if (GetState() == State::Paused ||
       GetState() == State::Started ||
       GetState() == State::Stopped) {
@@ -305,10 +300,10 @@ void WidgetComponent::OnBaseResume() {
           impl_->PeriodTimeoutCb, this);
     }
 
-    OnResume();
+    Component::OnResume();
     SetState(State::Running);
     int ret = aul_comp_status_update(
-        GetInstanceID().c_str(), COMP_STATUS_RESUMED);
+        GetInstId().c_str(), COMP_STATUS_RESUMED);
     if (ret != 0) {
       LOGE("fail to update comp status");
       return;
@@ -326,14 +321,14 @@ void WidgetComponent::OnBaseResume() {
   }
 }
 
-void WidgetComponent::OnBasePause() {
+void WidgetComponent::OnPause() {
   if (GetState() != State::Running) {
-    LOGW("%s is not running", GetInstanceID().c_str());
+    LOGW("%s is not running", GetInstId().c_str());
     return;
   }
-  OnPause();
+  Component::OnPause();
   SetState(State::Paused);
-  int ret = aul_comp_status_update(GetInstanceID().c_str(), COMP_STATUS_PAUSED);
+  int ret = aul_comp_status_update(GetInstId().c_str(), COMP_STATUS_PAUSED);
   if (ret != 0) {
     LOGE("fail to send comp update status");
     return;
@@ -350,50 +345,13 @@ void WidgetComponent::OnBasePause() {
   }
 }
 
-void WidgetComponent::OnBaseStop() {
-  OnStop();
+void WidgetComponent::OnStop() {
+  Component::OnStop();
   tizen_base::Bundle content = GetContent();
-  OnBaseSaveContent(content);
+  OnSaveContent(content);
   SetContent(std::move(content));
 }
 
-void WidgetComponent::OnBaseRestoreContent(tizen_base::Bundle content) {
-}
-
-void WidgetComponent::OnBaseSaveContent(tizen_base::Bundle& content) {
-}
-
-// LCOV_EXCL_START
-void WidgetComponent::OnBaseDeviceOrientationChanged(
-    DeviceOrientation::Orientation orientation) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void WidgetComponent::OnBaseLanguageChanged(std::string language) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void WidgetComponent::OnBaseRegionFormatChanged(std::string region) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void WidgetComponent::OnBaseLowBattery(LowBattery::Status status) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void WidgetComponent::OnBaseLowMemory(LowMemory::Status status) {
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-void WidgetComponent::OnBaseSuspendedStateChanged(SuspendedState::State state) {
-}
-// LCOV_EXCL_STOP
-
 std::unique_ptr<IWindow> WidgetComponent::OnCreate(int width, int height) {
   return nullptr;
 }
@@ -401,15 +359,6 @@ std::unique_ptr<IWindow> WidgetComponent::OnCreate(int width, int height) {
 void WidgetComponent::OnStart(bool restarted) {
 }
 
-void WidgetComponent::OnResume() {
-}
-
-void WidgetComponent::OnPause() {
-}
-
-void WidgetComponent::OnStop() {
-}
-
 void WidgetComponent::OnDestroy(bool permanent) {
 }
 
index 55b3fb435201ced2912e3364d129948cbc1fcc15..6a982d1dfdb857523f29651b0452961f97035ec0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
@@ -30,77 +30,35 @@ namespace component_based {
 
 class EXPORT_API WidgetComponent : public Component {
  public:
-  class Factory : public Component::Factory {
-   public:
-    std::unique_ptr<Component> Create(std::string comp_id,
-                                      std::string inst_id,
-                                      tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<Component>(
-          new (std::nothrow) WidgetComponent(
-            std::move(comp_id), std::move(inst_id), start_data));
-    }
-  };
-
   enum class DisplayStatus {
     Unknown,
     On,
     Off,
   };
 
-  class WidgetType : public Type {
-   public:
-    enum {
-      Hash = 0x3333
-    };
-
-    int GetHash() const override {
-      return Hash;
-    }
-
-    std::string GetName() const override {
-      return "widget";
-    }
-  };
-
-  std::unique_ptr<Type> GetType() const override {
-    return std::unique_ptr<Type>(new WidgetType());
-  }
-
   WidgetComponent(std::string comp_id, std::string inst_id,
-      tizen_base::Bundle& start_data);
+      const tizen_base::Bundle& start_data,
+      tizen_cpp::AppCoreMultiWindowBase* app);
   virtual ~WidgetComponent();
 
   DisplayStatus GetDisplayStatus();
   const IWindow* GetWindow();
-
-  bool OnBaseCreate() override;
-  void OnBaseDestroy() override;
-  void OnBaseStart(AppControl control, bool restarted) override;
-  void OnBaseResume() override;
-  void OnBasePause() override;
-  void OnBaseStop() override;
-  void OnBaseRestoreContent(tizen_base::Bundle content) override;
-  void OnBaseSaveContent(tizen_base::Bundle& content) override;
-  void OnBaseDeviceOrientationChanged(
-      DeviceOrientation::Orientation orientation) override;
-  void OnBaseLanguageChanged(std::string language) override;
-  void OnBaseRegionFormatChanged(std::string region) override;
-  void OnBaseLowBattery(LowBattery::Status status) override;
-  void OnBaseLowMemory(LowMemory::Status status) override;
-  void OnBaseSuspendedStateChanged(SuspendedState::State state) override;
-
+  void OnResume() override;
+  void OnPause() override;
+  void OnStop() override;
   virtual std::unique_ptr<IWindow> OnCreate(int w, int h);
   virtual void OnStart(bool restarted);
-  virtual void OnResume();
-  virtual void OnPause();
-  virtual void OnStop();
   virtual void OnDestroy(bool permanent);
   virtual void OnUpdate(tizen_base::Bundle data, bool force);
   virtual void OnResize(int width, int height);
-
   int GetWidth();
   int GetHeight();
 
+ private:
+  void OnCreate() final;
+  void OnStart(AppControl control, bool restarted) final;
+  void OnDestroy() final;
+
  private:
   class Impl;
   std::unique_ptr<Impl> impl_;
index 96c1956b071e9c83a608ec4e852fa109c6f1bdca..50438b4d12515f8b71611977cfb116249ee760d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
@@ -61,6 +61,7 @@ class WidgetComponent::Impl {
   guint period_timer_;
   bool pending_update_;
   std::string pending_update_data_;
+  std::unique_ptr<IWindow> win_;
 };
 
 }  // namespace component_base
index ab2218e7df430fb546dcc02223e5ff12bed216fd..66962b73064d670bf284c237139ed796dd40b7a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index f99268b808324e01307910a854bc6501b797a165..f5dbf30c8de5dd7756a7201d1689cdf1a98e8ce9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 - 2021 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.
index 02984be3831f5e1dc6d87d1ba9853fcc1c4ce929..9ad45bc51316c27fa9f97f3124b43daea431c23d 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2019 - 2021 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mock/fff.h b/mock/fff.h
deleted file mode 100644 (file)
index f8d6d5f..0000000
+++ /dev/null
@@ -1,6493 +0,0 @@
-/*
-LICENSE
-
-The MIT License (MIT)
-
-Copyright (c) 2010 Michael Long
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-#ifndef FAKE_FUNCTIONS
-#define FAKE_FUNCTIONS
-
-#include <stdarg.h>
-#include <string.h> /* For memset and memcpy */
-
-#define FFF_MAX_ARGS (20u)
-#ifndef FFF_ARG_HISTORY_LEN
-    #define FFF_ARG_HISTORY_LEN (50u)
-#endif
-#ifndef FFF_CALL_HISTORY_LEN
-    #define FFF_CALL_HISTORY_LEN (50u)
-#endif
-/* -- INTERNAL HELPER MACROS -- */
-#define SET_RETURN_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
-    FUNCNAME##_fake.return_val_seq = ARRAY_POINTER; \
-    FUNCNAME##_fake.return_val_seq_len = ARRAY_LEN;
-#define SET_CUSTOM_FAKE_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
-    FUNCNAME##_fake.custom_fake_seq = ARRAY_POINTER; \
-    FUNCNAME##_fake.custom_fake_seq_len = ARRAY_LEN;
-
-/* Defining a function to reset a fake function */
-#define RESET_FAKE(FUNCNAME) { \
-    FUNCNAME##_reset(); \
-} \
-
-
-#define DECLARE_ARG(type, n, FUNCNAME) \
-    type arg##n##_val; \
-    type arg##n##_history[FFF_ARG_HISTORY_LEN];
-
-#define DECLARE_ALL_FUNC_COMMON \
-    unsigned int call_count; \
-    unsigned int arg_history_len; \
-    unsigned int arg_histories_dropped; \
-
-#define DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-    RETURN_TYPE return_val_history[FFF_ARG_HISTORY_LEN];
-
-#define SAVE_ARG(FUNCNAME, n) \
-    memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
-
-#define ROOM_FOR_MORE_HISTORY(FUNCNAME) \
-    FUNCNAME##_fake.call_count < FFF_ARG_HISTORY_LEN
-
-#define SAVE_RET_HISTORY(FUNCNAME, RETVAL) \
-    if ((FUNCNAME##_fake.call_count - 1) < FFF_ARG_HISTORY_LEN) \
-        memcpy((void *)&FUNCNAME##_fake.return_val_history[FUNCNAME##_fake.call_count - 1], (const void *) &RETVAL, sizeof(RETVAL)); \
-
-#define SAVE_ARG_HISTORY(FUNCNAME, ARGN) \
-    memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
-
-#define HISTORY_DROPPED(FUNCNAME) \
-    FUNCNAME##_fake.arg_histories_dropped++
-
-#define DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-    RETURN_TYPE return_val; \
-    int return_val_seq_len; \
-    int return_val_seq_idx; \
-    RETURN_TYPE * return_val_seq; \
-
-#define DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-    int custom_fake_seq_len; \
-    int custom_fake_seq_idx; \
-
-#define INCREMENT_CALL_COUNT(FUNCNAME) \
-    FUNCNAME##_fake.call_count++
-
-#define RETURN_FAKE_RESULT(FUNCNAME) \
-    if (FUNCNAME##_fake.return_val_seq_len){ /* then its a sequence */ \
-        if(FUNCNAME##_fake.return_val_seq_idx < FUNCNAME##_fake.return_val_seq_len) { \
-            SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx]) \
-            return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx++]; \
-        } \
-        SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]) \
-        return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]; /* return last element */ \
-    } \
-    SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val) \
-    return FUNCNAME##_fake.return_val; \
-
-#ifdef __cplusplus
-    #define FFF_EXTERN_C extern "C"{
-    #define FFF_END_EXTERN_C }
-#else  /* ansi c */
-    #define FFF_EXTERN_C
-    #define FFF_END_EXTERN_C
-#endif  /* cpp/ansi c */
-
-#define DEFINE_RESET_FUNCTION(FUNCNAME) \
-    void FUNCNAME##_reset(void){ \
-        memset(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake)); \
-        FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN; \
-    }
-/* -- END INTERNAL HELPER MACROS -- */
-
-typedef void (*fff_function_t)(void);
-typedef struct {
-    fff_function_t call_history[FFF_CALL_HISTORY_LEN];
-    unsigned int call_history_idx;
-} fff_globals_t;
-
-FFF_EXTERN_C
-extern fff_globals_t fff;
-FFF_END_EXTERN_C
-
-#define DEFINE_FFF_GLOBALS \
-    FFF_EXTERN_C \
-        fff_globals_t fff; \
-    FFF_END_EXTERN_C
-
-#define FFF_RESET_HISTORY() \
-    fff.call_history_idx = 0; \
-    memset(fff.call_history, 0, sizeof(fff.call_history));
-
-#define REGISTER_CALL(function) \
-    if(fff.call_history_idx < FFF_CALL_HISTORY_LEN) \
-        fff.call_history[fff.call_history_idx++] = (fff_function_t)function;
-
-#define DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(void); \
-        void(**custom_fake_seq)(void); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(void); \
-
-#define DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(void){ \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC0(FUNCNAME) \
-    DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
-    DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
-
-
-#define DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0); \
-
-#define DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
-    DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
-    DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
-
-#define DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
-
-#define DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
-
-#define DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
-
-#define DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
-
-#define DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
-
-#define DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
-
-#define DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
-
-#define DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
-
-#define DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
-
-#define DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
-
-#define DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
-
-#define DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
-
-#define DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
-
-#define DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
-
-#define DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
-
-#define DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
-
-#define DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
-
-#define DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        SAVE_ARG(FUNCNAME, 18); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-            SAVE_ARG_HISTORY(FUNCNAME, 18); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
-        DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
-
-#define DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        SAVE_ARG(FUNCNAME, 18); \
-        SAVE_ARG(FUNCNAME, 19); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-            SAVE_ARG_HISTORY(FUNCNAME, 18); \
-            SAVE_ARG_HISTORY(FUNCNAME, 19); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
-            } \
-            else{ \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(void); \
-        RETURN_TYPE(**custom_fake_seq)(void); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(void); \
-
-#define DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(void){ \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
-    DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
-    DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0); \
-
-#define DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
-
-#define DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
-
-#define DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
-
-#define DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
-
-#define DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
-
-#define DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
-
-#define DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
-
-#define DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
-
-#define DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
-
-#define DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
-
-#define DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
-
-#define DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
-
-#define DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
-
-#define DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
-
-#define DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
-
-#define DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
-
-#define DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
-
-#define DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
-
-#define DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        SAVE_ARG(FUNCNAME, 18); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-            SAVE_ARG_HISTORY(FUNCNAME, 18); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
-        DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
-
-#define DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        SAVE_ARG(FUNCNAME, 18); \
-        SAVE_ARG(FUNCNAME, 19); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-            SAVE_ARG_HISTORY(FUNCNAME, 18); \
-            SAVE_ARG_HISTORY(FUNCNAME, 19); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-            } \
-            else{ \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
-            } \
-        } \
-        if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-    DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
-
-
-#define DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg0); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg0); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg0); \
-            FUNCNAME##_fake.custom_fake(arg0, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg1); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg1); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg1); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg2); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg2); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg2); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg3); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg3); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg3); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg4); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg4); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg4); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg5); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg5); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg5); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg6); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg6); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg6); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg7); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg7); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg7); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg8); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg8); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg8); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg9); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg9); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg9); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg10); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg10); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg10); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg11); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg11); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg11); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg12); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg12); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg12); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg13); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg13); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg13); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg14); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg14); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg14); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg15); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg15); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg15); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg16); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg16); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg16); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg17); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg17); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg17); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
-        void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
-
-#define DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        SAVE_ARG(FUNCNAME, 18); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-            SAVE_ARG_HISTORY(FUNCNAME, 18); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg18); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
-                va_end(ap); \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg18); \
-                FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
-                va_end(ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            va_list ap; \
-            va_start(ap, arg18); \
-            FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
-            va_end(ap); \
-        } \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg0); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg0); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg0); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg1); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg1); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg1); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg2); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg2); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg2); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg3); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg3); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg3); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg4); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg4); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg4); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg5); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg5); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg5); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg6); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg6); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg6); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg7); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg7); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg7); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg8); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg8); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg8); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg9); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg9); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg9); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg10); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg10); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg10); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg11); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg11); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg11); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg12); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg12); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg12); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg13); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg13); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg13); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg14); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg14); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg14); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg15); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg15); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg15); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg16); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg16); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg16); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg17); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg17); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg17); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
-
-
-#define DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    typedef struct FUNCNAME##_Fake { \
-        DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
-        DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
-        DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
-        DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
-        DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
-        DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
-        DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
-        DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
-        DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
-        DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
-        DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
-        DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
-        DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
-        DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
-        DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
-        DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
-        DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
-        DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
-        DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
-        DECLARE_ALL_FUNC_COMMON \
-        DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
-        DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
-        DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
-        RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
-        RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
-    } FUNCNAME##_Fake; \
-    extern FUNCNAME##_Fake FUNCNAME##_fake; \
-    void FUNCNAME##_reset(void); \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
-
-#define DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    FUNCNAME##_Fake FUNCNAME##_fake; \
-    RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
-        SAVE_ARG(FUNCNAME, 0); \
-        SAVE_ARG(FUNCNAME, 1); \
-        SAVE_ARG(FUNCNAME, 2); \
-        SAVE_ARG(FUNCNAME, 3); \
-        SAVE_ARG(FUNCNAME, 4); \
-        SAVE_ARG(FUNCNAME, 5); \
-        SAVE_ARG(FUNCNAME, 6); \
-        SAVE_ARG(FUNCNAME, 7); \
-        SAVE_ARG(FUNCNAME, 8); \
-        SAVE_ARG(FUNCNAME, 9); \
-        SAVE_ARG(FUNCNAME, 10); \
-        SAVE_ARG(FUNCNAME, 11); \
-        SAVE_ARG(FUNCNAME, 12); \
-        SAVE_ARG(FUNCNAME, 13); \
-        SAVE_ARG(FUNCNAME, 14); \
-        SAVE_ARG(FUNCNAME, 15); \
-        SAVE_ARG(FUNCNAME, 16); \
-        SAVE_ARG(FUNCNAME, 17); \
-        SAVE_ARG(FUNCNAME, 18); \
-        if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
-            SAVE_ARG_HISTORY(FUNCNAME, 0); \
-            SAVE_ARG_HISTORY(FUNCNAME, 1); \
-            SAVE_ARG_HISTORY(FUNCNAME, 2); \
-            SAVE_ARG_HISTORY(FUNCNAME, 3); \
-            SAVE_ARG_HISTORY(FUNCNAME, 4); \
-            SAVE_ARG_HISTORY(FUNCNAME, 5); \
-            SAVE_ARG_HISTORY(FUNCNAME, 6); \
-            SAVE_ARG_HISTORY(FUNCNAME, 7); \
-            SAVE_ARG_HISTORY(FUNCNAME, 8); \
-            SAVE_ARG_HISTORY(FUNCNAME, 9); \
-            SAVE_ARG_HISTORY(FUNCNAME, 10); \
-            SAVE_ARG_HISTORY(FUNCNAME, 11); \
-            SAVE_ARG_HISTORY(FUNCNAME, 12); \
-            SAVE_ARG_HISTORY(FUNCNAME, 13); \
-            SAVE_ARG_HISTORY(FUNCNAME, 14); \
-            SAVE_ARG_HISTORY(FUNCNAME, 15); \
-            SAVE_ARG_HISTORY(FUNCNAME, 16); \
-            SAVE_ARG_HISTORY(FUNCNAME, 17); \
-            SAVE_ARG_HISTORY(FUNCNAME, 18); \
-        } \
-        else{ \
-            HISTORY_DROPPED(FUNCNAME); \
-        } \
-        INCREMENT_CALL_COUNT(FUNCNAME); \
-        REGISTER_CALL(FUNCNAME); \
-        if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
-            if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
-                va_list ap; \
-                va_start(ap, arg18); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-            } \
-            else{ \
-                va_list ap; \
-                va_start(ap, arg18); \
-                RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
-                SAVE_RET_HISTORY(FUNCNAME, ret); \
-                va_end(ap); \
-                return ret; \
-                return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
-            } \
-        } \
-        if(FUNCNAME##_fake.custom_fake){ \
-            RETURN_TYPE ret; \
-            va_list ap; \
-            va_start(ap, arg18); \
-            ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
-            va_end(ap); \
-            SAVE_RET_HISTORY(FUNCNAME, ret); \
-            return ret; \
-        } \
-        RETURN_FAKE_RESULT(FUNCNAME) \
-    } \
-    DEFINE_RESET_FUNCTION(FUNCNAME) \
-
-#define FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-    DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
-
-/* MSVC expand macro fix */
-#define EXPAND(x) x
-
-#define PP_NARG_MINUS2(...)   EXPAND(PP_NARG_MINUS2_(__VA_ARGS__, PP_RSEQ_N_MINUS2()))
-
-#define PP_NARG_MINUS2_(...)   EXPAND(PP_ARG_MINUS2_N(__VA_ARGS__))
-
-#define PP_ARG_MINUS2_N(returnVal,  _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...)   N
-
-#define PP_RSEQ_N_MINUS2()   20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
-
-#define PP_NARG_MINUS1(...)   EXPAND(PP_NARG_MINUS1_(__VA_ARGS__, PP_RSEQ_N_MINUS1()))
-
-#define PP_NARG_MINUS1_(...)   EXPAND(PP_ARG_MINUS1_N(__VA_ARGS__))
-
-#define PP_ARG_MINUS1_N( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...)   N
-
-#define PP_RSEQ_N_MINUS1()   20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
-
-
-
-/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
-
-#define FAKE_VALUE_FUNC(...)     EXPAND(FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
-
-#define FUNC_VALUE_(N,...)     EXPAND(FUNC_VALUE_N(N,__VA_ARGS__))
-
-#define FUNC_VALUE_N(N,...)     EXPAND(FAKE_VALUE_FUNC ## N(__VA_ARGS__))
-
-
-#define FAKE_VOID_FUNC(...)     EXPAND(FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
-
-#define FUNC_VOID_(N,...)     EXPAND(FUNC_VOID_N(N,__VA_ARGS__))
-
-#define FUNC_VOID_N(N,...)     EXPAND(FAKE_VOID_FUNC ## N(__VA_ARGS__))
-
-
-#define FAKE_VALUE_FUNC_VARARG(...)     EXPAND(FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
-
-#define FUNC_VALUE_VARARG_(N,...)     EXPAND(FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
-
-#define FUNC_VALUE_VARARG_N(N,...)     EXPAND(FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
-
-
-#define FAKE_VOID_FUNC_VARARG(...)     EXPAND(FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
-
-#define FUNC_VOID_VARARG_(N,...)     EXPAND(FUNC_VOID_VARARG_N(N,__VA_ARGS__))
-
-#define FUNC_VOID_VARARG_N(N,...)     EXPAND(FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
-
-
-
-/* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
-
-#define DECLARE_FAKE_VALUE_FUNC(...)     EXPAND(DECLARE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
-
-#define DECLARE_FUNC_VALUE_(N,...)     EXPAND(DECLARE_FUNC_VALUE_N(N,__VA_ARGS__))
-
-#define DECLARE_FUNC_VALUE_N(N,...)     EXPAND(DECLARE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
-
-
-#define DECLARE_FAKE_VOID_FUNC(...)     EXPAND(DECLARE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
-
-#define DECLARE_FUNC_VOID_(N,...)     EXPAND(DECLARE_FUNC_VOID_N(N,__VA_ARGS__))
-
-#define DECLARE_FUNC_VOID_N(N,...)     EXPAND(DECLARE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
-
-
-#define DECLARE_FAKE_VALUE_FUNC_VARARG(...)     EXPAND(DECLARE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
-
-#define DECLARE_FUNC_VALUE_VARARG_(N,...)     EXPAND(DECLARE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
-
-#define DECLARE_FUNC_VALUE_VARARG_N(N,...)     EXPAND(DECLARE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
-
-
-#define DECLARE_FAKE_VOID_FUNC_VARARG(...)     EXPAND(DECLARE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
-
-#define DECLARE_FUNC_VOID_VARARG_(N,...)     EXPAND(DECLARE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
-
-#define DECLARE_FUNC_VOID_VARARG_N(N,...)     EXPAND(DECLARE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
-
-
-
-/* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
-
-#define DEFINE_FAKE_VALUE_FUNC(...)     EXPAND(DEFINE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
-
-#define DEFINE_FUNC_VALUE_(N,...)     EXPAND(DEFINE_FUNC_VALUE_N(N,__VA_ARGS__))
-
-#define DEFINE_FUNC_VALUE_N(N,...)     EXPAND(DEFINE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
-
-
-#define DEFINE_FAKE_VOID_FUNC(...)     EXPAND(DEFINE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
-
-#define DEFINE_FUNC_VOID_(N,...)     EXPAND(DEFINE_FUNC_VOID_N(N,__VA_ARGS__))
-
-#define DEFINE_FUNC_VOID_N(N,...)     EXPAND(DEFINE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
-
-
-#define DEFINE_FAKE_VALUE_FUNC_VARARG(...)     EXPAND(DEFINE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
-
-#define DEFINE_FUNC_VALUE_VARARG_(N,...)     EXPAND(DEFINE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
-
-#define DEFINE_FUNC_VALUE_VARARG_N(N,...)     EXPAND(DEFINE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
-
-
-#define DEFINE_FAKE_VOID_FUNC_VARARG(...)     EXPAND(DEFINE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
-
-#define DEFINE_FUNC_VOID_VARARG_(N,...)     EXPAND(DEFINE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
-
-#define DEFINE_FUNC_VOID_VARARG_N(N,...)     EXPAND(DEFINE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
-
-
-
-
-#endif /* FAKE_FUNCTIONS */
diff --git a/mock/mock.cc b/mock/mock.cc
deleted file mode 100644 (file)
index 96f21bc..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include "mock.h"
-
-#include "mock_app_common.h"
-#include "mock_app_control.h"
-#include "mock_appcore_multiwindow_base.h"
-#include "mock_aul.h"
-#include "mock_elementary.h"
-
-DEFINE_FFF_GLOBALS;
-
-/* app_contro.h */
-DEFINE_FAKE_VALUE_FUNC(int, app_control_send_launch_request_async,
-                       app_control_h, app_control_result_cb,
-                       app_control_reply_cb, void*);
-
-DEFINE_FAKE_VALUE_FUNC(int, app_control_send_launch_request_sync,
-                       app_control_h, app_control_h*, app_control_result_e*);
-
-DEFINE_FAKE_VALUE_FUNC(int, app_control_add_action_handler, const char*,
-                       app_control_action_cb, void*, app_control_action_h*);
-
-/* app_common.h */
-DEFINE_FAKE_VALUE_FUNC(int, app_get_id, char**);
-
-DEFINE_FAKE_VALUE_FUNC(char*, app_get_data_path);
-
-DEFINE_FAKE_VALUE_FUNC(int, app_get_display_state, app_display_state_e*);
-
-DEFINE_FAKE_VALUE_FUNC(int, app_resource_manager_get, app_resource_e,
-                       const char*, char**);
-
-/* Elementary.h */
-DEFINE_FAKE_VALUE_FUNC(int, elm_init, int, char**);
-
-DEFINE_FAKE_VALUE_FUNC(int, elm_shutdown);
-
-DEFINE_FAKE_VOID_FUNC(elm_run);
-
-DEFINE_FAKE_VOID_FUNC(elm_exit);
-
-DEFINE_FAKE_VALUE_FUNC(Evas_Object*, elm_win_util_standard_add, const char*,
-                       const char*);
-
-DEFINE_FAKE_VALUE_FUNC(Evas*, evas_object_evas_get, const Eo*);
-
-DEFINE_FAKE_VALUE_FUNC(Ecore_Evas*, ecore_evas_ecore_evas_get, const Evas*);
-
-DEFINE_FAKE_VALUE_FUNC(Ecore_Wl2_Window*, ecore_evas_wayland2_window_get,
-                       const Ecore_Evas*);
-
-DEFINE_FAKE_VALUE_FUNC(int, ecore_wl2_window_id_get, Ecore_Wl2_Window*);
-
-DEFINE_FAKE_VOID_FUNC(evas_object_del, Evas_Object*);
-
-DEFINE_FAKE_VOID_FUNC(elm_config_accel_preference_set, const char*);
-
-DEFINE_FAKE_VOID_FUNC(ecore_wl2_window_activate, Ecore_Wl2_Window*);
-
-DEFINE_FAKE_VOID_FUNC(ecore_wl2_window_iconified_set, Ecore_Wl2_Window*,
-                      Eina_Bool);
-
-DEFINE_FAKE_VALUE_FUNC(Ecore_Wl2_Window*, ecore_wl2_display_window_find,
-                       Ecore_Wl2_Display*, unsigned int);
-
-/* appcore_multiwindow_base.h */
-DEFINE_FAKE_VALUE_FUNC(int, appcore_multiwindow_base_init,
-                       appcore_multiwindow_base_ops, int, char**, void*);
-
-DEFINE_FAKE_VALUE_FUNC(appcore_multiwindow_base_instance_h,
-                       appcore_multiwindow_base_instance_run,
-                       const char*, const char*, void*);
-
-DEFINE_FAKE_VALUE_FUNC(appcore_multiwindow_base_instance_h,
-                        appcore_multiwindow_base_instance_find, const char*);
-
-DEFINE_FAKE_VALUE_FUNC(bool, appcore_multiwindow_base_instance_is_resumed,
-                       appcore_multiwindow_base_instance_h);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_instance_exit,
-                      appcore_multiwindow_base_instance_h);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_window_unbind,
-                      appcore_multiwindow_base_instance_h);
-
-DEFINE_FAKE_VALUE_FUNC(appcore_multiwindow_base_ops,
-                       appcore_multiwindow_base_get_default_ops);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_fini);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_exit);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_class_add,
-                      appcore_multiwindow_base_class);
-
-DEFINE_FAKE_VALUE_FUNC(const char*, appcore_multiwindow_base_instance_get_id,
-                       appcore_multiwindow_base_instance_h);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_instance_resume,
-                      appcore_multiwindow_base_instance_h);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_instance_pause,
-                      appcore_multiwindow_base_instance_h);
-
-DEFINE_FAKE_VOID_FUNC(appcore_multiwindow_base_window_on_visibility,
-                      int, void*);
-
-DEFINE_FAKE_VALUE_FUNC(appcore_base_event_h, appcore_base_add_event,
-                       enum appcore_base_event, appcore_base_event_cb, void *);
-
-/* aul.h */
-DEFINE_FAKE_VALUE_FUNC(int, aul_app_group_set_window_v2, const char*, int);
-
-DEFINE_FAKE_VALUE_FUNC(int, aul_app_group_lower_v2, const char*, bool*);
-
-DEFINE_FAKE_VALUE_FUNC(int, aul_comp_notify_start, const char*);
-
-DEFINE_FAKE_VALUE_FUNC(int, aul_comp_status_update, const char*, int);
diff --git a/mock/mock.h b/mock/mock.h
deleted file mode 100644 (file)
index d737f38..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2019 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 UNIT_TESTS_MOCK_MOCK_H__
-#define UNIT_TESTS_MOCK_MOCK_H__
-
-#include "fff.h"
-
-#endif // UNIT_TESTS_MOCK_MOCK_H__
diff --git a/mock/mock_app_common.h b/mock/mock_app_common.h
deleted file mode 100644 (file)
index ccf80ef..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2019 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 UNIT_TESTS_MOCK_MOCK_APP_COMMON_H_
-#define UNIT_TESTS_MOCK_MOCK_APP_COMMON_H_
-
-#include <app_common.h>
-#include <app_resource_manager.h>
-
-#include "mock.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DECLARE_FAKE_VALUE_FUNC(int, app_get_id, char**);
-
-DECLARE_FAKE_VALUE_FUNC(char*, app_get_data_path);
-
-DECLARE_FAKE_VALUE_FUNC(int, app_get_display_state, app_display_state_e*);
-
-DECLARE_FAKE_VALUE_FUNC(int, app_resource_manager_get, app_resource_e,
-                        const char*, char**);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* UNIT_TESTS_MOCK_MOCK_APP_COMMON_H_ */
diff --git a/mock/mock_app_control.h b/mock/mock_app_control.h
deleted file mode 100644 (file)
index 94e9aa6..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2019 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 UNIT_TESTS_MOCK_MOCK_APP_CONTROL_H_
-#define UNIT_TESTS_MOCK_MOCK_APP_CONTROL_H_
-
-#include <app_control.h>
-
-#include "mock.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DECLARE_FAKE_VALUE_FUNC(int, app_control_send_launch_request_async,
-                        app_control_h, app_control_result_cb,
-                        app_control_reply_cb, void*);
-
-DECLARE_FAKE_VALUE_FUNC(int, app_control_send_launch_request_sync,
-                        app_control_h, app_control_h*, app_control_result_e*);
-
-DECLARE_FAKE_VALUE_FUNC(int, app_control_add_action_handler, const char*,
-                        app_control_action_cb, void*, app_control_action_h*);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* UNIT_TESTS_MOCK_MOCK_APP_CONTROL_H_ */
diff --git a/mock/mock_appcore_multiwindow_base.h b/mock/mock_appcore_multiwindow_base.h
deleted file mode 100644 (file)
index a226df5..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2019 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 UNIT_TESTS_MOCK_MOCK_APPCORE_MULTIWINDOW_BASE_H_
-#define UNIT_TESTS_MOCK_MOCK_APPCORE_MULTIWINDOW_BASE_H_
-
-#include <appcore_multiwindow_base.h>
-
-#include "mock.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DECLARE_FAKE_VALUE_FUNC(int, appcore_multiwindow_base_init,
-                        appcore_multiwindow_base_ops, int, char**, void*);
-
-DECLARE_FAKE_VALUE_FUNC(appcore_multiwindow_base_instance_h,
-                        appcore_multiwindow_base_instance_run, const char*,
-                        const char*, void*);
-
-DECLARE_FAKE_VALUE_FUNC(appcore_multiwindow_base_instance_h,
-                        appcore_multiwindow_base_instance_find, const char*);
-
-DECLARE_FAKE_VALUE_FUNC(bool, appcore_multiwindow_base_instance_is_resumed,
-                        appcore_multiwindow_base_instance_h);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_instance_exit,
-                       appcore_multiwindow_base_instance_h);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_window_unbind,
-                       appcore_multiwindow_base_instance_h);
-
-DECLARE_FAKE_VALUE_FUNC(appcore_multiwindow_base_ops,
-                        appcore_multiwindow_base_get_default_ops);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_fini);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_exit);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_class_add,
-                       appcore_multiwindow_base_class);
-
-DECLARE_FAKE_VALUE_FUNC(const char*, appcore_multiwindow_base_instance_get_id,
-                        appcore_multiwindow_base_instance_h);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_instance_resume,
-                       appcore_multiwindow_base_instance_h);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_instance_pause,
-                       appcore_multiwindow_base_instance_h);
-
-DECLARE_FAKE_VOID_FUNC(appcore_multiwindow_base_window_on_visibility,
-                       int, void *)
-
-DECLARE_FAKE_VALUE_FUNC(appcore_base_event_h, appcore_base_add_event,
-                        enum appcore_base_event, appcore_base_event_cb, void *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* UNIT_TESTS_MOCK_MOCK_APPCORE_MULTIWINDOW_BASE_H_ */
diff --git a/mock/mock_aul.h b/mock/mock_aul.h
deleted file mode 100644 (file)
index 099c090..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2019 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 UNIT_TESTS_MOCK_MOCK_AUL_H_
-#define UNIT_TESTS_MOCK_MOCK_AUL_H_
-
-#include <aul.h>
-
-#include "mock.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DECLARE_FAKE_VALUE_FUNC(int, aul_app_group_set_window_v2, const char*, int);
-
-DECLARE_FAKE_VALUE_FUNC(int, aul_app_group_lower_v2, const char*, bool*);
-
-DECLARE_FAKE_VALUE_FUNC(int, aul_comp_notify_start, const char*);
-
-DECLARE_FAKE_VALUE_FUNC(int, aul_comp_status_update, const char*, int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* UNIT_TESTS_MOCK_MOCK_AUL_H_ */
diff --git a/mock/mock_elementary.h b/mock/mock_elementary.h
deleted file mode 100644 (file)
index 67a6714..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2019 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 UNIT_TESTS_MOCK_MOCK_ELEMENTARY_H_
-#define UNIT_TESTS_MOCK_MOCK_ELEMENTARY_H_
-
-#include <Elementary.h>
-#include <Ecore_Wl2.h>
-
-#include "mock.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DECLARE_FAKE_VALUE_FUNC(int, elm_init, int, char**);
-
-DECLARE_FAKE_VALUE_FUNC(int, elm_shutdown);
-
-DECLARE_FAKE_VOID_FUNC(elm_run);
-
-DECLARE_FAKE_VOID_FUNC(elm_exit);
-
-DECLARE_FAKE_VALUE_FUNC(Evas_Object*, elm_win_util_standard_add, const char*,
-                        const char*);
-
-DECLARE_FAKE_VALUE_FUNC(Evas*, evas_object_evas_get, const Eo*);
-
-DECLARE_FAKE_VALUE_FUNC(Ecore_Evas*, ecore_evas_ecore_evas_get, const Evas*);
-
-DECLARE_FAKE_VALUE_FUNC(Ecore_Wl2_Window*, ecore_evas_wayland2_window_get,
-                        const Ecore_Evas*);
-
-DECLARE_FAKE_VALUE_FUNC(int, ecore_wl2_window_id_get, Ecore_Wl2_Window*);
-
-DECLARE_FAKE_VOID_FUNC(evas_object_del, Evas_Object*);
-
-DECLARE_FAKE_VOID_FUNC(elm_config_accel_preference_set, const char*);
-
-DECLARE_FAKE_VOID_FUNC(ecore_wl2_window_activate, Ecore_Wl2_Window*);
-
-DECLARE_FAKE_VOID_FUNC(ecore_wl2_window_iconified_set, Ecore_Wl2_Window*,
-                       Eina_Bool);
-
-DECLARE_FAKE_VALUE_FUNC(Ecore_Wl2_Window*, ecore_wl2_display_window_find,
-                        Ecore_Wl2_Display*, unsigned int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* UNIT_TESTS_MOCK_MOCK_ELEMENTARY_H_ */
index 75f58c2b4f72a1a9d6274630e881a4abb71d6f01..a910d57fafd21ccd8277f64e6f7279eb0d8eee30 100644 (file)
@@ -20,7 +20,7 @@ BuildRequires: pkgconfig(bundle)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(gmock)
 BuildRequires: pkgconfig(ecore-wl2)
-BuildRequires: pkgconfig(appcore-multiwindow)
+BuildRequires: pkgconfig(app-core-multi-window-cpp)
 BuildRequires: pkgconfig(capi-appfw-app-control)
 BuildRequires: pkgconfig(aul)
 BuildRequires: pkgconfig(elementary)
@@ -182,7 +182,14 @@ find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
 %endif
 
 %check
-ctest --output-on-failure %{?_smp_mflags}
+export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/app_control" >& /dev/null
+export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/base" >& /dev/null
+export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/efl_base" >& /dev/null
+export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/efl_widget_base" >& /dev/null
+export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/port" >& /dev/null
+export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/uri" >& /dev/null
+export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/widget_base" >& /dev/null
+ctest -V
 %if 0%{?gcov:1}
 lcov -c --ignore-errors graph --no-external -q -d . -o component-based.info
 genhtml component-based.info -o component-based.out
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c90fac8
--- /dev/null
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY(unit_tests)
diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..febd8fe
--- /dev/null
@@ -0,0 +1,45 @@
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} UNIT_TEST_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/base BASE_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/efl_base EFL_BASE_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/mock MOCK_SRCS)
+
+ADD_EXECUTABLE(${TARGET_COMPONENT_BASED_UNITTESTS}
+  ${UNIT_TEST_SRCS}
+  ${BASE_SRCS}
+  ${EFL_BASE_SRCS}
+  ${MOCK_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_COMPONENT_BASED_UNITTESTS} PUBLIC
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../component_based
+  ${CMAKE_CURRENT_SOURCE_DIR}/../component_based/app_control
+  ${CMAKE_CURRENT_SOURCE_DIR}/../component_based/base
+  ${CMAKE_CURRENT_SOURCE_DIR}/../component_based/base/api
+  ${CMAKE_CURRENT_SOURCE_DIR}/../component_based/efl_base
+  ${CMAKE_CURRENT_SOURCE_DIR}/../component_based/efl_base/api
+  ${CMAKE_CURRENT_SOURCE_DIR}/../component_based/uri)
+
+APPLY_PKG_CONFIG(${TARGET_COMPONENT_BASED_UNITTESTS} PUBLIC
+  APP_CORE_MULTI_WINDOW_NEXT_DEPS
+  AUL_DEPS
+  CAPI_APPFW_APP_COMMON_DEPS
+  CAPI_APPFW_APP_CONTROL_DEPS
+  DLOG_DEPS
+  ECORE_WL2_DEPS
+  ELEMENTARY_DEPS
+  GLIB_DEPS
+  GMOCK_DEPS
+  SCREEN_CONNECTOR_PROVIDER_DEPS
+  WIDGET_SERVICE_DEPS
+)
+
+TARGET_LINK_LIBRARIES(${TARGET_COMPONENT_BASED_UNITTESTS} PUBLIC
+  ${TARGET_COMPONENT_BASED_APPLICATION}
+  ${TARGET_COMPONENT_BASED_APP_CONTROL}
+  ${TARGET_COMPONENT_BASED_CORE_BASE}
+  ${TARGET_COMPONENT_BASED_CORE_WIDGET_BASE}
+  ${TARGET_COMPONENT_BASED_EFL_WIDGET}
+  ${TARGET_COMPONENT_BASED_URI})
+
+INSTALL(TARGETS ${TARGET_COMPONENT_BASED_UNITTESTS} DESTINATION bin)
diff --git a/test/unit_tests/base/test_component_based_application_base.cc b/test/unit_tests/base/test_component_based_application_base.cc
new file mode 100644 (file)
index 0000000..548caa8
--- /dev/null
@@ -0,0 +1,874 @@
+// Copyright (c) 2019 - 2021 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include <glib.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <stdlib.h>
+
+#include "component_based/base/api/base_component.h"
+#include "component_based/base/api/base_frame_component.h"
+#include "component_based/base/api/base_service_component.h"
+#include "component_based/base/api/component_based_app_base.h"
+
+#include "mock/app_common_mock.h"
+#include "mock/app_control_event_mock.h"
+#include "mock/app_control_mock.h"
+#include "mock/appcore_multiwindow_base_mock.h"
+#include "mock/base_component_callback_mock.h"
+#include "mock/base_frame_component_callback_mock.h"
+#include "mock/base_service_component_callback_mock.h"
+#include "mock/component_based_app_base_callback_mock.h"
+#include "mock/dummy_args.h"
+#include "mock/elm_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::Return;
+using ::testing::SetArgPointee;
+using ::testing::Invoke;
+using ::testing::SaveArg;
+
+using namespace component_based;
+using namespace tizen_cpp;
+
+namespace {
+constexpr const char FRAME_COMP_NAME[] = "base-frame-comp";
+constexpr const char FRAME_INST_NAME[] = "@frame1";
+constexpr const char SERVICE_COMP_NAME[] = "base-service-comp";
+constexpr const char SERVICE_INST_NAME[] = "@service1";
+
+class Mocks : virtual public ::testing::NiceMock<ElmMock>,
+    virtual public ::testing::NiceMock<AppCommonMock>,
+    virtual public ::testing::NiceMock<AppControlMock>,
+    virtual public ::testing::NiceMock<ComponentBasedAppBaseCallbackMock>,
+    virtual public ::testing::NiceMock<BaseFrameComponentCallbackMock>,
+    virtual public ::testing::NiceMock<BaseServiceComponentCallbackMock>,
+    virtual public ::testing::NiceMock<BaseComponentCallbackMock>,
+    virtual public ::testing::NiceMock<AppCoreMultiWindowBaseMock> {};
+
+ACTION(ReturnFakeWindow) {
+  frame_window_h frame_win = nullptr;
+  static int dummy = 9216;
+  int ret = base_frame_create_window(&frame_win, 1, &dummy);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  int id = 0;
+  ret = base_frame_window_get_id(frame_win, &id);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(id, 1);
+  int* raw = nullptr;
+  ret = base_frame_window_get_raw(frame_win, reinterpret_cast<void**>(&raw));
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(*raw, 9216);
+
+  return frame_win;
+}
+
+ACTION_P2(DoResume, mock, id) {
+  mock->GetContext(id)->AppCoreMultiWindowBase::Context::Resume();
+}
+
+ACTION_P2(DoPause, mock, id) {
+  mock->GetContext(id)->AppCoreMultiWindowBase::Context::Pause();
+}
+
+ACTION_P3(DoStart, mock, comp_id, id) {
+  tizen_base::Bundle b;
+  b.Add(AUL_K_COMPONENT_ID, comp_id);
+  b.Add(AUL_K_INSTANCE_ID, id);
+  mock->real_->OnReceive(AUL_START, std::move(b));
+}
+
+ACTION_P(BeforeLoop, mock) {
+  mock->real_->OnLoopInit(arg0, arg1);
+  mock->real_->OnCreate();
+}
+
+ACTION_P(DoLoop, mock) {
+  mock->real_->OnLoopRun();
+}
+
+ACTION_P(AfterLoop, mock) {
+  mock->real_->Dispose();
+}
+
+ACTION_P(DoExit, timeout) {
+  g_timeout_add(timeout, [](gpointer data) -> gboolean {
+      component_based_app_base_exit();
+      return G_SOURCE_REMOVE;
+  }, nullptr);
+}
+
+ACTION_P(AddFrameBaseComponent, mock) {
+  auto cb = mock->GetCallbacks();
+  component_class_h component_class =
+      component_based_app_base_add_frame_component(nullptr,
+          FRAME_COMP_NAME, &cb, arg0);
+  return component_class;
+}
+
+ACTION_P(AddServiceBaseComponent, mock) {
+  auto cb = mock->GetCallbacks();
+  component_class_h component_class =
+      component_based_app_base_add_service_component(nullptr,
+          SERVICE_COMP_NAME, &cb, arg0);
+  return component_class;
+}
+
+ACTION_P(AddBaseComponent, mock) {
+  auto cb = mock->GetCallbacks();
+  component_class_h component_class =
+      component_based_app_base_add_base_component(nullptr,
+          COMPONENT_TYPE_SERVICE, SERVICE_COMP_NAME, &cb, arg0);
+  return component_class;
+}
+
+ACTION_P2(SendAction, mock, id) {
+  auto* app = mock->real_;
+  auto cxt = app->FindById(id);
+  auto* com = dynamic_cast<Component*>(cxt.get());
+  ASSERT_NE(com, nullptr);
+  app_control_h ctrl;
+  app_control_create(&ctrl);
+  tizen_base::Bundle b;
+  com->OnAction("test_action", AppControl(ctrl));
+}
+
+ACTION_P2(SendEvents, mock, id) {
+  auto* app = mock->real_;
+  auto cxt = app->FindById(id);
+  auto* com = dynamic_cast<Component*>(cxt.get());
+  ASSERT_NE(com, nullptr);
+  tizen_base::Bundle b;
+
+  com->OnRestoreContent(b);
+  com->OnSaveContent(b);
+  com->OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation::Orientation_90);
+  com->OnLanguageChanged("en");
+  com->OnRegionFormatChanged("kor");
+  com->OnLowBattery(LowBattery::Status::CriticalLow);
+  com->OnLowMemory(LowMemory::Status::SoftWarning);
+  com->OnSuspendedStateChanged(SuspendedState::State::Will_Enter);
+}
+
+ACTION_P(RegisterAction, id) {
+  int ret = component_register_action(arg0, id);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+ACTION_P(DeregisterAction, id) {
+  int ret = component_deregister_action(arg0, id);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+}  // namespace
+
+class ComponentBasedAppBaseTest : public TestFixture {
+ public:
+  ComponentBasedAppBaseTest() : TestFixture(std::make_unique<::Mocks>()) {}
+
+  void SetUp() override {}
+  void TearDown() override {}
+};
+
+TEST_F(ComponentBasedAppBaseTest, component_based_app_base_main_service) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(), &callback,
+      this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_based_app_base_main_service2) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(Return(nullptr));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(), &callback,
+      this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_based_app_base_main_frame) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameBaseComponent(&GetMock<BaseFrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(), &callback,
+      this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, base_service_component_callbacks) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(DoAll(
+          SendAction(&GetMock<AppCoreMultiWindowBaseMock>(), SERVICE_INST_NAME),
+          SendEvents(&GetMock<AppCoreMultiWindowBaseMock>(), SERVICE_INST_NAME)
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, base_service_component_callbacks2) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _))
+      .Times(1)
+      .WillOnce(Return(false));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .Times(0);
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, base_frame_component_callbacks) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameBaseComponent(&GetMock<BaseFrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_create_cb(_, _))
+      .Times(1)
+      .WillOnce(ReturnFakeWindow());
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_start_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(DoAll(
+          SendAction(&GetMock<AppCoreMultiWindowBaseMock>(), FRAME_INST_NAME),
+          SendEvents(&GetMock<AppCoreMultiWindowBaseMock>(), FRAME_INST_NAME)
+      ));
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_resume_cb(_, _)).Times(0);
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_pause_cb(_, _)).Times(0);
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_stop_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, base_component_callbacks) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddBaseComponent(&GetMock<BaseComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          SendEvents(&GetMock<AppCoreMultiWindowBaseMock>(), SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_restore_content_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_save_content_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_device_orientation_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_language_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_region_format_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_low_battery_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_low_memory_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseComponentCallbackMock>(),
+      base_component_suspended_state_changed_cb(_, _, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, base_frame_component_resume_pause) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameBaseComponent(&GetMock<BaseFrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_create_cb(_, _))
+      .Times(1)
+      .WillOnce(ReturnFakeWindow());
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_start_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoResume(&GetMock<AppCoreMultiWindowBaseMock>(), FRAME_INST_NAME),
+          DoPause(&GetMock<AppCoreMultiWindowBaseMock>(), FRAME_INST_NAME),
+          DoResume(&GetMock<AppCoreMultiWindowBaseMock>(), FRAME_INST_NAME)
+      ));
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_resume_cb(_, _)).Times(2);
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_pause_cb(_, _)).Times(2);
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_stop_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_finish) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(2000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(Invoke([](component_h context, app_control_h app_control,
+          bool restarted, void* user_data) {
+        component_finish(context);
+      }));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_send_launch_request_sync) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _)).Times(1);
+  int launch_ret;
+  app_control_result_e result;
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+            bool restarted, void* user_data) {
+          app_control_h reply = nullptr;
+          app_control_h ctrl;
+          app_control_create(&ctrl);
+          app_control_set_app_id(ctrl, "tizen.test.org");
+          launch_ret = component_send_launch_request_sync(context, ctrl,
+              &reply, &result);
+          if (ctrl)
+            app_control_destroy(ctrl);
+          if (reply)
+            app_control_destroy(reply);
+      }));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(launch_ret, APP_ERROR_NONE);
+  EXPECT_EQ(result, APP_CONTROL_RESULT_SUCCEEDED);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_send_launch_request_sync2) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _)).Times(1);
+  int launch_ret;
+  app_control_result_e result;
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+            bool restarted, void* user_data) {
+          app_control_h reply = nullptr;
+          app_control_h ctrl;
+          app_control_create(&ctrl);
+          app_control_set_app_id(ctrl, "tizen.test.org");
+          launch_ret = component_send_launch_request_sync(context, ctrl,
+              &reply, &result);
+          if (ctrl)
+            app_control_destroy(ctrl);
+          if (reply)
+            app_control_destroy(reply);
+      }));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<AppControlMock>(),
+      app_control_send_launch_request_sync(_, _, _))
+      .WillOnce(Return(APP_CONTROL_ERROR_IO_ERROR));
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_NE(launch_ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_send_launch_request_async) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _)).Times(1);
+  int launch_ret;
+  app_control_result_cb result_cb = [](app_control_h request,
+      app_control_error_e result, void* user_data) {
+  };
+  app_control_reply_cb reply_cb = [](app_control_h request,
+      app_control_h reply, app_control_result_e result, void* user_data) {
+  };
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+            bool restarted, void* user_data) {
+          app_control_h ctrl;
+          app_control_create(&ctrl);
+          app_control_set_app_id(ctrl, "tizen.test.org");
+          launch_ret = component_send_launch_request_async(context, ctrl,
+              result_cb, reply_cb, nullptr);
+          if (ctrl)
+            app_control_destroy(ctrl);
+      }));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(launch_ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_get_id) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _)).Times(1);
+
+  char* comp_id = nullptr;
+  char* inst_id = nullptr;
+  int ret1;
+  int ret2;
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+            bool restarted, void* user_data) {
+          ret1 = component_get_id(context, &comp_id);
+          ret2 = component_get_instance_id(context, &inst_id);
+      }));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(ret1, APP_ERROR_NONE);
+  EXPECT_EQ(ret2, APP_ERROR_NONE);
+  EXPECT_STREQ(comp_id, SERVICE_COMP_NAME);
+  EXPECT_STREQ(inst_id, SERVICE_INST_NAME);
+  free(comp_id);
+  free(inst_id);
+}
+
+TEST_F(ComponentBasedAppBaseTest, base_frame_component_get_display_status) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameBaseComponent(&GetMock<BaseFrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_create_cb(_, _))
+      .Times(1)
+      .WillOnce(ReturnFakeWindow());
+  int r = -1;
+  component_display_status_e disp_status = COMPONENT_DISPLAY_STATUS_OFF;
+  EXPECT_CALL(GetMock<BaseFrameComponentCallbackMock>(),
+      base_frame_component_start_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+          bool restarted, void* user_data) {
+          r = base_frame_get_display_status(context, &disp_status);
+      }));
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(r, APP_ERROR_NONE);
+  EXPECT_EQ(disp_status, COMPONENT_DISPLAY_STATUS_ON);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_register_action) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_create_cb(_, _))
+      .Times(1)
+      .WillOnce(DoAll(
+          RegisterAction("test_action"), Return(true)));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _)).Times(1);
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_destroy_cb(_, _))
+      .Times(1)
+      .WillOnce(DeregisterAction("test_action"));
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_action_cb(_, _, _, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_send) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  std::string appid;
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+          bool restarted, void* user_data) {
+          AppControl ctrl = AppControl::Builder()
+              .SetAppID("org.tizen.test")
+              .Build();
+          auto c = GetMock<AppCoreMultiWindowBaseMock>().real_->FindById(
+              SERVICE_INST_NAME);
+          auto* com = dynamic_cast<Component*>(c.get());
+          if (com) {
+            AppControl result = com->Send(ctrl);
+            appid = result.GetAppID();
+          }
+      }));
+  EXPECT_CALL(GetMock<AppControlMock>(),
+      app_control_send_launch_request_sync(_, _, _))
+      .WillOnce(Invoke([&](app_control_h app_control,
+          app_control_h* reply, app_control_result_e* result) -> int {
+        *result = APP_CONTROL_RESULT_SUCCEEDED;
+        AppControl ctrl = AppControl::Builder()
+              .SetAppID("org.tizen.test.reply")
+              .Build();
+        *reply = ctrl.Detach();
+        return 0;
+      }));
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(appid, "org.tizen.test.reply");
+}
+
+TEST_F(ComponentBasedAppBaseTest, component_sendasync) {
+  EXPECT_CALL(GetMock<ComponentBasedAppBaseCallbackMock>(),
+      component_based_app_base_create_cb(_))
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceBaseComponent(&GetMock<BaseServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+
+  testing::NiceMock<AppControlEventMock> mock;
+  EXPECT_CALL(GetMock<BaseServiceComponentCallbackMock>(),
+      base_service_component_start_command_cb(_, _, _, _))
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+          bool restarted, void* user_data) {
+          AppControl ctrl = AppControl::Builder()
+              .SetAppID("org.tizen.test")
+              .Build();
+          auto c = GetMock<AppCoreMultiWindowBaseMock>().real_->FindById(
+              SERVICE_INST_NAME);
+          auto* com = dynamic_cast<Component*>(c.get());
+          if (com) {
+            com->SendAsync(ctrl, &mock);
+          }
+      }));
+  EXPECT_CALL(GetMock<AppControlMock>(),
+      app_control_send_launch_request_async(_, _, _, _))
+      .WillOnce(Invoke([&](app_control_h app_control,
+            app_control_result_cb result_cb, app_control_reply_cb reply_cb,
+          void* user_data) -> int  {
+          AppControl ctrl = AppControl::Builder()
+                .SetAppID("org.tizen.test.reply")
+                .Build();
+          result_cb(app_control, APP_CONTROL_ERROR_NONE, user_data);
+          reply_cb(app_control, ctrl.GetHandle(), APP_CONTROL_RESULT_SUCCEEDED,
+              user_data);
+          return 0;
+      }));
+  EXPECT_CALL(mock, OnReplyReceived(_, _, _))
+    .Times(1);
+  EXPECT_CALL(mock, OnResultReceived(_, _))
+    .Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppBaseCallbackMock>().GetCallbacks();
+  int ret = component_based_app_base_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
diff --git a/test/unit_tests/efl_base/test_component_based_app.cc b/test/unit_tests/efl_base/test_component_based_app.cc
new file mode 100644 (file)
index 0000000..4bd7d09
--- /dev/null
@@ -0,0 +1,720 @@
+// Copyright (c) 2019 - 2021 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include <glib.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <stdlib.h>
+
+#include "component_based/base/component.h"
+#include "component_based/efl_base/api/frame_component.h"
+#include "component_based/efl_base/api/frame_component_internal.h"
+#include "component_based/efl_base/api/service_component.h"
+#include "component_based/efl_base/api/component_based_app.h"
+
+#include "mock/app_common_mock.h"
+#include "mock/appcore_multiwindow_base_mock.h"
+#include "mock/component_based_app_callback_mock.h"
+#include "mock/frame_component_callback_mock.h"
+#include "mock/service_component_callback_mock.h"
+#include "mock/dummy_args.h"
+#include "mock/elm_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::Return;
+using ::testing::SetArgPointee;
+using ::testing::Invoke;
+
+using namespace component_based;
+using namespace tizen_cpp;
+
+namespace {
+
+constexpr const char FRAME_COMP_NAME[] = "base-frame-comp";
+constexpr const char FRAME_INST_NAME[] = "@frame1";
+constexpr const char SERVICE_COMP_NAME[] = "base-service-comp";
+constexpr const char SERVICE_INST_NAME[] = "@service1";
+
+class Mocks : virtual public ::testing::NiceMock<ElmMock>,
+    virtual public ::testing::NiceMock<AppCommonMock>,
+    virtual public ::testing::NiceMock<ComponentBasedAppCallbackMock>,
+    virtual public ::testing::NiceMock<ServiceComponentCallbackMock>,
+    virtual public ::testing::NiceMock<FrameComponentCallbackMock>,
+    virtual public ::testing::NiceMock<AppCoreMultiWindowBaseMock> {};
+
+ACTION_P(DoExit, timeout) {
+  g_timeout_add(timeout, [](gpointer data) -> gboolean {
+      component_based_app_exit();
+      return G_SOURCE_REMOVE;
+  }, nullptr);
+}
+
+ACTION_P3(DoStart, mock, comp_id, id) {
+  tizen_base::Bundle b;
+  b.Add(AUL_K_COMPONENT_ID, comp_id);
+  b.Add(AUL_K_INSTANCE_ID, id);
+  mock->real_->OnReceive(AUL_START, std::move(b));
+}
+
+ACTION_P4(SendCmd, mock, comp_id, id, cmd) {
+  tizen_base::Bundle b;
+  b.Add(AUL_K_COMPONENT_ID, comp_id);
+  b.Add(AUL_K_INSTANCE_ID, id);
+  mock->real_->OnReceive(cmd, std::move(b));
+}
+
+ACTION_P(BeforeLoop, mock) {
+  mock->real_->OnLoopInit(arg0, arg1);
+  mock->real_->OnCreate();
+}
+
+ACTION_P(DoLoop, mock) {
+  mock->real_->OnLoopRun();
+}
+
+ACTION_P(AfterLoop, mock) {
+  mock->real_->Dispose();
+}
+
+ACTION_P2(MakeVisibilityEvent, mock, visible) {
+  Ecore_Wl2_Event_Window_Visibility_Change event;
+  event.win = 1;
+
+  if (visible)
+    event.fully_obscured = 0;
+  else
+    event.fully_obscured = 1;
+  mock->real_->OnVisibility(ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, &event);
+}
+
+ACTION_P(MakePreVisibilityEvent, mock) {
+  Ecore_Wl2_Event_Window_Pre_Visibility_Change ev_pre;
+  ev_pre.type = ECORE_WL2_WINDOW_VISIBILITY_TYPE_PRE_UNOBSCURED;
+  ev_pre.win = 1;
+
+  mock->real_->OnPreVisibility(ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE,
+      &ev_pre);
+}
+
+ACTION_P(MakeShowEvent, mock) {
+  Ecore_Wl2_Event_Window_Show ev_show;
+  ev_show.win = 1;
+  ev_show.parent_win = 0;
+  ev_show.data[0] = 1;
+
+  mock->real_->OnShow(ECORE_WL2_EVENT_WINDOW_SHOW, &ev_show);
+}
+
+ACTION_P(MakeHideEvent, mock) {
+  Ecore_Wl2_Event_Window_Hide ev_hide;
+  ev_hide.win = 1;
+  ev_hide.parent_win = 0;
+
+  mock->real_->OnHide(ECORE_WL2_EVENT_WINDOW_HIDE, &ev_hide);
+}
+
+ACTION_P(MakeLowerEvent, mock) {
+  Ecore_Wl2_Event_Window_Lower ev_lower;
+  ev_lower.win = 1;
+
+  mock->real_->OnLower(ECORE_WL2_EVENT_WINDOW_LOWER, &ev_lower);
+}
+
+ACTION_P(AddFrameComponent, mock) {
+  auto cb = mock->GetCallbacks();
+  component_class_h component_class =
+      component_based_app_add_frame_component(nullptr,
+          FRAME_COMP_NAME, &cb, arg0);
+  return component_class;
+}
+
+ACTION_P(AddServiceComponent, mock) {
+  auto cb = mock->GetCallbacks();
+  component_class_h component_class =
+      component_based_app_add_service_component(nullptr,
+          SERVICE_COMP_NAME, &cb, arg0);
+  return component_class;
+}
+
+ACTION_P2(SendEvents, mock, id) {
+  auto* app = mock->real_;
+  auto cxt = app->FindById(id);
+  auto* com = dynamic_cast<Component*>(cxt.get());
+  ASSERT_NE(com, nullptr);
+  app_control_h ctrl;
+  app_control_create(&ctrl);
+  com->OnAction("test_action", AppControl(ctrl));
+  com->OnDeviceOrientationChanged(
+      DeviceOrientation::Orientation::Orientation_90);
+  com->OnLanguageChanged("en");
+  com->OnRegionFormatChanged("kor");
+  com->OnLowBattery(LowBattery::Status::CriticalLow);
+  com->OnLowMemory(LowMemory::Status::SoftWarning);
+  com->OnSuspendedStateChanged(SuspendedState::State::Will_Enter);
+}
+
+}  // namespace
+
+class ComponentBasedAppTest : public TestFixture {
+ public:
+  ComponentBasedAppTest() : TestFixture(std::make_unique<::Mocks>()) {}
+
+  void SetUp() override {}
+  void TearDown() override {}
+};
+
+TEST_F(ComponentBasedAppTest, component_based_app_main) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceComponent(&GetMock<ServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+
+  setenv("AUL_LOADER_INIT", "1", 1);
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(), &callback,
+      this);
+  unsetenv("AUL_LOADER_INIT");
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, component_based_app_main_with_hwacc) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceComponent(&GetMock<ServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  setenv("HWACC", "USE", 1);
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  unsetenv("HWACC");
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, component_based_app_main_without_hwacc) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  setenv("HWACC", "NOT_USE", 1);
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  unsetenv("HWACC");
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, component_based_app_main_with_nullptr) {
+  int ret = component_based_app_main(0, nullptr, nullptr, nullptr);
+  EXPECT_EQ(ret, APP_ERROR_INVALID_PARAMETER);
+}
+
+TEST_F(ComponentBasedAppTest, component_based_app_exit) {
+  int ret = component_based_app_exit();
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, component_based_app_add_frame_component) {
+  auto frame_cb = GetMock<FrameComponentCallbackMock>().GetCallbacks();
+  component_class_h component_class =
+      component_based_app_add_frame_component(nullptr,
+          FRAME_COMP_NAME, &frame_cb, nullptr);
+
+  EXPECT_NE(component_class, nullptr);
+}
+
+TEST_F(ComponentBasedAppTest,
+       component_based_app_add_frame_component_with_nullptr) {
+  component_class_h component_class =
+      component_based_app_add_frame_component(nullptr,
+          nullptr, nullptr, nullptr);
+  EXPECT_EQ(component_class, nullptr);
+  EXPECT_EQ(get_last_result(), APP_ERROR_INVALID_PARAMETER);
+}
+
+TEST_F(ComponentBasedAppTest,
+       component_based_app_add_service_component_with_nullptr) {
+  component_class_h component_class =
+      component_based_app_add_service_component(nullptr,
+          nullptr, nullptr, nullptr);
+  EXPECT_EQ(component_class, nullptr);
+  EXPECT_EQ(get_last_result(), APP_ERROR_INVALID_PARAMETER);
+}
+
+TEST_F(ComponentBasedAppTest, service_component_callbacks) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceComponent(&GetMock<ServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_create_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_start_command_cb(_, _, _, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_callbacks) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_create_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_resume_cb(_, _)).Times(0);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_pause_cb(_, _)).Times(0);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_stop_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_resume_pause) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_create_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+          bool restarted, void* user_data) {
+            auto* app = GetMock<AppCoreMultiWindowBaseMock>().real_;
+            auto cxt = app->FindById(FRAME_INST_NAME);
+            cxt->Context::Resume();
+            cxt->Context::Pause();
+            cxt->Context::Resume();
+          }));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_resume_cb(_, _)).Times(2);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_pause_cb(_, _)).Times(2);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_stop_cb(_, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_destroy_cb(_, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_get_display_status) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  int r = -1;
+  component_display_status_e disp_status = COMPONENT_DISPLAY_STATUS_OFF;
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+          bool restarted, void* user_data) {
+            r = frame_component_get_display_status(context, &disp_status);
+          }));
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(r, APP_ERROR_NONE);
+  EXPECT_EQ(disp_status, COMPONENT_DISPLAY_STATUS_ON);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_get_window) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+
+  int r1 = -1;
+  int r2 = -1;
+  int res_id = -1;
+  Evas_Object* window = nullptr;
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+          bool restarted, void* user_data) {
+            r1 = frame_component_get_window(context, &window);
+            r2 = frame_component_get_resource_id(window, &res_id);
+          }));
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(r1, APP_ERROR_NONE);
+  EXPECT_EQ(r2, APP_ERROR_NONE);
+  EXPECT_NE(window, nullptr);
+  EXPECT_EQ(res_id, 1);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_events) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .WillOnce(
+          SendEvents(&GetMock<AppCoreMultiWindowBaseMock>(), FRAME_INST_NAME)
+      );
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_action_cb(_, _, _, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_device_orientation_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_language_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_region_format_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_low_battery_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_low_memory_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_suspended_state_changed_cb(_, _, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, service_component_events) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddServiceComponent(&GetMock<ServiceComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              SERVICE_COMP_NAME, SERVICE_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_start_command_cb(_, _, _, _))
+      .WillOnce(
+          SendEvents(&GetMock<AppCoreMultiWindowBaseMock>(), SERVICE_INST_NAME)
+      );
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_action_cb(_, _, _, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_device_orientation_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_language_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_region_format_changed_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_low_battery_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_low_memory_cb(_, _, _)).Times(1);
+  EXPECT_CALL(GetMock<ServiceComponentCallbackMock>(),
+      service_component_suspended_state_changed_cb(_, _, _)).Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_pause_resume_event) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(DoAll(
+          SendCmd(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME, AUL_RESUME),
+          SendCmd(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME, AUL_PAUSE),
+          SendCmd(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME, AUL_RESUME)
+      ));
+  EXPECT_CALL(GetMock<ElmMock>(), ecore_wl2_window_activate(_))
+      .WillRepeatedly(
+          MakeVisibilityEvent(&GetMock<AppCoreMultiWindowBaseMock>(), true));
+  EXPECT_CALL(GetMock<ElmMock>(), ecore_wl2_window_iconified_set(_, _))
+      .WillRepeatedly(
+          MakeVisibilityEvent(&GetMock<AppCoreMultiWindowBaseMock>(), false));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_resume_cb(_, _))
+      .Times(2);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_pause_cb(_, _))
+      .Times(2);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_previsibility_event) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(DoAll(
+          MakeShowEvent(&GetMock<AppCoreMultiWindowBaseMock>()),
+          MakePreVisibilityEvent(&GetMock<AppCoreMultiWindowBaseMock>()),
+          MakeLowerEvent(&GetMock<AppCoreMultiWindowBaseMock>()),
+          MakeHideEvent(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_resume_cb(_, _))
+      .Times(1);
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_pause_cb(_, _))
+      .Times(1);
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_aux_event) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  AppCoreBase::DisplayState state = AppCoreBase::DISPLAY_STATE_UNKNOWN;
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .WillOnce(Invoke([&](component_h context, app_control_h app_control,
+          bool restarted, void *user_data) {
+          Ecore_Wl2_Event_Aux_Message event;
+          event.key = "dpms_wm";
+          event.val = "on";
+
+          GetMock<AppCoreMultiWindowBaseMock>().real_->
+              OnAuxMessage(ECORE_WL2_EVENT_AUX_MESSAGE, &event);
+          state = AppCoreBase::GetDisplayState();
+      }));
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+  EXPECT_EQ(AppCoreBase::DISPLAY_STATE_ON, state);
+}
+
+TEST_F(ComponentBasedAppTest, frame_component_terminate_event) {
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_create_cb(_))
+      .Times(1)
+      .WillOnce(DoAll(
+          DoExit(1000),
+          AddFrameComponent(&GetMock<FrameComponentCallbackMock>())
+      ));
+  EXPECT_CALL(GetMock<ComponentBasedAppCallbackMock>(),
+      component_based_app_terminate_cb(_))
+      .Times(1);
+  EXPECT_CALL(GetMock<AppCoreMultiWindowBaseMock>(), Run(_, _))
+      .WillOnce(DoAll(
+          BeforeLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          DoStart(&GetMock<AppCoreMultiWindowBaseMock>(),
+              FRAME_COMP_NAME, FRAME_INST_NAME),
+          DoLoop(&GetMock<AppCoreMultiWindowBaseMock>()),
+          AfterLoop(&GetMock<AppCoreMultiWindowBaseMock>())
+      ));
+  EXPECT_CALL(GetMock<FrameComponentCallbackMock>(),
+      frame_component_start_cb(_, _, _, _))
+      .Times(1)
+      .WillOnce(SendCmd(&GetMock<AppCoreMultiWindowBaseMock>(),
+          FRAME_COMP_NAME, FRAME_INST_NAME, AUL_TERMINATE_INST));
+
+  DummyArgs da;
+  auto callback = GetMock<ComponentBasedAppCallbackMock>().GetCallbacks();
+  int ret = component_based_app_main(da.GetArgc(), da.GetArgv(),
+      &callback, this);
+  EXPECT_EQ(ret, APP_ERROR_NONE);
+}
diff --git a/test/unit_tests/mock/app_common_mock.cc b/test/unit_tests/mock/app_common_mock.cc
new file mode 100644 (file)
index 0000000..5aca9fc
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/app_common_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+extern "C" int app_get_id(char** appid) {
+  return MOCK_HOOK_P1(AppCommonMock, app_get_id, appid);
+}
+
+extern "C" char* app_get_data_path() {
+  return MOCK_HOOK_P0(AppCommonMock, app_get_data_path);
+}
+
+extern "C" int app_get_display_state(app_display_state_e* state) {
+  return MOCK_HOOK_P1(AppCommonMock, app_get_display_state, state);
+}
+
+extern "C" int app_resource_manager_get(app_resource_e type,
+                        const char* id, char** path) {
+  return MOCK_HOOK_P3(AppCommonMock, app_resource_manager_get, type, id, path);
+}
diff --git a/test/unit_tests/mock/app_common_mock.h b/test/unit_tests/mock/app_common_mock.h
new file mode 100644 (file)
index 0000000..fa822c1
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2021 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 MOCK_APP_COMMON_MOCK_H_
+#define MOCK_APP_COMMON_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+#include <app_common.h>
+#include <app_resource_manager.h>
+
+#include "mock/module_mock.h"
+
+class AppCommonMock : public virtual ModuleMock {
+ public:
+  AppCommonMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+
+    ON_CALL(*this, app_get_id(_))
+      .WillByDefault(Invoke([&](char** appid) -> int {
+        *appid = strdup("tizen.org.test.appid");
+        return 0;
+      }));
+    ON_CALL(*this, app_get_data_path())
+      .WillByDefault(Invoke([&]() -> char* {
+        return strdup("/tmp/");
+      }));
+    ON_CALL(*this, app_get_display_state(_))
+      .WillByDefault(Invoke([&](app_display_state_e* state) -> int {
+        *state = APP_DISPLAY_STATE_ON;
+        return 0;
+      }));
+    ON_CALL(*this, app_resource_manager_get(_, _, _))
+      .WillByDefault(Invoke([&](app_resource_e type,
+                        const char* id, char** path) -> int {
+        *path = strdup("/tmp/");
+        return 0;
+      }));
+  }
+
+  MOCK_METHOD1(app_get_id, int (char**));
+  MOCK_METHOD0(app_get_data_path, char* ());
+  MOCK_METHOD1(app_get_display_state, int (app_display_state_e*));
+  MOCK_METHOD3(app_resource_manager_get, int (app_resource_e,
+      const char*, char**));
+};
+
+#endif  // MOCK_APP_COMMON_MOCK_H_
+
diff --git a/test/unit_tests/mock/app_control_event_mock.h b/test/unit_tests/mock/app_control_event_mock.h
new file mode 100644 (file)
index 0000000..c56d412
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2021 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 MOCK_APP_CONTROL_EVENT_MOCK_H_
+#define MOCK_APP_CONTROL_EVENT_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/app_control/component_based_app_control.h"
+#include "mock/module_mock.h"
+
+class AppControlEventMock
+    : public virtual component_based::AppControl::IEventListener {
+ public:
+  AppControlEventMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+  }
+
+  MOCK_METHOD2(OnResultReceived,
+      void (component_based::AppControl, component_based::AppControl::Error));
+  MOCK_METHOD3(OnReplyReceived,
+      void (component_based::AppControl, component_based::AppControl,
+          component_based::AppControl::Result));
+};
+
+#endif  // MOCK_APP_CONTROL_EVENT_MOCK_H_
+
diff --git a/test/unit_tests/mock/app_control_mock.cc b/test/unit_tests/mock/app_control_mock.cc
new file mode 100644 (file)
index 0000000..545ae53
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/app_control_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+extern "C" int app_control_send_launch_request_sync(app_control_h app_control,
+    app_control_h* reply, app_control_result_e* result) {
+  return MOCK_HOOK_P3(AppControlMock, app_control_send_launch_request_sync,
+      app_control, reply, result);
+}
+
+extern "C" int app_control_send_launch_request_async(app_control_h app_control,
+    app_control_result_cb result_cb, app_control_reply_cb reply_cb,
+    void* user_data) {
+  return MOCK_HOOK_P4(AppControlMock, app_control_send_launch_request_async,
+      app_control, result_cb, reply_cb, user_data);
+}
+
+extern "C" int app_control_add_action_handler(const char* action,
+    app_control_action_cb callback, void* user_data,
+    app_control_action_h* handle) {
+  return MOCK_HOOK_P4(AppControlMock, app_control_add_action_handler,
+      action, callback, user_data, handle);
+}
+
+extern "C" int app_control_remove_action_handler(app_control_action_h handle) {
+  return MOCK_HOOK_P1(AppControlMock, app_control_remove_action_handler, handle);
+}
diff --git a/test/unit_tests/mock/app_control_mock.h b/test/unit_tests/mock/app_control_mock.h
new file mode 100644 (file)
index 0000000..c116ea6
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2021 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 MOCK_APP_CONTROL_MOCK_H_
+#define MOCK_APP_CONTROL_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+#include <app_control.h>
+
+#include "mock/module_mock.h"
+
+class AppControlMock : public virtual ModuleMock {
+ public:
+  AppControlMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+
+    ON_CALL(*this, app_control_send_launch_request_sync(_, _, _))
+      .WillByDefault(Invoke([&](app_control_h app_control,
+          app_control_h* reply, app_control_result_e* result) -> int {
+        *result = APP_CONTROL_RESULT_SUCCEEDED;
+        *reply = nullptr;
+        return 0;
+      }));
+    ON_CALL(*this, app_control_send_launch_request_async(_, _, _, _))
+      .WillByDefault(Invoke([&](app_control_h app_control,
+          app_control_result_cb result_cb, app_control_reply_cb reply_cb,
+          void* user_data) -> int {
+        result_cb(app_control, APP_CONTROL_ERROR_NONE, user_data);
+        return 0;
+      }));
+    ON_CALL(*this, app_control_add_action_handler(_, _, _, _))
+      .WillByDefault(Invoke([&](const char* action,
+          app_control_action_cb callback, void *user_data,
+          app_control_action_h* handle) -> int {
+        app_control_h ctrl = nullptr;
+        app_control_create(&ctrl);
+        callback(action, ctrl, user_data);
+        app_control_destroy(ctrl);
+        return 0;
+      }));
+  }
+
+  MOCK_METHOD3(app_control_send_launch_request_sync,
+      int (app_control_h, app_control_h*, app_control_result_e*));
+  MOCK_METHOD4(app_control_send_launch_request_async,
+      int (app_control_h, app_control_result_cb, app_control_reply_cb, void*));
+  MOCK_METHOD4(app_control_add_action_handler,
+      int (const char*, app_control_action_cb, void*, app_control_action_h*));
+  MOCK_METHOD1(app_control_remove_action_handler,
+      int (app_control_action_h));
+
+};
+
+#endif  // MOCK_APP_CONTROL_MOCK_H_
+
diff --git a/test/unit_tests/mock/appcore_multiwindow_base_mock.cc b/test/unit_tests/mock/appcore_multiwindow_base_mock.cc
new file mode 100644 (file)
index 0000000..b6d5db7
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020 - 2021 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 "mock/appcore_multiwindow_base_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace tizen_cpp {
+
+void AppCoreMultiWindowBase::Run(int argc, char** argv) {
+  TestFixture::GetMock<AppCoreMultiWindowBaseMock>().real_ = this;
+  TestFixture::GetMock<AppCoreMultiWindowBaseMock>().Run(argc, argv);
+  TestFixture::GetMock<AppCoreMultiWindowBaseMock>().real_ = nullptr;
+}
+
+int AppCoreMultiWindowBase::OnCreate() {
+  return TestFixture::GetMock<AppCoreMultiWindowBaseMock>().OnCreate();
+}
+
+int AppCoreBase::OnTerminate() {
+  return TestFixture::GetMock<AppCoreMultiWindowBaseMock>().OnTerminate();
+}
+
+void AppCoreBase::Dispose() {
+  return TestFixture::GetMock<AppCoreMultiWindowBaseMock>().Dispose();
+}
+
+}  // namespace tizen_cpp
diff --git a/test/unit_tests/mock/appcore_multiwindow_base_mock.h b/test/unit_tests/mock/appcore_multiwindow_base_mock.h
new file mode 100644 (file)
index 0000000..dacfa9e
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2020 - 2021 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 UNIT_TESTS_MOCK_APPCORE_MULTIWINDOW_BASE_MOCK_H_
+#define UNIT_TESTS_MOCK_APPCORE_MULTIWINDOW_BASE_MOCK_H_
+
+#include <app_core_multi_window_base.hh>
+#include <gmock/gmock.h>
+
+#include "component_based/efl_base/api/frame_component.h"
+#include "component_based/efl_base/api/service_component.h"
+#include "component_based/efl_base/api/component_based_app.h"
+#include "mock/module_mock.h"
+
+class AppCoreMultiWindowBaseMock : public virtual ModuleMock {
+ public:
+  AppCoreMultiWindowBaseMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+
+    ON_CALL(*this, Run(_, _))
+        .WillByDefault(Invoke([&](int argc, char** argv) {
+          real_->OnLoopInit(argc, argv);
+          if (real_->OnCreate() >= 0)
+            real_->OnLoopRun();
+          real_->Dispose();
+        }));
+    ON_CALL(*this, Dispose())
+        .WillByDefault(Invoke([&]() {
+          real_->OnTerminate();
+          real_->OnLoopFinish();
+        }));
+  }
+
+  virtual ~AppCoreMultiWindowBaseMock() {}
+
+  MOCK_METHOD2(Run, void(int, char**));
+  MOCK_METHOD0(Dispose, void());
+  MOCK_METHOD0(OnCreate, int());
+  MOCK_METHOD0(OnTerminate, int());
+
+  std::shared_ptr<tizen_cpp::AppCoreMultiWindowBase::Context>
+      GetContext(const std::string& id) {
+    return real_->FindById(id);
+  }
+
+  tizen_cpp::AppCoreMultiWindowBase* real_ = nullptr;
+};
+
+#endif  // UNIT_TESTS_MOCK_APPCORE_MULTIWINDOW_BASE_MOCK_H_
+
diff --git a/test/unit_tests/mock/base_component_callback_mock.cc b/test/unit_tests/mock/base_component_callback_mock.cc
new file mode 100644 (file)
index 0000000..5f8f407
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/base_component_callback_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace {
+
+void __base_component_restore_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock, base_component_restore_content_cb,
+      context, content, user_data);
+}
+
+void __base_component_save_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock, base_component_save_content_cb,
+      context, content, user_data);
+}
+
+void __base_component_device_orientation_changed_cb(
+    component_h context, component_device_orientation_e orientation,
+    void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock,
+      base_component_device_orientation_changed_cb, context, orientation,
+      user_data);
+}
+
+void __base_component_language_changed_cb(component_h context,
+    const char* language, void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock, base_component_language_changed_cb,
+    context, language, user_data);
+}
+
+void __base_component_region_format_changed_cb(component_h context,
+    const char* region, void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock,
+      base_component_region_format_changed_cb, context, region, user_data);
+}
+
+void __base_component_low_battery_cb(component_h context,
+    component_low_battery_status_e status, void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock, base_component_low_battery_cb,
+    context, status, user_data);
+}
+
+void __base_component_low_memory_cb(component_h context,
+    component_low_memory_status_e status, void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock, base_component_low_memory_cb,
+    context, status, user_data);
+}
+
+void __base_component_suspended_state_changed_cb(component_h context,
+    component_suspended_state_e state, void* user_data) {
+  MOCK_HOOK_P3(BaseComponentCallbackMock,
+      base_component_suspended_state_changed_cb, context, state, user_data);
+}
+
+}  // namespace
+
+base_component_lifecycle_callback_s BaseComponentCallbackMock::GetCallbacks() {
+  base_component_lifecycle_callback_s callback;
+  callback.restore_content =
+    __base_component_restore_content_cb;
+  callback.save_content =
+    __base_component_save_content_cb;
+  callback.device_orientation_changed =
+    __base_component_device_orientation_changed_cb;
+  callback.language_changed =
+    __base_component_language_changed_cb;
+  callback.region_format_changed =
+    __base_component_region_format_changed_cb;
+  callback.low_battery =
+    __base_component_low_battery_cb;
+  callback.low_memory =
+    __base_component_low_memory_cb;
+  callback.suspended_state_changed =
+    __base_component_suspended_state_changed_cb;
+
+  return callback;
+}
diff --git a/test/unit_tests/mock/base_component_callback_mock.h b/test/unit_tests/mock/base_component_callback_mock.h
new file mode 100644 (file)
index 0000000..9f7bbcd
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2021 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 MOCK_BASE_COMPONENT_CALLBACK_MOCK_H_
+#define MOCK_BASE_COMPONENT_CALLBACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/base/api/base_component.h"
+#include "mock/module_mock.h"
+
+class BaseComponentCallbackMock : public virtual ModuleMock {
+ public:
+  BaseComponentCallbackMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+    using ::testing::Return;
+  }
+
+  base_component_lifecycle_callback_s GetCallbacks();
+
+  MOCK_METHOD3(base_component_restore_content_cb,
+      void (component_h, bundle*, void*));
+  MOCK_METHOD3(base_component_save_content_cb,
+      void (component_h, bundle*, void*));
+  MOCK_METHOD3(base_component_device_orientation_changed_cb,
+      void (component_h, component_device_orientation_e, void*));
+  MOCK_METHOD3(base_component_language_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(base_component_region_format_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(base_component_low_battery_cb,
+      void (component_h, component_low_battery_status_e, void*));
+  MOCK_METHOD3(base_component_low_memory_cb,
+      void (component_h, component_low_memory_status_e, void*));
+  MOCK_METHOD3(base_component_suspended_state_changed_cb,
+      void (component_h, component_suspended_state_e, void*));
+};
+
+#endif  // MOCK_BASE_COMPONENT_CALLBACK_MOCK_H_
diff --git a/test/unit_tests/mock/base_frame_component_callback_mock.cc b/test/unit_tests/mock/base_frame_component_callback_mock.cc
new file mode 100644 (file)
index 0000000..4ee1f7f
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/base_frame_component_callback_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace {
+
+frame_window_h __base_frame_component_create_cb(component_h context,
+    void* user_data) {
+  return MOCK_HOOK_P2(BaseFrameComponentCallbackMock,
+        base_frame_component_create_cb, context, user_data);
+}
+
+void __base_frame_component_start_cb(component_h context,
+    app_control_h app_control, bool restarted, void* user_data) {
+  MOCK_HOOK_P4(BaseFrameComponentCallbackMock, base_frame_component_start_cb,
+      context, app_control, restarted, user_data);
+}
+
+void __base_frame_component_resume_cb(component_h context,
+    void* user_data) {
+  MOCK_HOOK_P2(BaseFrameComponentCallbackMock, base_frame_component_resume_cb,
+      context, user_data);
+}
+
+void __base_frame_component_pause_cb(component_h context,
+    void* user_data) {
+  MOCK_HOOK_P2(BaseFrameComponentCallbackMock, base_frame_component_pause_cb,
+      context, user_data);
+}
+
+void __base_frame_component_stop_cb(component_h context,
+    void* user_data) {
+  MOCK_HOOK_P2(BaseFrameComponentCallbackMock, base_frame_component_stop_cb,
+      context, user_data);
+}
+
+void __base_frame_component_destroy_cb(component_h context,
+    void *user_data) {
+  MOCK_HOOK_P2(BaseFrameComponentCallbackMock, base_frame_component_destroy_cb,
+      context, user_data);
+}
+
+void __base_frame_component_restore_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_restore_content_cb, context, content, user_data);
+}
+
+void __base_frame_component_save_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_save_content_cb, context, content, user_data);
+}
+
+void __base_frame_component_action_cb(component_h context,
+    const char* action, app_control_h app_control, void* user_data) {
+  MOCK_HOOK_P4(BaseFrameComponentCallbackMock, base_frame_component_action_cb,
+      context, action, app_control, user_data);
+}
+
+void __base_frame_component_device_orientation_changed_cb(
+    component_h context, component_device_orientation_e orientation,
+    void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_device_orientation_changed_cb, context, orientation,
+      user_data);
+}
+
+void __base_frame_component_language_changed_cb(component_h context,
+    const char* language, void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_language_changed_cb, context, language, user_data);
+}
+
+void __base_frame_component_region_format_changed_cb(component_h context,
+    const char* region, void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_region_format_changed_cb, context, region,
+      user_data);
+}
+
+void __base_frame_component_low_battery_cb(component_h context,
+    component_low_battery_status_e status, void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_low_battery_cb, context, status, user_data);
+}
+
+void __base_frame_component_low_memory_cb(component_h context,
+    component_low_memory_status_e status, void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_low_memory_cb, context, status, user_data);
+}
+
+void __base_frame_component_suspended_state_changed_cb(component_h context,
+    component_suspended_state_e state, void* user_data) {
+  MOCK_HOOK_P3(BaseFrameComponentCallbackMock,
+      base_frame_component_suspended_state_changed_cb, context, state,
+      user_data);
+}
+
+}  // namespace
+
+base_frame_component_lifecycle_callback_s
+BaseFrameComponentCallbackMock::GetCallbacks() {
+  base_frame_component_lifecycle_callback_s callback;
+  callback.create =
+      __base_frame_component_create_cb;
+  callback.start =
+      __base_frame_component_start_cb;
+  callback.resume =
+      __base_frame_component_resume_cb;
+  callback.pause =
+      __base_frame_component_pause_cb;
+  callback.stop =
+      __base_frame_component_stop_cb;
+  callback.destroy =
+      __base_frame_component_destroy_cb;
+  callback.restore_content =
+      __base_frame_component_restore_content_cb;
+  callback.save_content =
+      __base_frame_component_save_content_cb;
+  callback.action =
+      __base_frame_component_action_cb;
+  callback.device_orientation_changed =
+      __base_frame_component_device_orientation_changed_cb;
+  callback.language_changed =
+      __base_frame_component_language_changed_cb;
+  callback.region_format_changed =
+      __base_frame_component_region_format_changed_cb;
+  callback.low_battery =
+      __base_frame_component_low_battery_cb;
+  callback.low_memory =
+      __base_frame_component_low_memory_cb;
+  callback.suspended_state_changed =
+      __base_frame_component_suspended_state_changed_cb;
+
+  return callback;
+}
diff --git a/test/unit_tests/mock/base_frame_component_callback_mock.h b/test/unit_tests/mock/base_frame_component_callback_mock.h
new file mode 100644 (file)
index 0000000..df9008d
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2021 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 MOCK_BASE_FRAME_COMPONENT_CALLBACK_MOCK_H_
+#define MOCK_BASE_FRAME_COMPONENT_CALLBACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/base/api/base_frame_component.h"
+#include "mock/module_mock.h"
+
+class BaseFrameComponentCallbackMock : public virtual ModuleMock {
+ public:
+  BaseFrameComponentCallbackMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+    using ::testing::Return;
+
+    ON_CALL(*this, base_frame_component_create_cb(_, _))
+      .WillByDefault(Return(nullptr));
+  }
+
+  base_frame_component_lifecycle_callback_s GetCallbacks();
+
+  MOCK_METHOD2(base_frame_component_create_cb,
+      frame_window_h (component_h, void*));
+  MOCK_METHOD4(base_frame_component_start_cb,
+      void (component_h, app_control_h, bool, void*));
+  MOCK_METHOD2(base_frame_component_resume_cb, void (component_h, void*));
+  MOCK_METHOD2(base_frame_component_pause_cb, void (component_h, void*));
+  MOCK_METHOD2(base_frame_component_stop_cb, void (component_h, void*));
+  MOCK_METHOD2(base_frame_component_destroy_cb, void (component_h, void*));
+  MOCK_METHOD3(base_frame_component_restore_content_cb,
+      void (component_h, bundle*, void*));
+  MOCK_METHOD3(base_frame_component_save_content_cb,
+      void (component_h, bundle*, void*));
+  MOCK_METHOD4(base_frame_component_action_cb, void (component_h, const char*,
+      app_control_h, void*));
+  MOCK_METHOD3(base_frame_component_device_orientation_changed_cb,
+      void (component_h, component_device_orientation_e, void*));
+  MOCK_METHOD3(base_frame_component_language_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(base_frame_component_region_format_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(base_frame_component_low_battery_cb,
+      void (component_h, component_low_battery_status_e, void*));
+  MOCK_METHOD3(base_frame_component_low_memory_cb,
+      void (component_h, component_low_memory_status_e, void*));
+  MOCK_METHOD3(base_frame_component_suspended_state_changed_cb,
+      void (component_h, component_suspended_state_e, void*));
+};
+
+#endif  // MOCK_BASE_FRAME_COMPONENT_CALLBACK_MOCK_H_
diff --git a/test/unit_tests/mock/base_service_component_callback_mock.cc b/test/unit_tests/mock/base_service_component_callback_mock.cc
new file mode 100644 (file)
index 0000000..be7b52d
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/base_service_component_callback_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace {
+
+bool __base_service_component_create_cb(component_h context,
+    void* user_data) {
+  return MOCK_HOOK_P2(BaseServiceComponentCallbackMock,
+      base_service_component_create_cb, context, user_data);
+}
+
+void __base_service_component_start_command_cb(component_h context,
+    app_control_h app_control, bool restarted, void* user_data) {
+  MOCK_HOOK_P4(BaseServiceComponentCallbackMock,
+      base_service_component_start_command_cb, context, app_control, restarted,
+      user_data);
+}
+
+void __base_service_component_destroy_cb(component_h context,
+    void *user_data) {
+  MOCK_HOOK_P2(BaseServiceComponentCallbackMock,
+      base_service_component_destroy_cb, context, user_data);
+}
+
+void __base_service_component_restore_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_restore_content_cb, context, content, user_data);
+}
+
+void __base_service_component_save_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_save_content_cb, context, content, user_data);
+}
+
+void __base_service_component_action_cb(component_h context,
+    const char* action, app_control_h app_control, void* user_data) {
+  MOCK_HOOK_P4(BaseServiceComponentCallbackMock,
+      base_service_component_action_cb, context, action, app_control,
+      user_data);
+}
+
+void __base_service_component_device_orientation_changed_cb(
+    component_h context, component_device_orientation_e orientation,
+    void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_device_orientation_changed_cb, context,
+      orientation, user_data);
+}
+
+void __base_service_component_language_changed_cb(component_h context,
+    const char* language, void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_language_changed_cb, context, language, user_data);
+}
+
+void __base_service_component_region_format_changed_cb(component_h context,
+    const char* region, void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_region_format_changed_cb, context, region,
+      user_data);
+}
+
+void __base_service_component_low_battery_cb(component_h context,
+    component_low_battery_status_e status, void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_low_battery_cb, context, status, user_data);
+}
+
+void __base_service_component_low_memory_cb(component_h context,
+    component_low_memory_status_e status, void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_low_memory_cb, context, status, user_data);
+}
+
+void __base_service_component_suspended_state_changed_cb(component_h context,
+    component_suspended_state_e state, void* user_data) {
+  MOCK_HOOK_P3(BaseServiceComponentCallbackMock,
+      base_service_component_suspended_state_changed_cb, context, state, user_data);
+}
+
+}  // namespace
+
+base_service_component_lifecycle_callback_s
+BaseServiceComponentCallbackMock::GetCallbacks() {
+  base_service_component_lifecycle_callback_s callback;
+  callback.create =
+    __base_service_component_create_cb;
+  callback.start_command =
+    __base_service_component_start_command_cb;
+  callback.destroy =
+    __base_service_component_destroy_cb;
+  callback.restore_content =
+    __base_service_component_restore_content_cb;
+  callback.save_content =
+    __base_service_component_save_content_cb;
+  callback.action =
+    __base_service_component_action_cb;
+  callback.device_orientation_changed =
+    __base_service_component_device_orientation_changed_cb;
+  callback.language_changed =
+    __base_service_component_language_changed_cb;
+  callback.region_format_changed =
+    __base_service_component_region_format_changed_cb;
+  callback.low_battery =
+    __base_service_component_low_battery_cb;
+  callback.low_memory =
+    __base_service_component_low_memory_cb;
+  callback.suspended_state_changed =
+    __base_service_component_suspended_state_changed_cb;
+
+  return callback;
+}
diff --git a/test/unit_tests/mock/base_service_component_callback_mock.h b/test/unit_tests/mock/base_service_component_callback_mock.h
new file mode 100644 (file)
index 0000000..9c93844
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2021 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 MOCK_BASE_SERVICE_COMPONENT_CALLBACK_MOCK_H_
+#define MOCK_BASE_SERVICE_COMPONENT_CALLBACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/base/api/base_service_component.h"
+#include "mock/module_mock.h"
+
+class BaseServiceComponentCallbackMock : public virtual ModuleMock {
+ public:
+  BaseServiceComponentCallbackMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+    using ::testing::Return;
+
+    ON_CALL(*this, base_service_component_create_cb(_, _))
+      .WillByDefault(Return(true));
+  }
+
+  base_service_component_lifecycle_callback_s GetCallbacks();
+
+  MOCK_METHOD2(base_service_component_create_cb, bool (component_h, void*));
+  MOCK_METHOD4(base_service_component_start_command_cb,
+      void (component_h, app_control_h, bool, void*));
+  MOCK_METHOD2(base_service_component_destroy_cb, void (component_h, void*));
+  MOCK_METHOD3(base_service_component_restore_content_cb,
+      void (component_h, bundle*, void*));
+  MOCK_METHOD3(base_service_component_save_content_cb,
+      void (component_h, bundle*, void*));
+  MOCK_METHOD4(base_service_component_action_cb,
+      void (component_h, const char*, app_control_h, void*));
+  MOCK_METHOD3(base_service_component_device_orientation_changed_cb,
+      void (component_h, component_device_orientation_e, void*));
+  MOCK_METHOD3(base_service_component_language_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(base_service_component_region_format_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(base_service_component_low_battery_cb,
+      void (component_h, component_low_battery_status_e, void*));
+  MOCK_METHOD3(base_service_component_low_memory_cb,
+      void (component_h, component_low_memory_status_e, void*));
+  MOCK_METHOD3(base_service_component_suspended_state_changed_cb,
+      void (component_h, component_suspended_state_e, void*));
+};
+
+#endif  // MOCK_BASE_SERVICE_COMPONENT_CALLBACK_MOCK_H_
diff --git a/test/unit_tests/mock/component_based_app_base_callback_mock.cc b/test/unit_tests/mock/component_based_app_base_callback_mock.cc
new file mode 100644 (file)
index 0000000..35b4dcb
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/component_based_app_base_callback_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace {
+
+void __app_init_cb(int argc, char** argv, void *user_data) {
+  MOCK_HOOK_P3(ComponentBasedAppBaseCallbackMock,
+      component_based_app_base_init_cb,
+      argc, argv, user_data);
+}
+
+void __app_fini_cb(void *user_data) {
+  MOCK_HOOK_P1(ComponentBasedAppBaseCallbackMock,
+      component_based_app_base_fini_cb, user_data);
+}
+
+void __app_run_cb(void *user_data) {
+  MOCK_HOOK_P1(ComponentBasedAppBaseCallbackMock,
+      component_based_app_base_run_cb, user_data);
+}
+
+void __app_exit_cb(void *user_data) {
+  MOCK_HOOK_P1(ComponentBasedAppBaseCallbackMock,
+      component_based_app_base_exit_cb, user_data);
+}
+
+component_class_h __app_create_cb(void *user_data) {
+  return MOCK_HOOK_P1(ComponentBasedAppBaseCallbackMock,
+      component_based_app_base_create_cb, user_data);
+}
+
+void __app_terminate_cb(void *user_data) {
+  MOCK_HOOK_P1(ComponentBasedAppBaseCallbackMock,
+      component_based_app_base_terminate_cb, user_data);
+}
+
+}  // namespace
+
+component_based_app_base_lifecycle_callback_s
+ComponentBasedAppBaseCallbackMock::GetCallbacks() {
+  component_based_app_base_lifecycle_callback_s callback;
+
+  callback.init = __app_init_cb;
+  callback.fini = __app_fini_cb;
+  callback.run = __app_run_cb;
+  callback.exit = __app_exit_cb;
+  callback.create = __app_create_cb;
+  callback.terminate = __app_terminate_cb;
+
+  return callback;
+}
diff --git a/test/unit_tests/mock/component_based_app_base_callback_mock.h b/test/unit_tests/mock/component_based_app_base_callback_mock.h
new file mode 100644 (file)
index 0000000..59b3c89
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2021 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 MOCK_COMPONENT_BASED_APP_BASE_CALLBACK_MOCK_H_
+#define MOCK_COMPONENT_BASED_APP_BASE_CALLBACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/base/api/component_based_app_base.h"
+#include "mock/module_mock.h"
+
+class ComponentBasedAppBaseCallbackMock : public virtual ModuleMock {
+ public:
+  ComponentBasedAppBaseCallbackMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+    using ::testing::Return;
+
+    ON_CALL(*this, component_based_app_base_create_cb(_))
+      .WillByDefault(Return(nullptr));
+
+    ON_CALL(*this, component_based_app_base_init_cb(_, _, _))
+      .WillByDefault(Invoke([&](int argc, char **argv, void*) {
+        loop_ = g_main_loop_new(nullptr, FALSE);
+      }));
+    ON_CALL(*this, component_based_app_base_fini_cb(_))
+      .WillByDefault(Invoke([&](void*) {
+        if (loop_)
+          g_main_loop_unref(loop_);
+      }));
+    ON_CALL(*this, component_based_app_base_run_cb(_))
+      .WillByDefault(Invoke([&](void*) {
+        if (loop_)
+          g_main_loop_run(loop_);
+      }));
+    ON_CALL(*this, component_based_app_base_exit_cb(_))
+      .WillByDefault(Invoke([&](void*) {
+        if (loop_)
+          g_main_loop_quit(loop_);
+      }));
+  }
+
+  component_based_app_base_lifecycle_callback_s GetCallbacks();
+
+  MOCK_METHOD3(component_based_app_base_init_cb, void (int, char**, void*));
+  MOCK_METHOD1(component_based_app_base_fini_cb, void (void*));
+  MOCK_METHOD1(component_based_app_base_run_cb, void (void*));
+  MOCK_METHOD1(component_based_app_base_exit_cb, void (void*));
+  MOCK_METHOD1(component_based_app_base_create_cb, component_class_h (void*));
+  MOCK_METHOD1(component_based_app_base_terminate_cb, void (void*));
+
+ private:
+  GMainLoop* loop_ = nullptr;
+};
+
+#endif  // MOCK_COMPONENT_BASED_APP_BASE_CALLBACK_MOCK_H_
+
diff --git a/test/unit_tests/mock/component_based_app_callback_mock.cc b/test/unit_tests/mock/component_based_app_callback_mock.cc
new file mode 100644 (file)
index 0000000..038e0f0
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/component_based_app_callback_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace {
+
+component_class_h __app_create_cb(void *user_data) {
+  return MOCK_HOOK_P1(ComponentBasedAppCallbackMock,
+      component_based_app_create_cb, user_data);
+}
+
+void __app_terminate_cb(void *user_data) {
+  MOCK_HOOK_P1(ComponentBasedAppCallbackMock,
+      component_based_app_terminate_cb, user_data);
+}
+
+}  // namespace
+
+component_based_app_lifecycle_callback_s
+ComponentBasedAppCallbackMock::GetCallbacks() {
+  component_based_app_lifecycle_callback_s callback;
+
+  callback.create = __app_create_cb;
+  callback.terminate = __app_terminate_cb;
+
+  return callback;
+}
diff --git a/test/unit_tests/mock/component_based_app_callback_mock.h b/test/unit_tests/mock/component_based_app_callback_mock.h
new file mode 100644 (file)
index 0000000..6c445da
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2021 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 MOCK_COMPONENT_BASED_APP_CALLBACK_MOCK_H_
+#define MOCK_COMPONENT_BASED_APP_CALLBACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/efl_base/api/frame_component.h"
+#include "component_based/efl_base/api/service_component.h"
+#include "component_based/efl_base/api/component_based_app.h"
+#include "mock/module_mock.h"
+
+class ComponentBasedAppCallbackMock : public virtual ModuleMock {
+ public:
+  ComponentBasedAppCallbackMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+    using ::testing::Return;
+
+    ON_CALL(*this, component_based_app_create_cb(_))
+      .WillByDefault(Return(nullptr));
+  }
+
+  component_based_app_lifecycle_callback_s GetCallbacks();
+
+  MOCK_METHOD1(component_based_app_create_cb, component_class_h (void*));
+  MOCK_METHOD1(component_based_app_terminate_cb, void (void*));
+};
+
+#endif  // MOCK_COMPONENT_BASED_APP_CALLBACK_MOCK_H_
+
diff --git a/test/unit_tests/mock/dummy_args.h b/test/unit_tests/mock/dummy_args.h
new file mode 100644 (file)
index 0000000..e628862
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2021 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 MOCK_DUMMY_ARGS_H_
+#define MOCK_DUMMY_ARGS_H_
+
+#include <bundle_cpp.h>
+#include <bundle_internal.h>
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "mock/module_mock.h"
+
+class DummyArgs {
+ public:
+  DummyArgs() {
+    tizen_base::Bundle b;
+    b.Add("dummy", "dummy");
+    argc_ = bundle_export_to_argv(b.GetHandle(), &argv_);
+  }
+
+  DummyArgs(std::string key, std::string val) {
+    tizen_base::Bundle b;
+    b.Add(std::move(key), std::move(val));
+    argc_ = bundle_export_to_argv(b.GetHandle(), &argv_);
+  }
+
+  DummyArgs(std::list<std::pair<std::string,std::string>> args) {
+    tizen_base::Bundle b;
+    for (auto& i : args)
+      b.Add(std::move(i.first), std::move(i.second));
+    argc_ = bundle_export_to_argv(b.GetHandle(), &argv_);
+  }
+
+  ~DummyArgs() {
+    bundle_free_exported_argv(argc_, &argv_);
+  }
+
+  int GetArgc() const {
+    return argc_;
+  }
+
+  char** GetArgv() const {
+    return argv_;
+  }
+
+ private:
+  int argc_ = 0;
+  char** argv_ = nullptr;
+};
+
+#endif  // MOCK_DUMMY_ARGS_H_
+
diff --git a/test/unit_tests/mock/elm_mock.cc b/test/unit_tests/mock/elm_mock.cc
new file mode 100644 (file)
index 0000000..cc96113
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/elm_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+extern "C" int elm_init(int argc, char** argv) {
+  return MOCK_HOOK_P2(ElmMock, elm_init, argc, argv);
+}
+
+extern "C" int elm_shutdown() {
+  return MOCK_HOOK_P0(ElmMock, elm_shutdown);
+}
+
+extern "C" void elm_run() {
+  MOCK_HOOK_P0(ElmMock, elm_run);
+}
+
+extern "C" void elm_exit() {
+  MOCK_HOOK_P0(ElmMock, elm_exit);
+}
+
+extern "C" void elm_config_accel_preference_set(const char* arg1) {
+  MOCK_HOOK_P1(ElmMock, elm_config_accel_preference_set, arg1);
+}
+
+extern "C" void elm_cache_all_flush() {
+  MOCK_HOOK_P0(ElmMock, elm_cache_all_flush);
+}
+
+extern "C" void evas_object_del(Evas_Object *obj) {
+  return MOCK_HOOK_P1(ElmMock, evas_object_del, obj);
+}
+
+extern "C" Evas* evas_object_evas_get(const Eo *eo_obj) {
+  return MOCK_HOOK_P1(ElmMock, evas_object_evas_get, eo_obj);
+}
+
+extern "C" Ecore_Wl2_Window* ecore_evas_wayland2_window_get(const Ecore_Evas *ee) {
+  return MOCK_HOOK_P1(ElmMock, ecore_evas_wayland2_window_get, ee);
+}
+
+extern "C" int ecore_wl2_window_id_get(Ecore_Wl2_Window* win) {
+  return MOCK_HOOK_P1(ElmMock, ecore_wl2_window_id_get, win);
+}
+
+extern "C" Ecore_Evas* ecore_evas_ecore_evas_get(const Evas* e) {
+  return MOCK_HOOK_P1(ElmMock, ecore_evas_ecore_evas_get, e);
+}
+
+extern "C" Evas_Object* elm_win_util_standard_add(const char* arg1, const char* arg2) {
+  return MOCK_HOOK_P2(ElmMock, elm_win_util_standard_add, arg1, arg2);
+}
+
+extern "C" Ecore_Wl2_Display* ecore_wl2_connected_display_get(
+    const char* display) {
+  return MOCK_HOOK_P1(ElmMock, ecore_wl2_connected_display_get, display);
+}
+
+extern "C" Ecore_Wl2_Window* ecore_wl2_display_window_find(
+    Ecore_Wl2_Display* display, unsigned int id) {
+  return MOCK_HOOK_P2(ElmMock, ecore_wl2_display_window_find, display, id);
+}
+
+extern "C" void ecore_wl2_window_activate(Ecore_Wl2_Window* window) {
+  return MOCK_HOOK_P1(ElmMock, ecore_wl2_window_activate, window);
+}
+
+extern "C" void ecore_wl2_window_iconified_set(
+    Ecore_Wl2_Window *win, Eina_Bool flag) {
+  return MOCK_HOOK_P2(ElmMock, ecore_wl2_window_iconified_set, win, flag);
+}
diff --git a/test/unit_tests/mock/elm_mock.h b/test/unit_tests/mock/elm_mock.h
new file mode 100644 (file)
index 0000000..12636e1
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2021 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 UNIT_TESTS_MOCK_ELM_MOCK_H_
+#define UNIT_TESTS_MOCK_ELM_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+#include <Ecore_Wl2.h>
+#include <Elementary.h>
+
+#include "mock/module_mock.h"
+
+class ElmMock : public virtual ModuleMock {
+ public:
+  ElmMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+    using ::testing::Return;
+
+    ON_CALL(*this, elm_init(_, _))
+      .WillByDefault(Invoke([&](int argc, char **argv) -> int {
+        loop_ = g_main_loop_new(NULL, FALSE);
+        return 0;
+      }));
+    ON_CALL(*this, elm_shutdown())
+      .WillByDefault(Invoke([&]() -> int {
+        if (loop_)
+          g_main_loop_unref(loop_);
+        return 0;
+      }));
+    ON_CALL(*this, elm_run())
+      .WillByDefault(Invoke([&]() {
+        if (loop_)
+          g_main_loop_run(loop_);
+      }));
+    ON_CALL(*this, elm_exit())
+      .WillByDefault(Invoke([&]() {
+        if (loop_)
+          g_main_loop_quit(loop_);
+      }));
+    ON_CALL(*this, ecore_wl2_connected_display_get(_))
+      .WillByDefault(Invoke([&](const char*) -> Ecore_Wl2_Display* {
+        static int dummy;
+        return reinterpret_cast<Ecore_Wl2_Display*>(&dummy);
+      }));
+    ON_CALL(*this, ecore_wl2_display_window_find(_, _))
+      .WillByDefault(Invoke([&](Ecore_Wl2_Display*, unsigned int)
+          -> Ecore_Wl2_Window* {
+        static int dummy;
+        return reinterpret_cast<Ecore_Wl2_Window*>(&dummy);
+      }));
+    ON_CALL(*this, evas_object_evas_get(_))
+      .WillByDefault(Invoke([&](const Eo*)
+          -> Evas* {
+        static int dummy;
+        return reinterpret_cast<Evas*>(&dummy);
+      }));
+    ON_CALL(*this, ecore_evas_ecore_evas_get(_))
+      .WillByDefault(Invoke([&](const Evas*)
+          -> Ecore_Evas* {
+        static int dummy;
+        return reinterpret_cast<Ecore_Evas*>(&dummy);
+      }));
+    ON_CALL(*this, ecore_evas_wayland2_window_get(_))
+      .WillByDefault(Invoke([&](const Ecore_Evas*)
+          -> Ecore_Wl2_Window* {
+        static int dummy;
+        return reinterpret_cast<Ecore_Wl2_Window*>(&dummy);
+      }));
+    ON_CALL(*this, ecore_wl2_window_id_get(_))
+      .WillByDefault(Return(1));
+  }
+
+  MOCK_METHOD2(elm_init, int (int, char**));
+  MOCK_METHOD0(elm_shutdown, int ());
+  MOCK_METHOD0(elm_run, void ());
+  MOCK_METHOD0(elm_exit, void ());
+  MOCK_METHOD1(elm_config_accel_preference_set, void (const char*));
+  MOCK_METHOD0(elm_cache_all_flush, void ());
+  MOCK_METHOD1(evas_object_del, void (Evas_Object*));
+  MOCK_METHOD1(evas_object_evas_get, Evas* (const Eo*));
+  MOCK_METHOD1(ecore_evas_wayland2_window_get,
+      Ecore_Wl2_Window* (const Ecore_Evas*));
+  MOCK_METHOD1(ecore_wl2_window_id_get, int (Ecore_Wl2_Window*));
+  MOCK_METHOD1(ecore_evas_ecore_evas_get, Ecore_Evas* (const Evas*));
+  MOCK_METHOD2(elm_win_util_standard_add,
+      Evas_Object* (const char*, const char*));
+  MOCK_METHOD1(ecore_wl2_connected_display_get,
+      Ecore_Wl2_Display* (const char*));
+  MOCK_METHOD2(ecore_wl2_display_window_find,
+      Ecore_Wl2_Window* (Ecore_Wl2_Display*, unsigned int));
+
+  MOCK_METHOD1(ecore_wl2_window_activate, void (Ecore_Wl2_Window*));
+  MOCK_METHOD2(ecore_wl2_window_iconified_set,
+      void (Ecore_Wl2_Window*, Eina_Bool));
+
+ private:
+  GMainLoop* loop_ = nullptr;
+};
+
+#endif  // UNIT_TESTS_MOCK_ELM_MOCK_H_
+
diff --git a/test/unit_tests/mock/frame_component_callback_mock.cc b/test/unit_tests/mock/frame_component_callback_mock.cc
new file mode 100644 (file)
index 0000000..78790eb
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/frame_component_callback_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace {
+
+Evas_Object* __frame_component_create_cb(component_h context,
+    void* user_data) {
+  return MOCK_HOOK_P2(FrameComponentCallbackMock, frame_component_create_cb,
+      context, user_data);
+}
+
+void __frame_component_start_cb(component_h context,
+    app_control_h app_control, bool restarted, void* user_data) {
+  MOCK_HOOK_P4(FrameComponentCallbackMock, frame_component_start_cb,
+      context, app_control, restarted, user_data);
+}
+
+void __frame_component_resume_cb(component_h context,
+    void* user_data) {
+  MOCK_HOOK_P2(FrameComponentCallbackMock, frame_component_resume_cb,
+      context, user_data);
+}
+
+void __frame_component_pause_cb(component_h context,
+    void* user_data) {
+  MOCK_HOOK_P2(FrameComponentCallbackMock, frame_component_pause_cb,
+      context, user_data);
+}
+
+void __frame_component_stop_cb(component_h context,
+    void* user_data) {
+  MOCK_HOOK_P2(FrameComponentCallbackMock, frame_component_stop_cb,
+      context, user_data);
+}
+
+void __frame_component_destroy_cb(component_h context,
+    void *user_data) {
+  MOCK_HOOK_P2(FrameComponentCallbackMock, frame_component_destroy_cb,
+      context, user_data);
+}
+
+void __frame_component_restore_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_restore_content_cb,
+      context, content, user_data);
+}
+
+void __frame_component_save_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_save_content_cb,
+      context, content, user_data);
+}
+
+void __frame_component_action_cb(component_h context,
+    const char* action, app_control_h app_control, void* user_data) {
+  MOCK_HOOK_P4(FrameComponentCallbackMock, frame_component_action_cb,
+      context, action, app_control, user_data);
+}
+
+void __frame_component_device_orientation_changed_cb(
+    component_h context, component_device_orientation_e orientation,
+    void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_device_orientation_changed_cb,
+      context, orientation, user_data);
+}
+
+void __frame_component_language_changed_cb(component_h context,
+    const char* language, void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_language_changed_cb,
+      context, language, user_data);
+}
+
+void __frame_component_region_format_changed_cb(component_h context,
+    const char* region, void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_region_format_changed_cb,
+      context, region, user_data);
+}
+
+void __frame_component_low_battery_cb(component_h context,
+    component_low_battery_status_e status, void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_low_battery_cb,
+    context, status, user_data);
+}
+
+void __frame_component_low_memory_cb(component_h context,
+    component_low_memory_status_e status, void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_low_memory_cb,
+    context, status, user_data);
+}
+
+void __frame_component_suspended_state_changed_cb(component_h context,
+    component_suspended_state_e state, void* user_data) {
+  MOCK_HOOK_P3(FrameComponentCallbackMock, frame_component_suspended_state_changed_cb,
+    context, state, user_data);
+}
+
+}  // namespace
+
+frame_component_lifecycle_callback_s FrameComponentCallbackMock::GetCallbacks() {
+  frame_component_lifecycle_callback_s callback;
+  callback.create =
+      __frame_component_create_cb;
+  callback.start =
+      __frame_component_start_cb;
+  callback.resume =
+      __frame_component_resume_cb;
+  callback.pause =
+      __frame_component_pause_cb;
+  callback.stop =
+      __frame_component_stop_cb;
+  callback.destroy =
+      __frame_component_destroy_cb;
+  callback.restore_content =
+      __frame_component_restore_content_cb;
+  callback.save_content =
+      __frame_component_save_content_cb;
+  callback.action =
+      __frame_component_action_cb;
+  callback.device_orientation_changed =
+      __frame_component_device_orientation_changed_cb;
+  callback.language_changed =
+      __frame_component_language_changed_cb;
+  callback.region_format_changed =
+      __frame_component_region_format_changed_cb;
+  callback.low_battery =
+      __frame_component_low_battery_cb;
+  callback.low_memory =
+      __frame_component_low_memory_cb;
+  callback.suspended_state_changed =
+      __frame_component_suspended_state_changed_cb;
+
+  return callback;
+}
diff --git a/test/unit_tests/mock/frame_component_callback_mock.h b/test/unit_tests/mock/frame_component_callback_mock.h
new file mode 100644 (file)
index 0000000..3142b28
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2021 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 MOCK_FRAME_COMPONENT_CALLBACK_MOCK_H_
+#define MOCK_FRAME_COMPONENT_CALLBACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/efl_base/api/frame_component.h"
+#include "mock/module_mock.h"
+
+class FrameComponentCallbackMock : public virtual ModuleMock {
+ public:
+  FrameComponentCallbackMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+
+    ON_CALL(*this, frame_component_create_cb(_, _))
+      .WillByDefault(Invoke([&](component_h context, void* user_data)
+          -> Evas_Object* {
+        static int dummy;
+        auto* win = reinterpret_cast<Evas_Object*>(&dummy);
+        return win;
+      }));
+  }
+
+  frame_component_lifecycle_callback_s GetCallbacks();
+
+  MOCK_METHOD2(frame_component_create_cb, Evas_Object* (component_h, void*));
+  MOCK_METHOD4(frame_component_start_cb, void (component_h, app_control_h,
+      bool, void*));
+  MOCK_METHOD2(frame_component_resume_cb, void (component_h, void*));
+  MOCK_METHOD2(frame_component_pause_cb, void (component_h, void*));
+  MOCK_METHOD2(frame_component_stop_cb, void (component_h, void*));
+  MOCK_METHOD2(frame_component_destroy_cb, void (component_h, void*));
+  MOCK_METHOD3(frame_component_restore_content_cb, void (component_h, bundle*, void*));
+  MOCK_METHOD3(frame_component_save_content_cb, void (component_h, bundle*, void*));
+  MOCK_METHOD4(frame_component_action_cb, void (component_h, const char*,
+      app_control_h, void*));
+  MOCK_METHOD3(frame_component_device_orientation_changed_cb,
+      void (component_h, component_device_orientation_e, void*));
+  MOCK_METHOD3(frame_component_language_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(frame_component_region_format_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(frame_component_low_battery_cb,
+      void (component_h, component_low_battery_status_e, void*));
+  MOCK_METHOD3(frame_component_low_memory_cb,
+      void (component_h, component_low_memory_status_e, void*));
+  MOCK_METHOD3(frame_component_suspended_state_changed_cb,
+      void (component_h, component_suspended_state_e, void*));
+};
+
+#endif  // MOCK_FRAME_COMPONENT_CALLBACK_MOCK_H_
+
diff --git a/test/unit_tests/mock/mock_hook.h b/test/unit_tests/mock/mock_hook.h
new file mode 100644 (file)
index 0000000..4a77577
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2021 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 MOCK_MOCK_HOOK_H_
+#define MOCK_MOCK_HOOK_H_
+
+#define MOCK_HOOK_P0(MOCK_CLASS, f)                                            \
+    TestFixture::GetMock<MOCK_CLASS>().f()
+#define MOCK_HOOK_P1(MOCK_CLASS, f, p1)                                        \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1)
+#define MOCK_HOOK_P2(MOCK_CLASS, f, p1, p2)                                    \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2)
+#define MOCK_HOOK_P3(MOCK_CLASS, f, p1, p2, p3)                                \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3)
+#define MOCK_HOOK_P4(MOCK_CLASS, f, p1, p2, p3, p4)                            \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4)
+#define MOCK_HOOK_P5(MOCK_CLASS, f, p1, p2, p3, p4, p5)                        \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5)
+#define MOCK_HOOK_P6(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6)                    \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6)
+#define MOCK_HOOK_P7(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7)                \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6, p7)
+#define MOCK_HOOK_P8(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8)            \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6, p7, p8)
+#define MOCK_HOOK_P10(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)  \
+    TestFixture::GetMock<MOCK_CLASS>().f(                                      \
+        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
+
+#endif  // MOCK_MOCK_HOOK_H_
diff --git a/test/unit_tests/mock/module_mock.h b/test/unit_tests/mock/module_mock.h
new file mode 100644 (file)
index 0000000..1b7b73e
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2021 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 MOCK_MODULE_MOCK_H_
+#define MOCK_MODULE_MOCK_H_
+
+class ModuleMock {
+ public:
+  virtual ~ModuleMock() {}
+};
+
+#endif  // MOCK_MODULE_MOCK_H_
diff --git a/test/unit_tests/mock/service_component_callback_mock.cc b/test/unit_tests/mock/service_component_callback_mock.cc
new file mode 100644 (file)
index 0000000..9cfb8ef
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2021 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 <glib.h>
+
+#include "mock/service_component_callback_mock.h"
+#include "mock/mock_hook.h"
+#include "mock/test_fixture.h"
+
+namespace {
+
+bool __service_component_create_cb(component_h context,
+    void* user_data) {
+  return MOCK_HOOK_P2(ServiceComponentCallbackMock, service_component_create_cb,
+      context, user_data);
+}
+
+void __service_component_start_command_cb(component_h context,
+    app_control_h app_control, bool restarted, void* user_data) {
+  MOCK_HOOK_P4(ServiceComponentCallbackMock, service_component_start_command_cb,
+      context, app_control, restarted, user_data);
+}
+
+void __service_component_destroy_cb(component_h context,
+    void *user_data) {
+  MOCK_HOOK_P2(ServiceComponentCallbackMock, service_component_destroy_cb,
+      context, user_data);
+}
+
+void __service_component_restore_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_restore_content_cb,
+      context, content, user_data);
+}
+
+void __service_component_save_content_cb(component_h context,
+    bundle* content, void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_save_content_cb,
+      context, content, user_data);
+}
+
+void __service_component_action_cb(component_h context,
+    const char* action, app_control_h app_control, void* user_data) {
+  MOCK_HOOK_P4(ServiceComponentCallbackMock, service_component_action_cb,
+      context, action, app_control, user_data);
+}
+
+void __service_component_device_orientation_changed_cb(
+    component_h context, component_device_orientation_e orientation,
+    void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_device_orientation_changed_cb,
+      context, orientation, user_data);
+}
+
+void __service_component_language_changed_cb(component_h context,
+    const char* language, void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_language_changed_cb,
+    context, language, user_data);
+}
+
+void __service_component_region_format_changed_cb(component_h context,
+    const char* region, void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_region_format_changed_cb,
+    context, region, user_data);
+}
+
+void __service_component_low_battery_cb(component_h context,
+    component_low_battery_status_e status, void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_low_battery_cb,
+    context, status, user_data);
+}
+
+void __service_component_low_memory_cb(component_h context,
+    component_low_memory_status_e status, void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_low_memory_cb,
+    context, status, user_data);
+}
+
+void __service_component_suspended_state_changed_cb(component_h context,
+    component_suspended_state_e state, void* user_data) {
+  MOCK_HOOK_P3(ServiceComponentCallbackMock, service_component_suspended_state_changed_cb,
+    context, state, user_data);
+}
+
+}  // namespace
+
+service_component_lifecycle_callback_s ServiceComponentCallbackMock::GetCallbacks() {
+  service_component_lifecycle_callback_s callback;
+  callback.create =
+    __service_component_create_cb;
+  callback.start_command =
+    __service_component_start_command_cb;
+  callback.destroy =
+    __service_component_destroy_cb;
+  callback.restore_content =
+    __service_component_restore_content_cb;
+  callback.save_content =
+    __service_component_save_content_cb;
+  callback.action =
+    __service_component_action_cb;
+  callback.device_orientation_changed =
+    __service_component_device_orientation_changed_cb;
+  callback.language_changed =
+    __service_component_language_changed_cb;
+  callback.region_format_changed =
+    __service_component_region_format_changed_cb;
+  callback.low_battery =
+    __service_component_low_battery_cb;
+  callback.low_memory =
+    __service_component_low_memory_cb;
+  callback.suspended_state_changed =
+    __service_component_suspended_state_changed_cb;
+
+  return callback;
+}
diff --git a/test/unit_tests/mock/service_component_callback_mock.h b/test/unit_tests/mock/service_component_callback_mock.h
new file mode 100644 (file)
index 0000000..1e9fd21
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2021 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 MOCK_SERVICE_COMPONENT_CALLBACK_MOCK_H_
+#define MOCK_SERVICE_COMPONENT_CALLBACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <glib.h>
+
+#include "component_based/efl_base/api/service_component.h"
+#include "mock/module_mock.h"
+
+class ServiceComponentCallbackMock : public virtual ModuleMock {
+ public:
+  ServiceComponentCallbackMock() {
+    using ::testing::_;
+    using ::testing::Invoke;
+    using ::testing::Return;
+
+    ON_CALL(*this, service_component_create_cb(_, _))
+      .WillByDefault(Return(true));
+  }
+
+  service_component_lifecycle_callback_s GetCallbacks();
+
+  MOCK_METHOD2(service_component_create_cb, bool (component_h, void*));
+  MOCK_METHOD4(service_component_start_command_cb, void (component_h, app_control_h,
+      bool, void*));
+  MOCK_METHOD2(service_component_destroy_cb, void (component_h, void*));
+  MOCK_METHOD3(service_component_restore_content_cb, void (component_h, bundle*, void*));
+  MOCK_METHOD3(service_component_save_content_cb, void (component_h, bundle*, void*));
+  MOCK_METHOD4(service_component_action_cb, void (component_h, const char*,
+      app_control_h, void*));
+  MOCK_METHOD3(service_component_device_orientation_changed_cb,
+      void (component_h, component_device_orientation_e, void*));
+  MOCK_METHOD3(service_component_language_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(service_component_region_format_changed_cb,
+      void (component_h, const char*, void*));
+  MOCK_METHOD3(service_component_low_battery_cb,
+      void (component_h, component_low_battery_status_e, void*));
+  MOCK_METHOD3(service_component_low_memory_cb,
+      void (component_h, component_low_memory_status_e, void*));
+  MOCK_METHOD3(service_component_suspended_state_changed_cb,
+      void (component_h, component_suspended_state_e, void*));
+};
+
+#endif  // MOCK_SERVICE_COMPONENT_CALLBACK_MOCK_H_
+
diff --git a/test/unit_tests/mock/test_fixture.cc b/test/unit_tests/mock/test_fixture.cc
new file mode 100644 (file)
index 0000000..8abae0c
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2021 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 "test_fixture.h"
+
+#include <memory>
+
+std::unique_ptr<ModuleMock> TestFixture::mock_;
diff --git a/test/unit_tests/mock/test_fixture.h b/test/unit_tests/mock/test_fixture.h
new file mode 100644 (file)
index 0000000..1bd48c9
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2021 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 MOCK_TEST_FIXTURE_H_
+#define MOCK_TEST_FIXTURE_H_
+
+#include <gtest/gtest.h>
+
+#include <memory>
+#include <stdexcept>
+#include <string>
+#include <utility>
+
+#include "module_mock.h"
+
+class TestFixture : public ::testing::Test {
+ public:
+  explicit TestFixture(std::unique_ptr<ModuleMock>&& mock) {
+    mock_ = std::move(mock);
+  }
+  virtual ~TestFixture() {
+    mock_.reset();
+  }
+
+  virtual void SetUp() {}
+  virtual void TearDown() {}
+
+  template <typename T>
+  static T& GetMock() {
+    auto ptr = dynamic_cast<T*>(mock_.get());
+    if (!ptr)
+      throw std::invalid_argument("The test does not provide mock of \"" +
+          std::string(typeid(T).name()) + "\"");
+    return *ptr;
+  }
+
+  static std::unique_ptr<ModuleMock> mock_;
+};
+
+#endif  // MOCK_TEST_FIXTURE_H_
diff --git a/test/unit_tests/test_component_based_app_control.cc b/test/unit_tests/test_component_based_app_control.cc
new file mode 100644 (file)
index 0000000..ea9bc82
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2019 - 2021 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 <gtest/gtest.h>
+
+#include <iostream>
+#include <memory>
+
+#include "component_based/app_control/component_based_app_control.h"
+
+static const char ENCODED_URI[] = "https:%2F%2Fjohn.doe%40www.example.com%3A123%2Fforum%2Fquestions%2F?tag=networking&order=newest#top";
+static const char MIME_TYPE[] = "application/octet-stream";
+
+class AppControlTest : public testing::Test {
+ public:
+  virtual void SetUp() { }
+  virtual void TearDown() {}
+};
+
+TEST_F(AppControlTest, AppControl_Builder) {
+  std::unique_ptr<component_based::AppControl::Builder> builder(
+      new component_based::AppControl::Builder());
+  EXPECT_NE(builder, nullptr);
+
+  builder->SetAppID("org.tizen.helloworld");
+  builder->SetOperation(APP_CONTROL_OPERATION_DEFAULT);
+  builder->SetLaunchMode(component_based::AppControl::LaunchMode::SINGLE);
+
+  component_based::Uri uri(ENCODED_URI);
+  builder->SetUri(uri);
+  builder->SetMime(MIME_TYPE);
+  builder->AddExtra("key", "value");
+  builder->SetComponentID("ElmFrame");
+
+  component_based::AppControl ctrl = builder->Build();
+  EXPECT_EQ(ctrl.GetAppID(), "org.tizen.helloworld");
+  EXPECT_EQ(ctrl.GetOperation(), APP_CONTROL_OPERATION_DEFAULT);
+  EXPECT_EQ(ctrl.GetLaunchMode(),
+      component_based::AppControl::LaunchMode::SINGLE);
+  EXPECT_EQ(ctrl.GetUri().Encode(), ENCODED_URI);
+  EXPECT_EQ(ctrl.GetMime(), MIME_TYPE);
+  EXPECT_EQ(ctrl.GetExtra("key"), "value");
+  EXPECT_EQ(ctrl.GetComponentID(), "ElmFrame");
+}
+
+TEST_F(AppControlTest, AppControl_Constructor) {
+  std::unique_ptr<component_based::AppControl::Builder> builder(
+      new component_based::AppControl::Builder());
+  EXPECT_NE(builder, nullptr);
+
+  builder->SetAppID("org.tizen.helloworld");
+  builder->SetOperation(APP_CONTROL_OPERATION_DEFAULT);
+  builder->SetLaunchMode(component_based::AppControl::LaunchMode::SINGLE);
+
+  component_based::Uri uri(ENCODED_URI);
+  builder->SetUri(uri);
+  builder->SetMime(MIME_TYPE);
+  builder->AddExtra("key", "value");
+  builder->SetComponentID("ElmFrame");
+
+  component_based::AppControl ctrl = builder->Build();
+
+  component_based::AppControl ctrl1(ctrl);
+  ctrl1 = ctrl;
+  component_based::AppControl ctrl3(std::move(ctrl));
+  ctrl3 = std::move(ctrl);
+}
diff --git a/test/unit_tests/test_component_based_uri.cc b/test/unit_tests/test_component_based_uri.cc
new file mode 100644 (file)
index 0000000..fe14431
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2019 - 2021 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 <gtest/gtest.h>
+
+#include <iostream>
+#include <memory>
+
+#include "component_based/uri/component_based_uri.h"
+
+// The source of the following example is "https://en.wikipedia.org/wiki/Uniform_Resource_Identifier"
+static const char EXAM_URI1[] = "https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top";
+static const char EXAM_URI2[] = "ldap://[2001:db8::7]/c=GB?objectClass?one";
+static const char EXAM_URI3[] = "mailto:John.Doe@example.com";
+static const char EXAM_URI4[] = "news:comp.infosystems.www.servers.unix";
+static const char EXAM_URI5[] = "tel:+1-816-555-1212";
+static const char EXAM_URI6[] = "telnet://192.0.2.16:80/";
+static const char EXAM_URI7[] = "urn:oasis:names:specification:docbook:dtd:xml:4.1.2";
+
+static const char ENCODED_URI1[] = "https:%2F%2Fjohn.doe%40www.example.com%3A123%2Fforum%2Fquestions%2F?tag=networking&order=newest#top";
+static const char ENCODED_URI2[] = "ldap:%2F%2F%5B2001%3Adb8%3A%3A7%5D%2Fc%3DGB?objectClass?one";
+static const char ENCODED_URI3[] = "mailto:John.Doe%40example.com";
+static const char ENCODED_URI4[] = "news:comp.infosystems.www.servers.unix";
+static const char ENCODED_URI5[] = "tel:%2B1-816-555-1212";
+static const char ENCODED_URI6[] = "telnet:%2F%2F192.0.2.16%3A80%2F";
+static const char ENCODED_URI7[] = "urn:oasis%3Anames%3Aspecification%3Adocbook%3Adtd%3Axml%3A4.1.2";
+
+extern int gargc;
+extern char** gargv;
+
+class UriTest : public testing::Test {
+ public:
+  virtual ~UriTest() {}
+
+  virtual void SetUp() {
+    std::string exam_uri[] = {
+      ENCODED_URI1,
+      ENCODED_URI2,
+      ENCODED_URI3,
+      ENCODED_URI4,
+      ENCODED_URI5,
+      ENCODED_URI6,
+      ENCODED_URI7,
+    };
+
+    for (int i = 0; i < 7; i++) {
+      uri_list_[i] = std::unique_ptr<component_based::Uri>(
+          new component_based::Uri(exam_uri[i]));
+    }
+  }
+
+  virtual void TearDown() {}
+
+  std::unique_ptr<component_based::Uri> uri_list_[7];
+};
+
+/*
+ * @testcase Uri_Constructor
+ * @description Creates a Uri object.
+ * @apicovered component_based::Uri
+ */
+TEST_F(UriTest, Uri_Constructor) {
+  std::unique_ptr<component_based::Uri> uri =
+      std::unique_ptr<component_based::Uri>(
+          new component_based::Uri(ENCODED_URI1));
+  EXPECT_NE(uri, nullptr);
+}
+
+/*
+ * @testcase Uri_GetScheme
+ * @description Gets a scheme component from a URI object.
+ * @apicovered component_based::Uri::GetScheme
+ */
+TEST_F(UriTest, Uri_GetScheme) {
+  std::string exam_scheme[] = {
+    "https",
+    "ldap",
+    "mailto",
+    "news",
+    "tel",
+    "telnet",
+    "urn",
+  };
+
+  for (int i = 0; i < 7; i++) {
+    EXPECT_EQ(uri_list_[i]->GetScheme(), exam_scheme[i]);
+  }
+}
+
+/*
+ * @testcase Uri_GetAuthority
+ * @description Gets an authority component from a URI object.
+ * @apicovered component_based::Uri::GetAuthority
+ */
+TEST_F(UriTest, Uri_GetAuthority) {
+  std::string exam_auth[] = {
+    "//john.doe@www.example.com:123",
+    "//[2001:db8::7]",
+    "",
+    "",
+    "",
+    "//192.0.2.16:80",
+    "",
+  };
+
+  for (int i = 0; i < 7; i++) {
+    EXPECT_EQ(uri_list_[i]->GetAuthority(), exam_auth[i]);
+  }
+}
+
+/*
+ * @testcase Uri_GetPath
+ * @description Gets a path component from a URI object.
+ * @apicovered component_based::Uri::GetPath
+ */
+TEST_F(UriTest, Uri_GetPath) {
+  std::string exam_path[] = {
+    "/forum/questions/",
+    "/c=GB",
+    "John.Doe@example.com",
+    "comp.infosystems.www.servers.unix",
+    "+1-816-555-1212",
+    "/",
+    "oasis:names:specification:docbook:dtd:xml:4.1.2",
+  };
+
+  for (int i = 0; i < 7; i++) {
+    EXPECT_EQ(uri_list_[i]->GetPath(), exam_path[i]);
+  }
+}
+
+/*
+ * @testcase Uri_GetFragment
+ * @description Gets a fragment component from a URI object.
+ * @apicovered component_based::Uri::GetFragment
+ */
+TEST_F(UriTest, Uri_GetFragment) {
+  std::string exam_fragment[] = {
+    "top",
+    "",
+    "",
+    "",
+    "",
+    "",
+    "",
+  };
+
+  for (int i = 0; i < 7; i++) {
+    EXPECT_EQ(uri_list_[i]->GetFragment(), exam_fragment[i]);
+  }
+}
+
+/*
+ * @testcase Uri_GetHost
+ * @description Gets a host subcomponent from a URI object.
+ * @apicovered component_based::Uri::GetHost
+ */
+TEST_F(UriTest, Uri_GetHost) {
+  std::string exam_host[] = {
+    "www.example.com",
+    "[2001:db8::7]",
+    "",
+    "",
+    "",
+    "192.0.2.16",
+    "",
+  };
+
+  for (int i = 0; i < 7; i++) {
+    EXPECT_EQ(uri_list_[i]->GetHost(), exam_host[i]);
+  }
+}
+
+/*
+ * @testcase Uri_GetPort
+ * @description Gets a port subcomponent from a URI object.
+ * @apicovered component_based::Uri::GetPort
+ */
+TEST_F(UriTest, Uri_GetPort) {
+  std::string exam_port[] = {
+    "123",
+    "",
+    "",
+    "",
+    "",
+    "80",
+    "",
+  };
+
+  for (int i = 0; i < 7; i++) {
+    EXPECT_EQ(uri_list_[i]->GetPort(), exam_port[i]);
+  }
+}
+
+/*
+ * @testcase Uri_GetUser
+ * @description Gets a user subcomponent from a URI object.
+ * @apicovered component_based::Uri::GetUser
+ */
+TEST_F(UriTest, Uri_GetUser) {
+  std::string exam_user[] = {
+    "john.doe",
+    "",
+    "",
+    "",
+    "",
+    "",
+    "",
+  };
+
+  for (int i = 0; i < 7; i++) {
+    EXPECT_EQ(uri_list_[i]->GetUser(), exam_user[i]);
+  }
+}
+
+/*
+ * @testcase Uri_GetQuery
+ * @description Gets a query component from a URI object.
+ * @apicovered component_based::Uri::GetQuery
+ */
+TEST_F(UriTest, Uri_GetQuery) {
+  int match_count = 0;
+  auto& query = uri_list_[0]->GetQuery();
+  for (auto& q : query) {
+    if (q.GetKey() == "tag" &&
+        q.GetValue() == "networking") {
+      match_count++;
+    } else if (q.GetKey() == "order" &&
+               q.GetValue() == "newest") {
+      match_count++;
+    }
+  }
+
+  EXPECT_EQ(match_count, 2);
+}
+
+/*
+ * @testcase Uri_Encode
+ * @description Encodes a URI object to string.
+ * @apicovered component_base::Uri::Encode
+ */
+TEST_F(UriTest, Uri_Encode) {
+  std::unique_ptr<component_based::Uri> uri =
+      std::unique_ptr<component_based::Uri>(
+          new component_based::Uri(EXAM_URI1));
+  EXPECT_NE(uri, nullptr);
+  EXPECT_EQ(uri->Encode(), ENCODED_URI1);
+}
+
+/*
+ * @testcase Uri_Builder
+ * @description Builds a URI builder object to create a URI object.
+ * @apicovered component_based::Uri::Builder,
+ *             component_based::Uri::Builder::SetScheme,
+ *             component_based::Uri::Builder::SetAuthority,
+ *             component_based::Uri::Builder::SetPath,
+ *             component_based::Uri::Builder::AddQuery,
+ *             component_based::Uri::Builder::SetFragment,
+ *             component_based::Uri::Builder::Build
+ */
+TEST_F(UriTest, Uri_Builder) {
+  std::unique_ptr<component_based::Uri::Builder> builder(
+      new component_based::Uri::Builder());
+  EXPECT_NE(builder, nullptr);
+  builder->SetScheme("https");
+  builder->SetAuthority("//john.doe@www.example.com:123");
+  builder->SetPath("/forum");
+  builder->AddPath("questions/");
+  builder->AddQuery("tag", "networking");
+  builder->AddQuery("order", "newest");
+  builder->SetFragment("top");
+
+  component_based::Uri uri = builder->Build();
+  EXPECT_EQ(uri.Encode(), ENCODED_URI1);
+}
diff --git a/test/unit_tests/test_main.cc b/test/unit_tests/test_main.cc
new file mode 100644 (file)
index 0000000..6406295
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2019 - 2021 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#define LOG_INTERNAL
+
+#ifdef LOG_INTERNAL
+#include <dlog.h>
+
+extern "C" int __dlog_print(log_id_t log_id, int prio, const char* tag,
+    const char* fmt, ...) {
+  printf("%s:", tag);
+  va_list ap;
+  va_start(ap, fmt);
+  vprintf(fmt, ap);
+  va_end(ap);
+  printf("\n");
+
+  return 0;
+}
+#endif
+
+
+int main(int argc, char** argv) {
+  int ret = -1;
+  try {
+    testing::InitGoogleTest(&argc, argv);
+  } catch(...) {
+    std::cout << "Exception occurred" << std::endl;
+  }
+
+  try {
+    ret = RUN_ALL_TESTS();
+  } catch (const ::testing::internal::GoogleTestFailureException& e) {
+    ret = -1;
+    std::cout << "GoogleTestFailureException was thrown:" << e.what() <<
+        std::endl;
+  }
+
+  return ret;
+}
diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt
deleted file mode 100644 (file)
index 41f1209..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(component-based_unittests CXX)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(component-based_unittests REQUIRED
-    glib-2.0
-    dlog
-    gmock
-    ecore-wl2
-    appcore-multiwindow
-    capi-appfw-app-control
-    capi-appfw-app-common
-    aul
-    elementary
-    widget_service
-    screen_connector_provider
-)
-
-FOREACH(flag ${component-based_unittests_CFLAGS})
-    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/base)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/base/api)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/uri)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/app_control)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/efl_base)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/efl_base/api)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mock)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../component-based)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../mock UNIT_TEST_SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src/base BASE_SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src/efl_base EFL_BASE_SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/efl_base APPLICATION_SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/base CORE_BASE_SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/uri URI_SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../component_based/app_control APP_CONTROL_SOURCES)
-
-ADD_EXECUTABLE(${PROJECT_NAME}
-    ${APPLICATION_SOURCES}
-    ${APP_CONTROL_SOURCES}
-    ${URI_SOURCES}
-    ${CORE_BASE_SOURCES}
-    ${UNIT_TEST_SOURCES}
-    ${SOURCES}
-    ${BASE_SOURCES}
-    ${EFL_BASE_SOURCES}
-)
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${component-based_unittests_LDFLAGS})
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
diff --git a/unit_tests/src/base/test_base_base_stub.cc b/unit_tests/src/base/test_base_base_stub.cc
deleted file mode 100644 (file)
index ba966bf..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-
-#include <iostream>
-#include <memory>
-
-#include "component_based/base/api/component_based_app_base.h"
-#include "component_based/base/api/base_component.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_app_control.h"
-#include "mock/mock_appcore_multiwindow_base.h"
-#include "mock/mock_aul.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-static appcore_multiwindow_base_ops __ops;
-static int __argc;
-static char** __argv;
-static void* __user_data;
-static appcore_multiwindow_base_class __cls;
-static appcore_base_event_cb __event_cb[APPCORE_BASE_EVENT_MAX];
-static void* __event_data[APPCORE_BASE_EVENT_MAX];
-
-static int __fake_aul_comp_notify_start(const char *id) {
-  return 0;
-}
-
-static int __fake_aul_comp_status_update(const char *id, int status) {
-  return 0;
-}
-
-static void __generate_system_event(void)
-{
-  char lang[] = "en-US";
-  int intval = 1;
-  void* event;
-
-  for (int i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
-    if (i == APPCORE_BASE_EVENT_LANG_CHANGE ||
-        i == APPCORE_BASE_EVENT_REGION_CHANGE) {
-      event = static_cast<void*>(lang);
-    } else {
-      event = static_cast<void*>(&intval);
-    }
-
-    if (__event_cb[i]) {
-      __event_cb[i](event, __event_data[i]);
-    }
-  }
-}
-
-static int __fake_appcore_multiwindow_base_init(
-    appcore_multiwindow_base_ops ops,
-    int argc,
-    char** argv,
-    void* user_data) {
-  __ops = ops;
-  __argc = argc;
-  __argv = argv;
-  __user_data = user_data;
-
-  __ops.base.init(__argc, __argv, __user_data);
-  __ops.base.create(__user_data);
-  __ops.base.run(__user_data);
-
-  bundle* b = bundle_create();
-  bundle_add_str(b, AUL_K_COMPONENT_ID, "test-base-component");
-  bundle_add_str(b, AUL_K_INSTANCE_ID, "@test-base-component");
-  bundle_add_str(b, AUL_K_NEW_INSTANCE, "true");
-  std::unique_ptr<bundle, decltype(bundle_free)*> ptr(b, bundle_free);
-
-  __ops.base.receive(AUL_START, b, __user_data);
-
-  __generate_system_event();
-
-  __ops.base.control(b, __user_data);
-
-  __ops.base.receive(AUL_RESUME, b, __user_data);
-  __ops.base.receive(AUL_PAUSE, b, __user_data);
-
-  __ops.base.receive(AUL_WAKE, b, __user_data);
-  __ops.base.receive(AUL_SUSPEND, b, __user_data);
-
-  __ops.base.receive(AUL_TERMINATE_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BG_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BGAPP, b, __user_data);
-
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_fini(void) {
-  __cls.terminate(nullptr, __cls.data);
-
-  __ops.base.terminate(__user_data);
-  __ops.base.finish();
-}
-
-static void __fake_appcore_multiwindow_base_exit(void) {
-  __ops.base.exit(__user_data);
-}
-
-static int __fake_elm_init(int argc, char** argv) {
-  return 0;
-}
-
-static int __fake_elm_shutdown(void) {
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_class_add(
-    appcore_multiwindow_base_class cls) {
-  __cls = cls;
-}
-
-static appcore_multiwindow_base_instance_h
-__fake_appcore_multiwindow_base_instance_run(const char* class_id,
-    const char* id, void* extra)
-{
-  static appcore_multiwindow_base_instance_h inst =
-      reinterpret_cast<appcore_multiwindow_base_instance_h>(&inst);
-
-  __cls.create(inst, __cls.data);
-
-  return inst;
-}
-
-static const char* __fake_appcore_multiwindow_base_instance_get_id(
-    appcore_multiwindow_base_instance_h context) {
-  return "@test-base-component";
-}
-
-static appcore_base_event_h __fake_appcore_base_add_event(
-    enum appcore_base_event type, appcore_base_event_cb cb, void* data) {
-  __event_cb[type] = cb;
-  __event_data[type] = data;
-  return nullptr;
-}
-
-static int __fake_app_control_add_action_handler(const char* action,
-    app_control_action_cb callback, void* user_data,
-    app_control_action_h* handle) {
-  callback(action, nullptr, user_data);
-  return 0;
-}
-
-static int __fake_app_control_send_launch_request_async(
-    app_control_h app_control,
-    app_control_result_cb result_cb,
-    app_control_reply_cb reply_cb,
-    void* user_data) {
-  result_cb(app_control, APP_CONTROL_ERROR_NONE, user_data);
-  reply_cb(app_control, app_control, APP_CONTROL_RESULT_SUCCEEDED, user_data);
-  return 0;
-}
-
-static int __fake_app_control_send_launch_request_sync(
-    app_control_h app_control,
-    app_control_h* reply,
-    app_control_result_e* result) {
-  app_control_h handle = nullptr;
-  app_control_create(&handle);
-  *reply = handle;
-  *result = APP_CONTROL_RESULT_SUCCEEDED;
-  return 0;
-}
-
-class BaseCompStubTest : public ::testing::Test {
- public:
-  virtual void SetUp() {
-    appcore_multiwindow_base_init_fake.custom_fake =
-        __fake_appcore_multiwindow_base_init;
-    appcore_multiwindow_base_fini_fake.custom_fake =
-        __fake_appcore_multiwindow_base_fini;
-    appcore_multiwindow_base_exit_fake.custom_fake =
-        __fake_appcore_multiwindow_base_exit;
-    appcore_multiwindow_base_instance_run_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_run;
-    appcore_multiwindow_base_class_add_fake.custom_fake =
-        __fake_appcore_multiwindow_base_class_add;
-    appcore_multiwindow_base_instance_get_id_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_get_id;
-    appcore_base_add_event_fake.custom_fake =
-        __fake_appcore_base_add_event;
-
-    elm_init_fake.custom_fake =
-        __fake_elm_init;
-    elm_shutdown_fake.custom_fake =
-        __fake_elm_shutdown;
-    aul_comp_notify_start_fake.custom_fake =
-        __fake_aul_comp_notify_start;
-    aul_comp_status_update_fake.custom_fake =
-        __fake_aul_comp_status_update;
-    app_control_add_action_handler_fake.custom_fake =
-        __fake_app_control_add_action_handler;
-    app_control_send_launch_request_async_fake.custom_fake =
-        __fake_app_control_send_launch_request_async;
-    app_control_send_launch_request_sync_fake.custom_fake =
-        __fake_app_control_send_launch_request_sync;
-  }
-
-  virtual void TearDown(){
-  }
-};
-
-static void __base_component_restore_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __base_component_save_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __base_component_device_orientation_changed_cb(
-    component_h context, component_device_orientation_e orientation,
-    void* user_data) {
-}
-
-static void __base_component_language_changed_cb(component_h context,
-    const char* language, void* user_data) {
-}
-
-static void __base_component_region_format_changed_cb(component_h context,
-    const char* region, void* user_data) {
-}
-
-static void __base_component_low_battery_cb(component_h context,
-    component_low_battery_status_e status, void* user_data) {
-}
-
-static void __base_component_low_memory_cb(component_h context,
-    component_low_memory_status_e status, void* user_data) {
-}
-
-static void __base_component_suspended_state_changed_cb(component_h context,
-    component_suspended_state_e state, void* user_data) {
-}
-
-component_class_h base_component_add(component_class_h comp_class,
-               const char *component_id, void *user_data)
-{
-       base_component_lifecycle_callback_s callback = {
-               .restore_content = __base_component_restore_content_cb,
-               .save_content = __base_component_save_content_cb,
-               .device_orientation_changed = __base_component_device_orientation_changed_cb,
-               .language_changed = __base_component_language_changed_cb,
-               .region_format_changed = __base_component_region_format_changed_cb,
-               .low_battery = __base_component_low_battery_cb,
-               .low_memory = __base_component_low_memory_cb,
-               .suspended_state_changed = __base_component_suspended_state_changed_cb,
-       };
-
-       return component_based_app_base_add_base_component(comp_class,
-      COMPONENT_TYPE_SERVICE, component_id, &callback, user_data);
-}
-
-void __app_init_cb(int argc, char** argv, void *user_data)
-{
-}
-
-void __app_fini_cb(void *user_data)
-{
-}
-
-void __app_run_cb(void *user_data)
-{
-}
-
-void __app_exit_cb(void *user_data)
-{
-}
-
-component_class_h __app_create_cb(void *user_data)
-{
-       component_class_h comp_class = NULL;
-       comp_class = base_component_add(comp_class,
-                       "test-base-component", NULL);
-
-       return comp_class;
-}
-
-void __app_terminate_cb(void *user_data)
-{
-}
-
-TEST_F(BaseCompStubTest, component_based_app_base_add_base_component)
-{
-  component_based_app_base_lifecycle_callback_s callback = {
-               .init = __app_init_cb,
-               .fini = __app_fini_cb,
-               .run = __app_run_cb,
-               .exit = __app_exit_cb,
-               .create = __app_create_cb,
-               .terminate = __app_terminate_cb
-       };
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  int ret = component_based_app_base_main(argc, argv, &callback, this);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-}
-
-}
\ No newline at end of file
diff --git a/unit_tests/src/base/test_base_frame_stub.cc b/unit_tests/src/base/test_base_frame_stub.cc
deleted file mode 100644 (file)
index 46f2853..0000000
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-
-#include <iostream>
-#include <memory>
-
-#include "component_based/base/api/component_based_app_base.h"
-#include "component_based/base/api/base_component.h"
-#include "component_based/base/api/base_frame_component.h"
-#include "component_based/base/api/base_service_component.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_app_control.h"
-#include "mock/mock_appcore_multiwindow_base.h"
-#include "mock/mock_aul.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-static appcore_multiwindow_base_ops __ops;
-static int __argc;
-static char** __argv;
-static void* __user_data;
-static appcore_multiwindow_base_class __cls;
-static bool __is_resumed;
-static appcore_base_event_cb __event_cb[APPCORE_BASE_EVENT_MAX];
-static void* __event_data[APPCORE_BASE_EVENT_MAX];
-
-static void __generate_show_event(void) {
-  Ecore_Wl2_Event_Window_Show ev = {
-    .win = 1,
-    .parent_win = 1,
-    .event_win = 1,
-    .data = { 1, }
-  };
-  __ops.window.show(ECORE_WL2_EVENT_WINDOW_SHOW, &ev, __user_data);
-}
-
-static void __generate_hide_event(void) {
-  Ecore_Wl2_Event_Window_Hide ev = {
-    .win = 1,
-    .parent_win = 1,
-    .event_win = 1
-  };
-
-  __ops.window.hide(ECORE_WL2_EVENT_WINDOW_HIDE, &ev, __user_data);
-}
-
-static void __generate_lower_event(void) {
-  Ecore_Wl2_Event_Window_Lower ev = {
-    .win = 1,
-    .timestamp = 2
-  };
-
-  __ops.window.lower(ECORE_WL2_EVENT_WINDOW_LOWER, &ev, __user_data);
-}
-
-static void __generate_aux_message(void) {
-  Ecore_Wl2_Event_Aux_Message ev = {
-    .win = 1,
-    .key = "dpms",
-    .val = "on",
-  };
-
-  __ops.window.aux_message(ECORE_WL2_EVENT_AUX_MESSAGE, &ev, __user_data);
-}
-
-static void __generate_pre_visibility_change_event(void) {
-  Ecore_Wl2_Event_Window_Pre_Visibility_Change ev = {
-    .win = 1,
-    .type = ECORE_WL2_WINDOW_VISIBILITY_TYPE_UNOBSCURED,
-  };
-
-  __ops.window.pre_visibility(ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE, &ev,
-      __user_data);
-}
-
-static void __generate_visibility_change_event(int fully_obscured) {
-  Ecore_Wl2_Event_Window_Visibility_Change ev = {
-    .win = 1,
-    .fully_obscured = fully_obscured
-  };
-
-  __ops.window.visibility(ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE,
-      &ev, __user_data);
-}
-
-static void __fake_appcore_multiwindow_base_window_on_visibility(int type,
-    void* event) {
-  Ecore_Wl2_Event_Window_Visibility_Change* ev =
-      static_cast<Ecore_Wl2_Event_Window_Visibility_Change*>(event);
-
-  if (ev->fully_obscured)
-    appcore_multiwindow_base_instance_pause(nullptr);
-  else
-    appcore_multiwindow_base_instance_resume(nullptr);
-}
-
-static int __fake_aul_comp_notify_start(const char *id) {
-  return 0;
-}
-
-static int __fake_aul_comp_status_update(const char *id, int status) {
-  return 0;
-}
-
-static void __generate_system_event(void)
-{
-  char lang[] = "en-US";
-  int intval = 1;
-  void* event;
-
-  for (int i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
-    if (i == APPCORE_BASE_EVENT_LANG_CHANGE ||
-        i == APPCORE_BASE_EVENT_REGION_CHANGE) {
-      event = static_cast<void*>(lang);
-    } else {
-      event = static_cast<void*>(&intval);
-    }
-
-    if (__event_cb[i]) {
-      __event_cb[i](event, __event_data[i]);
-    }
-  }
-}
-
-static int __fake_appcore_multiwindow_base_init(
-    appcore_multiwindow_base_ops ops,
-    int argc,
-    char** argv,
-    void* user_data) {
-  __ops = ops;
-  __argc = argc;
-  __argv = argv;
-  __user_data = user_data;
-
-  __ops.base.init(__argc, __argv, __user_data);
-  __ops.base.create(__user_data);
-  __ops.base.run(__user_data);
-
-  bundle* b = bundle_create();
-  bundle_add_str(b, AUL_K_COMPONENT_ID, "base-frame");
-  bundle_add_str(b, AUL_K_INSTANCE_ID, "@base-frame");
-  bundle_add_str(b, AUL_K_NEW_INSTANCE, "true");
-  std::unique_ptr<bundle, decltype(bundle_free)*> ptr(b, bundle_free);
-
-  __ops.base.receive(AUL_START, b, __user_data);
-  __generate_system_event();
-
-  __ops.base.control(b, __user_data);
-  __generate_show_event();
-
-  __ops.base.receive(AUL_RESUME, b, __user_data);
-  __ops.base.receive(AUL_PAUSE, b, __user_data);
-
-  __generate_hide_event();
-  __generate_lower_event();
-  __generate_aux_message();
-
-  __ops.base.receive(AUL_WAKE, b, __user_data);
-  __ops.base.receive(AUL_SUSPEND, b, __user_data);
-
-  __ops.base.receive(AUL_TERMINATE_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BG_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BGAPP, b, __user_data);
-
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_fini(void) {
-  __cls.terminate(nullptr, __cls.data);
-
-  __ops.base.terminate(__user_data);
-  __ops.base.finish();
-}
-
-static void __fake_appcore_multiwindow_base_exit(void) {
-  __ops.base.exit(__user_data);
-}
-
-static int __fake_elm_init(int argc, char** argv) {
-  return 0;
-}
-
-static int __fake_elm_shutdown(void) {
-  return 0;
-}
-
-static Evas_Object* __fake_elm_win_util_standard_add(const char* name,
-    const char* title) {
-  Evas_Object* win = reinterpret_cast<Evas_Object*>(malloc(sizeof(void*)));
-  return win;
-}
-
-static void __fake_evas_object_del(Evas_Object* object) {
-  free(object);
-}
-
-static void __fake_elm_config_accel_preference_set(const char* pref) {
-}
-
-static void __fake_ecore_wl2_window_activate(Ecore_Wl2_Window* window) {
-  __generate_pre_visibility_change_event();
-  __generate_visibility_change_event(0);
-}
-
-static void __fake_ecore_wl2_window_iconified_set(Ecore_Wl2_Window* window,
-                                                  Eina_Bool iconified) {
-  __generate_visibility_change_event(1);
-}
-
-static int __fake_aul_app_group_lower_v2(const char* id, bool* exit) {
-  *exit = true;
-  return 0;
-}
-
-static int __fake_aul_app_group_set_window_v2(const char* id, int wid) {
-  return 0;
-}
-
-static Ecore_Wl2_Window* __fake_ecore_wl2_display_window_find(
-    Ecore_Wl2_Display* display, unsigned int id) {
-  static int window;
-  return reinterpret_cast<Ecore_Wl2_Window*>(&window);
-}
-
-static void __fake_appcore_multiwindow_base_class_add(
-    appcore_multiwindow_base_class cls) {
-  __cls = cls;
-}
-
-static appcore_multiwindow_base_instance_h
-__fake_appcore_multiwindow_base_instance_run(const char* class_id,
-    const char* id, void* extra)
-{
-  static appcore_multiwindow_base_instance_h inst =
-      reinterpret_cast<appcore_multiwindow_base_instance_h>(&inst);
-  __cls.create(inst, __cls.data);
-
-  return inst;
-}
-
-static const char* __fake_appcore_multiwindow_base_instance_get_id(
-    appcore_multiwindow_base_instance_h context) {
-  return "@base-frame";
-}
-
-static bool __fake_appcore_multiwindow_base_instance_is_resumed(
-    appcore_multiwindow_base_instance_h context) {
-  return __is_resumed;
-}
-
-static void __fake_appcore_multiwindow_base_instance_resume(
-    appcore_multiwindow_base_instance_h context) {
-  if (__is_resumed)
-    return;
-
-  __cls.resume(context, __cls.data);
-  __is_resumed = true;
-}
-
-static void __fake_appcore_multiwindow_base_instance_pause(
-    appcore_multiwindow_base_instance_h context) {
-  if (!__is_resumed)
-    return;
-
-  __cls.pause(context, __cls.data);
-  __is_resumed = false;
-}
-
-appcore_multiwindow_base_instance_h __fake_appcore_multiwindow_base_instance_find(const char* id)
-{
-  typedef struct _appcore_multiwindow_base_instance {
-    unsigned int window_id;
-    char *id;
-    void *extra;
-    appcore_multiwindow_base_class *shell;
-    bool is_resumed;
-  } appcore_multiwindow_base_instance;
-
-  appcore_multiwindow_base_instance *s =
-    (appcore_multiwindow_base_instance*)malloc(sizeof(appcore_multiwindow_base_instance));
-  return s;
-}
-
-static appcore_base_event_h __fake_appcore_base_add_event(
-    enum appcore_base_event type, appcore_base_event_cb cb, void* data) {
-  __event_cb[type] = cb;
-  __event_data[type] = data;
-  return nullptr;
-}
-
-static Ecore_Evas* __fake_ecore_evas_ecore_evas_get(const Evas* evas) {
-  static int ecore_evas;
-  return reinterpret_cast<Ecore_Evas*>(&ecore_evas);
-}
-
-static Evas* __fake_evas_object_evas_get(const Eo* eo) {
-  static int evas;
-  return reinterpret_cast<Evas*>(&evas);
-}
-
-static Ecore_Wl2_Window* __fake_ecore_evas_wayland2_window_get(
-    const Ecore_Evas* ee) {
-  static int wl2_window;
-  return reinterpret_cast<Ecore_Wl2_Window*>(&wl2_window);
-}
-
-static int __fake_ecore_wl2_window_id_get(Ecore_Wl2_Window* window) {
-  return 1;
-}
-
-static int __fake_app_get_display_state(app_display_state_e *state) {
-  *state = APP_DISPLAY_STATE_ON;
-  return 0;
-}
-
-static int __fake_app_control_add_action_handler(const char* action,
-    app_control_action_cb callback, void* user_data,
-    app_control_action_h* handle) {
-  callback(action, nullptr, user_data);
-  return 0;
-}
-
-class BaseStubTest : public ::testing::Test {
- public:
-  virtual void SetUp() {
-    appcore_multiwindow_base_init_fake.custom_fake =
-        __fake_appcore_multiwindow_base_init;
-    appcore_multiwindow_base_fini_fake.custom_fake =
-        __fake_appcore_multiwindow_base_fini;
-    appcore_multiwindow_base_exit_fake.custom_fake =
-        __fake_appcore_multiwindow_base_exit;
-    appcore_multiwindow_base_instance_run_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_run;
-    appcore_multiwindow_base_class_add_fake.custom_fake =
-        __fake_appcore_multiwindow_base_class_add;
-    appcore_multiwindow_base_instance_get_id_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_get_id;
-    appcore_multiwindow_base_instance_is_resumed_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_is_resumed;
-    appcore_multiwindow_base_instance_resume_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_resume;
-    appcore_multiwindow_base_instance_pause_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_pause;
-    appcore_multiwindow_base_window_on_visibility_fake.custom_fake =
-        __fake_appcore_multiwindow_base_window_on_visibility;
-    appcore_multiwindow_base_instance_find_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_find;
-    appcore_base_add_event_fake.custom_fake =
-        __fake_appcore_base_add_event;
-
-    elm_init_fake.custom_fake =
-        __fake_elm_init;
-    elm_shutdown_fake.custom_fake =
-        __fake_elm_shutdown;
-    elm_win_util_standard_add_fake.custom_fake =
-        __fake_elm_win_util_standard_add;
-    evas_object_del_fake.custom_fake =
-        __fake_evas_object_del;
-    elm_config_accel_preference_set_fake.custom_fake =
-        __fake_elm_config_accel_preference_set;
-    ecore_wl2_window_activate_fake.custom_fake =
-        __fake_ecore_wl2_window_activate;
-    ecore_wl2_window_iconified_set_fake.custom_fake =
-        __fake_ecore_wl2_window_iconified_set;
-    ecore_wl2_display_window_find_fake.custom_fake =
-        __fake_ecore_wl2_display_window_find;
-    ecore_evas_ecore_evas_get_fake.custom_fake =
-        __fake_ecore_evas_ecore_evas_get;
-    evas_object_evas_get_fake.custom_fake =
-        __fake_evas_object_evas_get;
-    ecore_evas_wayland2_window_get_fake.custom_fake =
-        __fake_ecore_evas_wayland2_window_get;
-    ecore_wl2_window_id_get_fake.custom_fake =
-        __fake_ecore_wl2_window_id_get;
-
-    aul_app_group_set_window_v2_fake.custom_fake =
-        __fake_aul_app_group_set_window_v2;
-    aul_app_group_lower_v2_fake.custom_fake =
-        __fake_aul_app_group_lower_v2;
-    aul_comp_notify_start_fake.custom_fake =
-        __fake_aul_comp_notify_start;
-    aul_comp_status_update_fake.custom_fake =
-        __fake_aul_comp_status_update;
-
-    app_get_display_state_fake.custom_fake =
-        __fake_app_get_display_state;
-
-    app_control_add_action_handler_fake.custom_fake =
-        __fake_app_control_add_action_handler;
-  }
-
-  virtual void TearDown(){
-  }
-};
-
-
-static frame_window_h __base_frame_component_create_cb(
-               component_h context,
-               void *user_data)
-{
-  frame_window_h frm_win = NULL;
-       Evas_Object* raw = elm_win_util_standard_add("frame", "frame");
-       int wid = 1;
-  base_frame_create_window(&frm_win, wid, (void*)raw);
-       return frm_win;
-}
-
-static void __base_frame_component_start_cb(
-               component_h context,
-               app_control_h app_control,
-               bool restarted,
-               void *user_data)
-{
-  component_register_action(context, "action");
-}
-
-static void __base_frame_component_resume_cb(
-               component_h context,
-               void *user_data)
-{
-  component_display_status_e display_status;
-  base_frame_get_display_status(context, &display_status);
-}
-
-static void __base_frame_component_pause_cb(
-               component_h context,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_stop_cb(
-               component_h context,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_destroy_cb(
-               component_h context,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_restore_content_cb(
-               component_h context,
-               bundle *content,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_save_content_cb(
-               component_h context,
-               bundle *content,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_action_cb(component_h context,
-               const char *action, app_control_h app_control,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_device_orientation_changed_cb(
-               component_h context,
-               component_device_orientation_e orientation,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_language_changed_cb(
-               component_h context,
-               const char *language,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_region_format_changed_cb(
-               component_h context,
-               const char *region,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_low_battery_cb(
-               component_h context,
-               component_low_battery_status_e status,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_low_memory_cb(
-               component_h context,
-               component_low_memory_status_e status,
-               void *user_data)
-{
-}
-
-static void __base_frame_component_suspended_state_changed_cb(
-               component_h context,
-               component_suspended_state_e state,
-               void *user_data)
-{
-}
-
-component_class_h base_frame_component_add(component_class_h comp_class,
-               const char *component_id, void *user_data)
-{
-       base_frame_component_lifecycle_callback_s callback = {
-               .create = __base_frame_component_create_cb,
-               .start = __base_frame_component_start_cb,
-               .resume = __base_frame_component_resume_cb,
-               .pause = __base_frame_component_pause_cb,
-               .stop = __base_frame_component_stop_cb,
-               .destroy = __base_frame_component_destroy_cb,
-               .restore_content = __base_frame_component_restore_content_cb,
-               .save_content = __base_frame_component_save_content_cb,
-               .action = __base_frame_component_action_cb,
-               .device_orientation_changed = __base_frame_component_device_orientation_changed_cb,
-               .language_changed = __base_frame_component_language_changed_cb,
-               .region_format_changed = __base_frame_component_region_format_changed_cb,
-               .low_battery = __base_frame_component_low_battery_cb,
-               .low_memory = __base_frame_component_low_memory_cb,
-               .suspended_state_changed = __base_frame_component_suspended_state_changed_cb,
-       };
-
-       return component_based_app_base_add_frame_component(comp_class,
-                       component_id, &callback, user_data);
-}
-
-TEST_F(BaseStubTest, base_frame_create_window)
-{
-  frame_window_h handle;
-  int ret = base_frame_create_window(
-      &handle, 1, nullptr);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-  base_frame_destroy_window(handle);
-}
-
-TEST_F(BaseStubTest, base_frame_window_get_id)
-{
-  frame_window_h handle;
-  int ret = base_frame_create_window(
-      &handle, 1, nullptr);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-
-  int id;
-  ret = base_frame_window_get_id(handle, &id);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-  EXPECT_EQ(id, 1);
-  base_frame_destroy_window(handle);
-}
-
-TEST_F(BaseStubTest, base_frame_window_get_raw)
-{
-  frame_window_h handle;
-  char* test = strdup("raw");
-  int ret = base_frame_create_window(
-      &handle, 1, (void *)test);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-
-  void* raw;
-  ret = base_frame_window_get_raw(handle, &raw);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-  free(test);
-  base_frame_destroy_window(handle);
-}
-
-void __app_init_cb(int argc, char** argv, void *user_data)
-{
-}
-
-void __app_fini_cb(void *user_data)
-{
-}
-
-void __app_run_cb(void *user_data)
-{
-}
-
-void __app_exit_cb(void *user_data)
-{
-}
-
-component_class_h __app_create_cb(void *user_data)
-{
-       component_class_h comp_class = NULL;
-       comp_class = base_frame_component_add(comp_class,
-                       "base-frame", NULL);
-
-       return comp_class;
-}
-
-void __app_terminate_cb(void *user_data)
-{
-}
-
-TEST_F(BaseStubTest, component_based_app_base_main)
-{
-  component_based_app_base_lifecycle_callback_s callback = {
-               .init = __app_init_cb,
-               .fini = __app_fini_cb,
-               .run = __app_run_cb,
-               .exit = __app_exit_cb,
-               .create = __app_create_cb,
-               .terminate = __app_terminate_cb
-       };
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  int ret = component_based_app_base_main(argc, argv, &callback, this);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-}
-
-}
\ No newline at end of file
diff --git a/unit_tests/src/base/test_base_service_stub.cc b/unit_tests/src/base/test_base_service_stub.cc
deleted file mode 100644 (file)
index f4f123b..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-
-#include <iostream>
-#include <memory>
-
-#include "component_based/base/api/component_based_app_base.h"
-#include "component_based/base/api/base_service_component.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_app_control.h"
-#include "mock/mock_appcore_multiwindow_base.h"
-#include "mock/mock_aul.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-static appcore_multiwindow_base_ops __ops;
-static int __argc;
-static char** __argv;
-static void* __user_data;
-static appcore_multiwindow_base_class __cls;
-static appcore_base_event_cb __event_cb[APPCORE_BASE_EVENT_MAX];
-static void* __event_data[APPCORE_BASE_EVENT_MAX];
-
-static int __fake_aul_comp_notify_start(const char *id) {
-  return 0;
-}
-
-static int __fake_aul_comp_status_update(const char *id, int status) {
-  return 0;
-}
-
-static void __generate_system_event(void)
-{
-  char lang[] = "en-US";
-  int intval = 1;
-  void* event;
-
-  for (int i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
-    if (i == APPCORE_BASE_EVENT_LANG_CHANGE ||
-        i == APPCORE_BASE_EVENT_REGION_CHANGE) {
-      event = static_cast<void*>(lang);
-    } else {
-      event = static_cast<void*>(&intval);
-    }
-
-    if (__event_cb[i]) {
-      __event_cb[i](event, __event_data[i]);
-    }
-  }
-}
-
-static int __fake_appcore_multiwindow_base_init(
-    appcore_multiwindow_base_ops ops,
-    int argc,
-    char** argv,
-    void* user_data) {
-  __ops = ops;
-  __argc = argc;
-  __argv = argv;
-  __user_data = user_data;
-
-  __ops.base.init(__argc, __argv, __user_data);
-  __ops.base.create(__user_data);
-  __ops.base.run(__user_data);
-
-  bundle* b = bundle_create();
-  bundle_add_str(b, AUL_K_COMPONENT_ID, "test-service-base");
-  bundle_add_str(b, AUL_K_INSTANCE_ID, "@test-service-base");
-  bundle_add_str(b, AUL_K_NEW_INSTANCE, "true");
-  std::unique_ptr<bundle, decltype(bundle_free)*> ptr(b, bundle_free);
-
-  __ops.base.receive(AUL_START, b, __user_data);
-
-  __generate_system_event();
-
-  __ops.base.control(b, __user_data);
-
-  __ops.base.receive(AUL_RESUME, b, __user_data);
-  __ops.base.receive(AUL_PAUSE, b, __user_data);
-
-  __ops.base.receive(AUL_WAKE, b, __user_data);
-  __ops.base.receive(AUL_SUSPEND, b, __user_data);
-
-  __ops.base.receive(AUL_TERMINATE_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BG_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BGAPP, b, __user_data);
-
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_fini(void) {
-  __cls.terminate(nullptr, __cls.data);
-
-  __ops.base.terminate(__user_data);
-  __ops.base.finish();
-}
-
-static void __fake_appcore_multiwindow_base_exit(void) {
-  __ops.base.exit(__user_data);
-}
-
-static int __fake_elm_init(int argc, char** argv) {
-  return 0;
-}
-
-static int __fake_elm_shutdown(void) {
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_class_add(
-    appcore_multiwindow_base_class cls) {
-  __cls = cls;
-}
-
-static appcore_multiwindow_base_instance_h
-__fake_appcore_multiwindow_base_instance_run(const char* class_id,
-    const char* id, void* extra)
-{
-  static appcore_multiwindow_base_instance_h inst =
-      reinterpret_cast<appcore_multiwindow_base_instance_h>(&inst);
-
-  __cls.create(inst, __cls.data);
-
-  return inst;
-}
-
-static const char* __fake_appcore_multiwindow_base_instance_get_id(
-    appcore_multiwindow_base_instance_h context) {
-  return "@test-service-base";
-}
-
-static appcore_base_event_h __fake_appcore_base_add_event(
-    enum appcore_base_event type, appcore_base_event_cb cb, void* data) {
-  __event_cb[type] = cb;
-  __event_data[type] = data;
-  return nullptr;
-}
-
-static int __fake_app_control_add_action_handler(const char* action,
-    app_control_action_cb callback, void* user_data,
-    app_control_action_h* handle) {
-  callback(action, nullptr, user_data);
-  return 0;
-}
-
-static int __fake_app_control_send_launch_request_async(
-    app_control_h app_control,
-    app_control_result_cb result_cb,
-    app_control_reply_cb reply_cb,
-    void* user_data) {
-  result_cb(app_control, APP_CONTROL_ERROR_NONE, user_data);
-  reply_cb(app_control, app_control, APP_CONTROL_RESULT_SUCCEEDED, user_data);
-  return 0;
-}
-
-static int __fake_app_control_send_launch_request_sync(
-    app_control_h app_control,
-    app_control_h* reply,
-    app_control_result_e* result) {
-  app_control_h handle = nullptr;
-  app_control_create(&handle);
-  *reply = handle;
-  *result = APP_CONTROL_RESULT_SUCCEEDED;
-  return 0;
-}
-
-class BaseServiceStubTest : public ::testing::Test {
- public:
-  virtual void SetUp() {
-    appcore_multiwindow_base_init_fake.custom_fake =
-        __fake_appcore_multiwindow_base_init;
-    appcore_multiwindow_base_fini_fake.custom_fake =
-        __fake_appcore_multiwindow_base_fini;
-    appcore_multiwindow_base_exit_fake.custom_fake =
-        __fake_appcore_multiwindow_base_exit;
-    appcore_multiwindow_base_instance_run_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_run;
-    appcore_multiwindow_base_class_add_fake.custom_fake =
-        __fake_appcore_multiwindow_base_class_add;
-    appcore_multiwindow_base_instance_get_id_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_get_id;
-    appcore_base_add_event_fake.custom_fake =
-        __fake_appcore_base_add_event;
-
-    elm_init_fake.custom_fake =
-        __fake_elm_init;
-    elm_shutdown_fake.custom_fake =
-        __fake_elm_shutdown;
-    aul_comp_notify_start_fake.custom_fake =
-        __fake_aul_comp_notify_start;
-    aul_comp_status_update_fake.custom_fake =
-        __fake_aul_comp_status_update;
-    app_control_add_action_handler_fake.custom_fake =
-        __fake_app_control_add_action_handler;
-    app_control_send_launch_request_async_fake.custom_fake =
-        __fake_app_control_send_launch_request_async;
-    app_control_send_launch_request_sync_fake.custom_fake =
-        __fake_app_control_send_launch_request_sync;
-  }
-
-  virtual void TearDown(){
-  }
-};
-
-static void __app_control_result_cb(app_control_h request,
-    app_control_error_e result, void* user_data) {
-}
-
-static void __app_control_reply_cb(app_control_h request,
-    app_control_h reply, app_control_result_e result, void* user_data) {
-}
-
-static bool __service_component_create_cb(component_h context,
-    void* user_data) {
-  char* id = nullptr;
-  component_get_id(context, &id);
-  free(id);
-
-  char* inst_id = nullptr;
-  component_get_instance_id(context, &inst_id);
-  free(inst_id);
-  return true;
-}
-
-static void __service_component_start_command_cb(component_h context,
-    app_control_h app_control, bool restarted, void* user_data) {
-  component_register_action(context, "action");
-  component_deregister_action(context, "action");
-
-  app_control_h handle = nullptr;
-  app_control_create(&handle);
-  component_send_launch_request_async(context, handle, __app_control_result_cb,
-      __app_control_reply_cb, nullptr);
-
-  app_control_h reply = nullptr;
-  app_control_result_e result;
-  component_send_launch_request_sync(context, handle, &reply, &result);
-  app_control_destroy(reply);
-  app_control_destroy(handle);
-
-  component_finish(context);
-}
-
-static void __service_component_destroy_cb(component_h context,
-    void *user_data) {
-}
-
-static void __service_component_restore_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __service_component_save_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __service_component_action_cb(component_h context,
-    const char* action, app_control_h app_control, void* user_data) {
-}
-
-static void __service_component_device_orientation_changed_cb(
-    component_h context, component_device_orientation_e orientation,
-    void* user_data) {
-}
-
-static void __service_component_language_changed_cb(component_h context,
-    const char* language, void* user_data) {
-}
-
-static void __service_component_region_format_changed_cb(component_h context,
-    const char* region, void* user_data) {
-}
-
-static void __service_component_low_battery_cb(component_h context,
-    component_low_battery_status_e status, void* user_data) {
-}
-
-static void __service_component_low_memory_cb(component_h context,
-    component_low_memory_status_e status, void* user_data) {
-}
-
-static void __service_component_suspended_state_changed_cb(component_h context,
-    component_suspended_state_e state, void* user_data) {
-}
-
-static component_class_h __service_component_add(
-    component_class_h component_class, const char* component_id,
-    void* user_data) {
-  base_service_component_lifecycle_callback_s callback;
-  callback.create =
-      __service_component_create_cb;
-  callback.start_command =
-      __service_component_start_command_cb;
-  callback.destroy =
-      __service_component_destroy_cb;
-  callback.restore_content =
-      __service_component_restore_content_cb;
-  callback.save_content =
-      __service_component_save_content_cb;
-  callback.action =
-      __service_component_action_cb;
-  callback.device_orientation_changed =
-      __service_component_device_orientation_changed_cb;
-  callback.language_changed =
-      __service_component_language_changed_cb;
-  callback.region_format_changed =
-      __service_component_region_format_changed_cb;
-  callback.low_battery =
-      __service_component_low_battery_cb;
-  callback.low_memory =
-      __service_component_low_memory_cb;
-  callback.suspended_state_changed =
-      __service_component_suspended_state_changed_cb;
-
-  return component_based_app_base_add_service_component(component_class,
-      component_id, &callback, user_data);
-}
-
-void __app_init_cb(int argc, char** argv, void *user_data)
-{
-}
-
-void __app_fini_cb(void *user_data)
-{
-}
-
-void __app_run_cb(void *user_data)
-{
-}
-
-void __app_exit_cb(void *user_data)
-{
-}
-
-component_class_h __app_create_cb(void *user_data)
-{
-       component_class_h comp_class = NULL;
-       comp_class = __service_component_add(comp_class,
-                       "test-service-base", NULL);
-
-       return comp_class;
-}
-
-void __app_terminate_cb(void *user_data)
-{
-}
-
-TEST_F(BaseServiceStubTest, component_based_app_base_add_service_component)
-{
-  component_based_app_base_lifecycle_callback_s callback = {
-               .init = __app_init_cb,
-               .fini = __app_fini_cb,
-               .run = __app_run_cb,
-               .exit = __app_exit_cb,
-               .create = __app_create_cb,
-               .terminate = __app_terminate_cb
-       };
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  int ret = component_based_app_base_main(argc, argv, &callback, this);
-  EXPECT_EQ(COMPONENT_ERROR_NONE, ret);
-}
-
-}
\ No newline at end of file
diff --git a/unit_tests/src/base/test_component_based_application_base.cc b/unit_tests/src/base/test_component_based_application_base.cc
deleted file mode 100644 (file)
index ca6627a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-
-#include "component_based/base/application_base.h"
-#include "component_based/base/core_base_internal.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_appcore_multiwindow_base.h"
-
-namespace {
-
-class ApplicationTest : public ::testing::Test {
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-int __fake_app_get_id(char** app_id) {
-  char id[] = "component_based_test";
-  *app_id = strdup(id);
-  return 0;
-}
-
-TEST_F(ApplicationTest, GetApplicationId) {
-  app_get_id_fake.custom_fake = __fake_app_get_id;
-
-  std::unique_ptr<component_based::ApplicationBase> app(
-      new component_based::ApplicationBase());
-
-  std::string appid = app->GetApplicationID();
-  EXPECT_EQ(appid, "component_based_test");
-}
-
-}  // namespace
diff --git a/unit_tests/src/base/test_component_based_component.cc b/unit_tests/src/base/test_component_based_component.cc
deleted file mode 100644 (file)
index c50e659..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-
-#include "component_based/app_control/component_based_app_control.h"
-#include "component_based/base/frame_component.h"
-#include "component_based/base/service_component.h"
-#include "component_based/base/component.h"
-#include "component_based/base/component_implementation.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_app_control.h"
-#include "mock/mock_appcore_multiwindow_base.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-class ComponentTest : public ::testing::Test {
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-class TestListener : public component_based::AppControl::IEventListener {
- public:
-  void OnResultReceived(component_based::AppControl request,
-                                component_based::AppControl::Error error) {
-  }
-  void OnReplyReceived(component_based::AppControl request,
-      component_based::AppControl reply,
-      component_based::AppControl::Result result) {
-  }
-};
-
-int __fake_app_get_display_state(app_display_state_e* state) {
-  *state = APP_DISPLAY_STATE_ON;
-  return 0;
-}
-
-int __fake_app_resource_manager_get(app_resource_e type, const char* id,
-    char** path) {
-  char* temp = strdup("tmp");
-  *path = temp;
-  return 0;
-}
-
-Evas_Object* __fake_elm_win_util_standard_add(const char* name, const char* title)
-{
-  return nullptr;
-}
-
-int __fake_app_control_add_action_handler(const char* action,
-    app_control_action_cb callback, void *user_data, app_control_action_h* h)
-{
-  return 0;
-}
-
-TEST_F(ComponentTest, TestFrameComponentClass) {
-  elm_win_util_standard_add_fake.custom_fake = __fake_elm_win_util_standard_add;
-  app_get_display_state_fake.custom_fake = __fake_app_get_display_state;
-
-  std::unique_ptr<component_based::FrameComponent> fc(
-      new component_based::FrameComponent(std::string("comp_id"), std::string("inst_id")));
-
-  std::unique_ptr<component_based::IWindow> win = fc->OnCreate();
-
-  std::unique_ptr<component_based::AppControl::Builder> builder(
-      new component_based::AppControl::Builder());
-  EXPECT_NE(builder, nullptr);
-
-  builder->SetAppID("org.tizen.helloworld");
-  builder->SetOperation(APP_CONTROL_OPERATION_DEFAULT);
-  builder->SetLaunchMode(component_based::AppControl::LaunchMode::SINGLE);
-
-  component_based::Uri uri(
-    "https:%2F%2Fjohn.doe%40www.example.com%3A123%2Fforum%2Fquestions%2F?tag=networking&order=newest#top");
-  builder->SetUri(uri);
-  builder->SetMime("application/octet-stream");
-  builder->AddExtra("key", "value");
-  builder->SetComponentID("ElmFrame");
-
-  component_based::AppControl ctrl = builder->Build();
-  fc->OnStart(ctrl, false);
-  fc->OnResume();
-  fc->OnPause();
-  fc->OnStop();
-  fc->OnDestroy();
-
-  component_based::FrameComponent::DisplayStatus status =
-      fc->GetDisplayStatus();
-  EXPECT_EQ(status, component_based::FrameComponent::DisplayStatus::On);
-  fc->GetWindow();
-}
-
-TEST_F(ComponentTest, TestSerivceComponentClass) {
-  std::unique_ptr<component_based::ServiceComponent> sc(
-      new component_based::ServiceComponent(std::string("comp_id"), std::string("inst_id")));
-
-  sc->OnCreate();
-
-  std::unique_ptr<component_based::AppControl::Builder> builder(
-      new component_based::AppControl::Builder());
-  EXPECT_NE(builder, nullptr);
-
-  builder->SetAppID("org.tizen.helloworld");
-  builder->SetOperation(APP_CONTROL_OPERATION_DEFAULT);
-  builder->SetLaunchMode(component_based::AppControl::LaunchMode::SINGLE);
-  component_based::Uri uri(
-    "https:%2F%2Fjohn.doe%40www.example.com%3A123%2Fforum%2Fquestions%2F?tag=networking&order=newest#top");
-  builder->SetUri(uri);
-  builder->SetMime("application/octet-stream");
-  builder->AddExtra("key", "value");
-  builder->SetComponentID("ElmFrame");
-
-  component_based::AppControl ctrl = builder->Build();
-  sc->OnStartCommand(ctrl, false);
-  sc->OnDestroy();
-}
-
-TEST_F(ComponentTest, TestComponentClass) {
-  app_resource_manager_get_fake.custom_fake = __fake_app_resource_manager_get;
-  app_control_add_action_handler_fake.custom_fake =
-    __fake_app_control_add_action_handler;
-
-  std::unique_ptr<component_based::Component> fc(
-      new component_based::Component(std::string("comp_id"),
-      std::string("inst_id")));
-
-  std::string cid = fc->GetComponentID();
-  EXPECT_EQ(cid, "comp_id");
-
-  std::string iid = fc->GetInstanceID();
-  EXPECT_EQ(iid, "inst_id");
-
-  auto type = fc->GetType();
-  EXPECT_EQ(type->GetName(), "base");
-  fc->Finish();
-
-  fc->RegisterAction(std::string("action"));
-  fc->DeregisterAction(std::string("action"));
-
-  std::unique_ptr<component_based::AppControl::Builder> builder(
-      new component_based::AppControl::Builder());
-  EXPECT_NE(builder, nullptr);
-
-  builder->SetAppID("org.tizen.helloworld");
-  builder->SetOperation(APP_CONTROL_OPERATION_DEFAULT);
-  builder->SetLaunchMode(component_based::AppControl::LaunchMode::SINGLE);
-  component_based::Uri uri(
-    "https:%2F%2Fjohn.doe%40www.example.com%3A123%2Fforum%2Fquestions%2F?tag=networking&order=newest#top");
-  builder->SetUri(uri);
-  builder->SetMime("application/octet-stream");
-  builder->AddExtra("key", "value");
-  builder->SetComponentID("ElmFrame");
-
-  component_based::AppControl ctrl = builder->Build();
-  std::unique_ptr<TestListener> listener =
-      std::unique_ptr<TestListener>(new TestListener());
-  fc->SendAsync(ctrl, listener.get());
-
-  fc->Send(ctrl);
-}
-
-}  // namespace
diff --git a/unit_tests/src/base/test_component_based_component_mananger.cc b/unit_tests/src/base/test_component_based_component_mananger.cc
deleted file mode 100644 (file)
index 96a77ac..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-
-#include <bundle_cpp.h>
-
-#include "component_based/app_control/component_based_app_control.h"
-#include "component_based/base/component.h"
-#include "component_based/base/frame_component.h"
-#include "component_based/base/component_manager_internal.h"
-#include "component_based/base/window_interface.h"
-
-#include "mock/mock_appcore_multiwindow_base.h"
-
-namespace {
-
-class ComponentManagerTest : public ::testing::Test {
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-class SimpleComponentManagerListener : public component_based::internal::ComponentManager::IEventListener {
-  bool OnCreate() override {
-    return true;
-  };
-  void OnDestroy() override {};
-  void OnStart(component_based::AppControl app_control, bool restarted) override {};
-  void OnPause() override {};
-  void OnResume() override {};
-  void OnStop() override {};
-};
-
-class SimpleFrameComp : public component_based::FrameComponent {
- public:
-  class Factory : public component_based::Component::Factory {
-   public:
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-              std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
-          new SimpleFrameComp(std::move(comp_id), std::move(inst_id)));
-    }
-  };
-
-  SimpleFrameComp(std::string comp_id, std::string inst_id)
-    : FrameComponent(std::move(comp_id), std::move(inst_id)) {
-  }
-
-  void OnStart(component_based::AppControl app_control, bool restarted) override {
-  }
-
-  void OnResume() override {
-  }
-
-  void OnPause() override {
-  }
-
-  void OnStop() override {
-  }
-
-  void OnDestroy() override {
-  }
-};
-
-class SimpleWindow : public component_based::IWindow {
- public:
-  int GetResID() const override {
-    return 0;
-  };
-
-  void* GetRaw() override {
-    void* temp = nullptr;
-    return temp;
-  };
-};
-
-static appcore_multiwindow_base_instance_h __fake_appcore_multiwindow_base_instance_run(
-    const char* class_id, const char* id, void* extra)
-{
-  return nullptr;
-}
-
-appcore_multiwindow_base_instance_h __fake_appcore_multiwindow_base_instance_find(const char* id)
-{
-  typedef struct _appcore_multiwindow_base_instance {
-    unsigned int window_id;
-    char *id;
-    void *extra;
-    appcore_multiwindow_base_class *shell;
-    bool is_resumed;
-  } appcore_multiwindow_base_instance;
-
-  appcore_multiwindow_base_instance *s =
-    (appcore_multiwindow_base_instance*)malloc(sizeof(appcore_multiwindow_base_instance));
-  return s;
-}
-
-bool __fake_appcore_multiwindow_base_instance_is_resumed(appcore_multiwindow_base_instance_h h)
-{
-  free(h);
-  return 0;
-}
-
-void __fake_appcore_multiwindow_base_instance_exit(appcore_multiwindow_base_instance_h h)
-{
-  free(h);
-}
-
-void __fake_appcore_multiwindow_base_window_unbind(appcore_multiwindow_base_instance_h h)
-{
-  free(h);
-}
-
-TEST_F(ComponentManagerTest, TestIsEmpty) {
-  auto &cm = component_based::internal::ComponentManager::GetInst();
-  EXPECT_TRUE(cm.IsEmpty());
-}
-
-TEST_F(ComponentManagerTest, TestRegisterComponent) {
-  auto &cm = component_based::internal::ComponentManager::GetInst();
-
-  cm.RegisterComponent("comp_id",
-      std::unique_ptr<component_based::Component::Factory>(
-          new SimpleFrameComp::Factory()));
-}
-
-TEST_F(ComponentManagerTest, TestAddEventListener) {
-  auto &cm = component_based::internal::ComponentManager::GetInst();
-  std::unique_ptr<SimpleComponentManagerListener> ev(
-      new SimpleComponentManagerListener());
-
-  cm.AddEventListener(std::string("inst_id"), ev.get());
-}
-
-TEST_F(ComponentManagerTest, TestComponentManagerLifeCycle) {
-  appcore_multiwindow_base_instance_run_fake.custom_fake =
-    __fake_appcore_multiwindow_base_instance_run;
-  appcore_multiwindow_base_instance_find_fake.custom_fake =
-    __fake_appcore_multiwindow_base_instance_find;
-  appcore_multiwindow_base_instance_is_resumed_fake.custom_fake =
-    __fake_appcore_multiwindow_base_instance_is_resumed;
-  appcore_multiwindow_base_instance_exit_fake.custom_fake =
-    __fake_appcore_multiwindow_base_instance_exit;
-  appcore_multiwindow_base_window_unbind_fake.custom_fake =
-    __fake_appcore_multiwindow_base_window_unbind;
-
-  auto &cm = component_based::internal::ComponentManager::GetInst();
-  std::string inst_id("inst_id2");
-  std::string comp_id("comp_id2");
-
-  cm.RegisterComponent(comp_id,
-      std::unique_ptr<component_based::Component::Factory>(
-          new SimpleFrameComp::Factory()));
-
-  std::unique_ptr<SimpleComponentManagerListener> ev(
-      new SimpleComponentManagerListener());
-  cm.AddEventListener(inst_id, ev.get());
-
-  bundle *b = bundle_create();
-  cm.Start(comp_id, inst_id, b);
-  bundle_free(b);
-  cm.Pause(inst_id);
-  cm.PauseAll();
-  cm.Resume(inst_id);
-  cm.ResumeAll();
-  EXPECT_FALSE(cm.IsResumed(inst_id));
-  cm.Stop(inst_id);
-  cm.Exit(inst_id);
-  cm.ExitAll();
-}
-
-TEST_F(ComponentManagerTest, TestComponentManagerBindUnbind) {
-  auto &cm = component_based::internal::ComponentManager::GetInst();
-  std::string inst_id("inst_id");
-  std::unique_ptr<SimpleWindow> win(new SimpleWindow());
-
-  cm.Bind(inst_id, std::move(win));
-  cm.GetWindow(inst_id);
-  cm.Unbind(inst_id);
-}
-
-TEST_F(ComponentManagerTest, TestComponentManagerAddRemoveGroup) {
-  auto &cm = component_based::internal::ComponentManager::GetInst();
-  std::string inst_id("inst_id");
-
-  cm.AddGroup(inst_id, 1);
-  cm.RemoveGroup(inst_id);
-}
-
-}  // namespace
diff --git a/unit_tests/src/base/test_component_based_content_manager.cc b/unit_tests/src/base/test_component_based_content_manager.cc
deleted file mode 100644 (file)
index 04f1c59..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-#include <bundle_cpp.h>
-
-#include "component_based/base/content_manager_internal.h"
-
-#include "mock/mock_app_common.h"
-
-namespace {
-
-class ContentManagerTest : public ::testing::Test {
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-char* __fake_app_get_data_path(void)
-{
-  char tmp_path[6] = "/tmp/";
-  return strdup(tmp_path);
-}
-
-TEST_F(ContentManagerTest, ContentManagerClass) {
-  app_get_data_path_fake.custom_fake = __fake_app_get_data_path;
-
-  std::unique_ptr<component_based::internal::ContentManager> cm(
-      new component_based::internal::ContentManager(std::string("inst_id")));
-
-  auto bundle = std::unique_ptr<tizen_base::Bundle>(new tizen_base::Bundle());
-  tizen_base::Bundle b;
-  cm->SetContent(b);
-
-  bundle->Add("key", "val");
-
-  cm->SetContent(*bundle);
-
-  tizen_base::Bundle getBundle = cm->GetContent();
-  std::string val = getBundle.GetString(std::string("key"));
-  EXPECT_STREQ(val.c_str(), "val");
-}
-
-}  // namespace
diff --git a/unit_tests/src/efl_base/test_component_based_app.cc b/unit_tests/src/efl_base/test_component_based_app.cc
deleted file mode 100644 (file)
index 79b10e0..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <glib.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-
-#include "component_based/efl_base/api/frame_component.h"
-#include "component_based/efl_base/api/service_component.h"
-#include "component_based/efl_base/api/component_based_app.h"
-
-#include "mock/mock_appcore_multiwindow_base.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-static appcore_multiwindow_base_ops __ops;
-static int __argc;
-static char** __argv;
-static void* __user_data;
-
-static int __fake_appcore_multiwindow_base_init(
-    appcore_multiwindow_base_ops ops,
-    int argc,
-    char** argv,
-    void* user_data) {
-  __ops = ops;
-  __argc = argc;
-  __argv = argv;
-  __user_data = user_data;
-
-  __ops.base.init(__argc, __argv, __user_data);
-  __ops.base.create(__user_data);
-  __ops.base.run(__user_data);
-
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_fini(void) {
-  __ops.base.terminate(__user_data);
-  __ops.base.finish();
-}
-
-static void __fake_appcore_multiwindow_base_exit(void) {
-  __ops.base.exit(__user_data);
-}
-
-static int __fake_elm_init(int argc, char** argv) {
-  return 0;
-}
-
-static int __fake_elm_shutdown(void) {
-  return 0;
-}
-
-static Evas_Object* __fake_elm_win_util_standard_add(const char* name,
-    const char* title) {
-  Evas_Object* win = reinterpret_cast<Evas_Object*>(malloc(sizeof(void*)));
-  return win;
-}
-
-static void __fake_evas_object_del(Evas_Object* object) {
-  free(object);
-}
-
-static void __fake_elm_config_accel_preference_set(const char* pref) {
-}
-
-class ComponentBasedAppTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    appcore_multiwindow_base_init_fake.custom_fake =
-        __fake_appcore_multiwindow_base_init;
-    appcore_multiwindow_base_fini_fake.custom_fake =
-        __fake_appcore_multiwindow_base_fini;
-    appcore_multiwindow_base_exit_fake.custom_fake =
-        __fake_appcore_multiwindow_base_exit;
-
-    elm_init_fake.custom_fake =
-        __fake_elm_init;
-    elm_shutdown_fake.custom_fake =
-        __fake_elm_shutdown;
-    elm_win_util_standard_add_fake.custom_fake =
-        __fake_elm_win_util_standard_add;
-
-    evas_object_del_fake.custom_fake =
-        __fake_evas_object_del;
-
-    elm_config_accel_preference_set_fake.custom_fake =
-        __fake_elm_config_accel_preference_set;
-  }
-  void TearDown() override {}
-
-  bool created_ = false;
-  bool terminated_ = false;
-};
-
-static bool __service_component_create_cb(component_h context,
-    void* user_data) {
-  return true;
-}
-
-static void __service_component_start_command_cb(component_h context,
-    app_control_h app_control, bool restarted, void* user_data) {
-}
-
-static void __service_component_destroy_cb(component_h context,
-    void *user_data) {
-}
-
-static void __service_component_restore_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __service_component_save_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __service_component_action_cb(component_h context,
-    const char* action, app_control_h app_control, void* user_data) {
-}
-
-static void __service_component_device_orientation_changed_cb(
-    component_h context, component_device_orientation_e orientation,
-    void* user_data) {
-}
-
-static void __service_component_language_changed_cb(component_h context,
-    const char* language, void* user_data) {
-}
-
-static void __service_component_region_format_changed_cb(component_h context,
-    const char* region, void* user_data) {
-}
-
-static void __service_component_low_battery_cb(component_h context,
-    component_low_battery_status_e status, void* user_data) {
-}
-
-static void __service_component_low_memory_cb(component_h context,
-    component_low_memory_status_e status, void* user_data) {
-}
-
-static void __service_component_suspended_state_changed_cb(component_h context,
-    component_suspended_state_e state, void* user_data) {
-}
-
-static component_class_h __service_component_add(
-    component_class_h component_class, const char* component_id,
-    void* user_data) {
-  service_component_lifecycle_callback_s callback;
-  callback.create =
-    __service_component_create_cb;
-  callback.start_command =
-    __service_component_start_command_cb;
-  callback.destroy =
-    __service_component_destroy_cb;
-  callback.restore_content =
-    __service_component_restore_content_cb;
-  callback.save_content =
-    __service_component_save_content_cb;
-  callback.action =
-    __service_component_action_cb;
-  callback.device_orientation_changed =
-    __service_component_device_orientation_changed_cb;
-  callback.language_changed =
-    __service_component_language_changed_cb;
-  callback.region_format_changed =
-    __service_component_region_format_changed_cb;
-  callback.low_battery =
-    __service_component_low_battery_cb;
-  callback.low_memory =
-    __service_component_low_memory_cb;
-  callback.suspended_state_changed =
-    __service_component_suspended_state_changed_cb;
-
-  return component_based_app_add_service_component(component_class,
-      component_id, &callback, user_data);
-}
-
-static Evas_Object* __frame_component_create_cb(component_h context,
-    void* user_data) {
-  return elm_win_util_standard_add("frame", "frame");
-}
-
-static void __frame_component_start_cb(component_h context,
-    app_control_h app_control, bool restarted, void* user_data) {
-}
-
-static void __frame_component_resume_cb(component_h context,
-    void* user_data) {
-}
-
-static void __frame_component_pause_cb(component_h context,
-    void* user_data) {
-}
-
-static void __frame_component_stop_cb(component_h context,
-    void* user_data) {
-}
-
-static void __frame_component_destroy_cb(component_h context,
-    void *user_data) {
-}
-
-static void __frame_component_restore_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __frame_component_save_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __frame_component_action_cb(component_h context,
-    const char* action, app_control_h app_control, void* user_data) {
-}
-
-static void __frame_component_device_orientation_changed_cb(
-    component_h context, component_device_orientation_e orientation,
-    void* user_data) {
-}
-
-static void __frame_component_language_changed_cb(component_h context,
-    const char* language, void* user_data) {
-}
-
-static void __frame_component_region_format_changed_cb(component_h context,
-    const char* region, void* user_data) {
-}
-
-static void __frame_component_low_battery_cb(component_h context,
-    component_low_battery_status_e status, void* user_data) {
-}
-
-static void __frame_component_low_memory_cb(component_h context,
-    component_low_memory_status_e status, void* user_data) {
-}
-
-static void __frame_component_suspended_state_changed_cb(component_h context,
-    component_suspended_state_e state, void* user_data) {
-}
-
-static component_class_h __frame_component_add(
-    component_class_h component_class, const char* component_id,
-    void* user_data) {
-  frame_component_lifecycle_callback_s callback;
-  callback.create =
-      __frame_component_create_cb;
-  callback.start =
-      __frame_component_start_cb;
-  callback.resume =
-      __frame_component_resume_cb;
-  callback.pause =
-      __frame_component_pause_cb;
-  callback.stop =
-      __frame_component_stop_cb;
-  callback.destroy =
-      __frame_component_destroy_cb;
-  callback.restore_content =
-      __frame_component_restore_content_cb;
-  callback.save_content =
-      __frame_component_save_content_cb;
-  callback.action =
-      __frame_component_action_cb;
-  callback.device_orientation_changed =
-      __frame_component_device_orientation_changed_cb;
-  callback.language_changed =
-      __frame_component_language_changed_cb;
-  callback.region_format_changed =
-      __frame_component_region_format_changed_cb;
-  callback.low_battery =
-      __frame_component_low_battery_cb;
-  callback.low_memory =
-      __frame_component_low_memory_cb;
-  callback.suspended_state_changed =
-      __frame_component_suspended_state_changed_cb;
-
-  return component_based_app_add_frame_component(component_class,
-      component_id, &callback, user_data);
-}
-
-static component_class_h __component_based_app_create_cb(void* user_data) {
-  component_class_h component_class = nullptr;
-  component_class = __service_component_add(component_class,
-      "service-component", user_data);
-  component_class = __frame_component_add(component_class,
-      "frame-component", user_data);
-
-  return component_class;
-}
-
-static void __component_based_app_terminate_cb(void* user_data) {
-
-}
-
-TEST_F(ComponentBasedAppTest, component_based_app_main) {
-  component_based_app_lifecycle_callback_s callback;
-  callback.create = __component_based_app_create_cb;
-  callback.terminate = __component_based_app_terminate_cb;
-
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  setenv("AUL_LOADER_INIT", "1", 1);
-  int ret = component_based_app_main(argc, argv, &callback, this);
-  unsetenv("AUL_LOADER_INIT");
-  EXPECT_EQ(ret, APP_ERROR_NONE);
-}
-
-TEST_F(ComponentBasedAppTest, component_based_app_main_with_hwacc) {
-  component_based_app_lifecycle_callback_s callback;
-  callback.create = __component_based_app_create_cb;
-  callback.terminate = __component_based_app_terminate_cb;
-
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  setenv("HWACC", "USE", 1);
-  int ret = component_based_app_main(argc, argv, &callback, this);
-  unsetenv("HWACC");
-  EXPECT_EQ(ret, APP_ERROR_NONE);
-}
-
-TEST_F(ComponentBasedAppTest, component_based_app_main_without_hwacc) {
-  component_based_app_lifecycle_callback_s callback;
-  callback.create = __component_based_app_create_cb;
-  callback.terminate = __component_based_app_terminate_cb;
-
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  setenv("HWACC", "NOT_USE", 1);
-  int ret = component_based_app_main(argc, argv, &callback, this);
-  unsetenv("HWACC");
-  EXPECT_EQ(ret, APP_ERROR_NONE);
-}
-
-TEST_F(ComponentBasedAppTest, component_based_app_main_with_nullptr) {
-  int ret = component_based_app_main(0, nullptr, nullptr, nullptr);
-  EXPECT_EQ(ret, APP_ERROR_INVALID_PARAMETER);
-}
-
-TEST_F(ComponentBasedAppTest, component_based_app_exit) {
-  int ret = component_based_app_exit();
-  EXPECT_EQ(ret, APP_ERROR_NONE);
-}
-
-TEST_F(ComponentBasedAppTest, component_based_app_add_frame_component) {
-  component_class_h component_class = nullptr;
-  component_class = __frame_component_add(component_class,
-      "frame-component-test", nullptr);
-  EXPECT_NE(component_class, nullptr);
-}
-
-TEST_F(ComponentBasedAppTest,
-       component_based_app_add_frame_component_with_nullptr) {
-  component_class_h component_class = nullptr;
-  component_class = __frame_component_add(component_class, nullptr, nullptr);
-  EXPECT_EQ(component_class, nullptr);
-  EXPECT_EQ(get_last_result(), APP_ERROR_INVALID_PARAMETER);
-}
-
-
-TEST_F(ComponentBasedAppTest,
-       component_based_app_add_service_component_with_nullptr) {
-  component_class_h component_class = nullptr;
-  component_class = __service_component_add(component_class, nullptr, nullptr);
-  EXPECT_EQ(component_class, nullptr);
-  EXPECT_EQ(get_last_result(), APP_ERROR_INVALID_PARAMETER);
-}
-
-}  // namespace
diff --git a/unit_tests/src/efl_base/test_frame_component.cc b/unit_tests/src/efl_base/test_frame_component.cc
deleted file mode 100644 (file)
index 815f275..0000000
+++ /dev/null
@@ -1,523 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <glib.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-#include <aul.h>
-#include <bundle.h>
-
-#include <memory>
-
-#include "component_based/efl_base/api/frame_component.h"
-#include "component_based/efl_base/api/frame_component_internal.h"
-#include "component_based/efl_base/api/service_component.h"
-#include "component_based/efl_base/api/component_based_app.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_app_control.h"
-#include "mock/mock_appcore_multiwindow_base.h"
-#include "mock/mock_aul.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-static appcore_multiwindow_base_ops __ops;
-static int __argc;
-static char** __argv;
-static void* __user_data;
-static appcore_multiwindow_base_class __cls;
-static bool __is_resumed;
-static appcore_base_event_cb __event_cb[APPCORE_BASE_EVENT_MAX];
-static void* __event_data[APPCORE_BASE_EVENT_MAX];
-
-static void __generate_show_event(void) {
-  Ecore_Wl2_Event_Window_Show ev = {
-    .win = 1,
-    .parent_win = 1,
-    .event_win = 1,
-    .data = { 1, }
-  };
-
-  __ops.window.show(ECORE_WL2_EVENT_WINDOW_SHOW, &ev, __user_data);
-}
-
-static void __generate_hide_event(void) {
-  Ecore_Wl2_Event_Window_Hide ev = {
-    .win = 1,
-    .parent_win = 1,
-    .event_win = 1
-  };
-
-  __ops.window.hide(ECORE_WL2_EVENT_WINDOW_HIDE, &ev, __user_data);
-}
-
-static void __generate_lower_event(void) {
-  Ecore_Wl2_Event_Window_Lower ev = {
-    .win = 1,
-    .timestamp = 2
-  };
-
-  __ops.window.lower(ECORE_WL2_EVENT_WINDOW_LOWER, &ev, __user_data);
-}
-
-static void __generate_aux_message(void) {
-  Ecore_Wl2_Event_Aux_Message ev = {
-    .win = 1,
-    .key = "dpms",
-    .val = "on",
-  };
-
-  __ops.window.aux_message(ECORE_WL2_EVENT_AUX_MESSAGE, &ev, __user_data);
-}
-
-static void __generate_pre_visibility_change_event(void) {
-  Ecore_Wl2_Event_Window_Pre_Visibility_Change ev = {
-    .win = 1,
-    .type = ECORE_WL2_WINDOW_VISIBILITY_TYPE_UNOBSCURED,
-  };
-
-  __ops.window.pre_visibility(ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE, &ev,
-      __user_data);
-}
-
-static void __generate_visibility_change_event(int fully_obscured) {
-  Ecore_Wl2_Event_Window_Visibility_Change ev = {
-    .win = 1,
-    .fully_obscured = fully_obscured
-  };
-
-  __ops.window.visibility(ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE,
-      &ev, __user_data);
-}
-
-static void __fake_appcore_multiwindow_base_window_on_visibility(int type,
-    void* event) {
-  Ecore_Wl2_Event_Window_Visibility_Change* ev =
-      static_cast<Ecore_Wl2_Event_Window_Visibility_Change*>(event);
-
-  if (ev->fully_obscured)
-    appcore_multiwindow_base_instance_pause(nullptr);
-  else
-    appcore_multiwindow_base_instance_resume(nullptr);
-}
-
-static int __fake_aul_comp_notify_start(const char *id) {
-  return 0;
-}
-
-static int __fake_aul_comp_status_update(const char *id, int status) {
-  return 0;
-}
-
-static void __generate_system_event(void)
-{
-  char lang[] = "en-US";
-  int intval = 1;
-  void* event;
-
-  for (int i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
-    if (i == APPCORE_BASE_EVENT_LANG_CHANGE ||
-        i == APPCORE_BASE_EVENT_REGION_CHANGE) {
-      event = static_cast<void*>(lang);
-    } else {
-      event = static_cast<void*>(&intval);
-    }
-
-    if (__event_cb[i]) {
-      __event_cb[i](event, __event_data[i]);
-    }
-  }
-}
-
-static int __fake_appcore_multiwindow_base_init(
-    appcore_multiwindow_base_ops ops,
-    int argc,
-    char** argv,
-    void* user_data) {
-  __ops = ops;
-  __argc = argc;
-  __argv = argv;
-  __user_data = user_data;
-
-  __ops.base.init(__argc, __argv, __user_data);
-  __ops.base.create(__user_data);
-  __ops.base.run(__user_data);
-
-  bundle* b = bundle_create();
-  bundle_add_str(b, AUL_K_COMPONENT_ID, "test-frame-component");
-  bundle_add_str(b, AUL_K_INSTANCE_ID, "@test-frame-component");
-  bundle_add_str(b, AUL_K_NEW_INSTANCE, "true");
-  std::unique_ptr<bundle, decltype(bundle_free)*> ptr(b, bundle_free);
-
-  __ops.base.receive(AUL_START, b, __user_data);
-  __generate_system_event();
-
-  __ops.base.control(b, __user_data);
-  __generate_show_event();
-
-  __ops.base.receive(AUL_RESUME, b, __user_data);
-  __ops.base.receive(AUL_PAUSE, b, __user_data);
-
-  __generate_hide_event();
-  __generate_lower_event();
-  __generate_aux_message();
-
-  __ops.base.receive(AUL_WAKE, b, __user_data);
-  __ops.base.receive(AUL_SUSPEND, b, __user_data);
-
-  __ops.base.receive(AUL_TERMINATE_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BG_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BGAPP, b, __user_data);
-
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_fini(void) {
-  __cls.terminate(nullptr, __cls.data);
-
-  __ops.base.terminate(__user_data);
-  __ops.base.finish();
-}
-
-static void __fake_appcore_multiwindow_base_exit(void) {
-  __ops.base.exit(__user_data);
-}
-
-static int __fake_elm_init(int argc, char** argv) {
-  return 0;
-}
-
-static int __fake_elm_shutdown(void) {
-  return 0;
-}
-
-static Evas_Object* __fake_elm_win_util_standard_add(const char* name,
-    const char* title) {
-  Evas_Object* win = reinterpret_cast<Evas_Object*>(malloc(sizeof(void*)));
-  return win;
-}
-
-static void __fake_evas_object_del(Evas_Object* object) {
-  free(object);
-}
-
-static void __fake_elm_config_accel_preference_set(const char* pref) {
-}
-
-static void __fake_ecore_wl2_window_activate(Ecore_Wl2_Window* window) {
-  __generate_pre_visibility_change_event();
-  __generate_visibility_change_event(0);
-}
-
-static void __fake_ecore_wl2_window_iconified_set(Ecore_Wl2_Window* window,
-                                                  Eina_Bool iconified) {
-  __generate_visibility_change_event(1);
-}
-
-static int __fake_aul_app_group_lower_v2(const char* id, bool* exit) {
-  *exit = true;
-  return 0;
-}
-
-static int __fake_aul_app_group_set_window_v2(const char* id, int wid) {
-  return 0;
-}
-
-static Ecore_Wl2_Window* __fake_ecore_wl2_display_window_find(
-    Ecore_Wl2_Display* display, unsigned int id) {
-  static int window;
-  return reinterpret_cast<Ecore_Wl2_Window*>(&window);
-}
-
-static void __fake_appcore_multiwindow_base_class_add(
-    appcore_multiwindow_base_class cls) {
-  __cls = cls;
-}
-
-static appcore_multiwindow_base_instance_h
-__fake_appcore_multiwindow_base_instance_run(const char* class_id,
-    const char* id, void* extra)
-{
-  static appcore_multiwindow_base_instance_h inst =
-      reinterpret_cast<appcore_multiwindow_base_instance_h>(&inst);
-  __cls.create(inst, __cls.data);
-
-  return inst;
-}
-
-static const char* __fake_appcore_multiwindow_base_instance_get_id(
-    appcore_multiwindow_base_instance_h context) {
-  return "@test-frame-component";
-}
-
-static bool __fake_appcore_multiwindow_base_instance_is_resumed(
-    appcore_multiwindow_base_instance_h context) {
-  return __is_resumed;
-}
-
-static void __fake_appcore_multiwindow_base_instance_resume(
-    appcore_multiwindow_base_instance_h context) {
-  if (__is_resumed)
-    return;
-
-  __cls.resume(context, __cls.data);
-  __is_resumed = true;
-}
-
-static void __fake_appcore_multiwindow_base_instance_pause(
-    appcore_multiwindow_base_instance_h context) {
-  if (!__is_resumed)
-    return;
-
-  __cls.pause(context, __cls.data);
-  __is_resumed = false;
-}
-
-static appcore_base_event_h __fake_appcore_base_add_event(
-    enum appcore_base_event type, appcore_base_event_cb cb, void* data) {
-  __event_cb[type] = cb;
-  __event_data[type] = data;
-  return nullptr;
-}
-
-static Ecore_Evas* __fake_ecore_evas_ecore_evas_get(const Evas* evas) {
-  static int ecore_evas;
-  return reinterpret_cast<Ecore_Evas*>(&ecore_evas);
-}
-
-static Evas* __fake_evas_object_evas_get(const Eo* eo) {
-  static int evas;
-  return reinterpret_cast<Evas*>(&evas);
-}
-
-static Ecore_Wl2_Window* __fake_ecore_evas_wayland2_window_get(
-    const Ecore_Evas* ee) {
-  static int wl2_window;
-  return reinterpret_cast<Ecore_Wl2_Window*>(&wl2_window);
-}
-
-static int __fake_ecore_wl2_window_id_get(Ecore_Wl2_Window* window) {
-  return 1;
-}
-
-static int __fake_app_get_display_state(app_display_state_e *state) {
-  *state = APP_DISPLAY_STATE_ON;
-  return 0;
-}
-
-static int __fake_app_control_add_action_handler(const char* action,
-    app_control_action_cb callback, void* user_data,
-    app_control_action_h* handle) {
-  callback(action, nullptr, user_data);
-  return 0;
-}
-
-class FrameComponentTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    appcore_multiwindow_base_init_fake.custom_fake =
-        __fake_appcore_multiwindow_base_init;
-    appcore_multiwindow_base_fini_fake.custom_fake =
-        __fake_appcore_multiwindow_base_fini;
-    appcore_multiwindow_base_exit_fake.custom_fake =
-        __fake_appcore_multiwindow_base_exit;
-    appcore_multiwindow_base_instance_run_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_run;
-    appcore_multiwindow_base_class_add_fake.custom_fake =
-        __fake_appcore_multiwindow_base_class_add;
-    appcore_multiwindow_base_instance_get_id_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_get_id;
-    appcore_multiwindow_base_instance_is_resumed_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_is_resumed;
-    appcore_multiwindow_base_instance_resume_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_resume;
-    appcore_multiwindow_base_instance_pause_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_pause;
-    appcore_multiwindow_base_window_on_visibility_fake.custom_fake =
-        __fake_appcore_multiwindow_base_window_on_visibility;
-    appcore_base_add_event_fake.custom_fake =
-        __fake_appcore_base_add_event;
-
-    elm_init_fake.custom_fake =
-        __fake_elm_init;
-    elm_shutdown_fake.custom_fake =
-        __fake_elm_shutdown;
-    elm_win_util_standard_add_fake.custom_fake =
-        __fake_elm_win_util_standard_add;
-    evas_object_del_fake.custom_fake =
-        __fake_evas_object_del;
-    elm_config_accel_preference_set_fake.custom_fake =
-        __fake_elm_config_accel_preference_set;
-    ecore_wl2_window_activate_fake.custom_fake =
-        __fake_ecore_wl2_window_activate;
-    ecore_wl2_window_iconified_set_fake.custom_fake =
-        __fake_ecore_wl2_window_iconified_set;
-    ecore_wl2_display_window_find_fake.custom_fake =
-        __fake_ecore_wl2_display_window_find;
-    ecore_evas_ecore_evas_get_fake.custom_fake =
-        __fake_ecore_evas_ecore_evas_get;
-    evas_object_evas_get_fake.custom_fake =
-        __fake_evas_object_evas_get;
-    ecore_evas_wayland2_window_get_fake.custom_fake =
-        __fake_ecore_evas_wayland2_window_get;
-    ecore_wl2_window_id_get_fake.custom_fake =
-        __fake_ecore_wl2_window_id_get;
-
-    aul_app_group_set_window_v2_fake.custom_fake =
-        __fake_aul_app_group_set_window_v2;
-    aul_app_group_lower_v2_fake.custom_fake =
-        __fake_aul_app_group_lower_v2;
-    aul_comp_notify_start_fake.custom_fake =
-        __fake_aul_comp_notify_start;
-    aul_comp_status_update_fake.custom_fake =
-        __fake_aul_comp_status_update;
-
-    app_get_display_state_fake.custom_fake =
-        __fake_app_get_display_state;
-
-    app_control_add_action_handler_fake.custom_fake =
-        __fake_app_control_add_action_handler;
-  }
-
-  void TearDown() override {}
-};
-
-static Evas_Object* __frame_component_create_cb(component_h context,
-    void* user_data) {
-  return elm_win_util_standard_add("frame", "frame");
-}
-
-static void __frame_component_start_cb(component_h context,
-    app_control_h app_control, bool restarted, void* user_data) {
-  component_register_action(context, "action");
-}
-
-static void __frame_component_resume_cb(component_h context,
-    void* user_data) {
-  component_display_status_e status;
-  frame_component_get_display_status(context, &status);
-
-  Evas_Object* win = nullptr;
-  frame_component_get_window(context, &win);
-
-  int res_id = 0;
-  frame_component_get_resource_id(win, &res_id);
-}
-
-static void __frame_component_pause_cb(component_h context,
-    void* user_data) {
-}
-
-static void __frame_component_stop_cb(component_h context,
-    void* user_data) {
-}
-
-static void __frame_component_destroy_cb(component_h context,
-    void *user_data) {
-}
-
-static void __frame_component_restore_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __frame_component_save_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __frame_component_action_cb(component_h context,
-    const char* action, app_control_h app_control, void* user_data) {
-}
-
-static void __frame_component_device_orientation_changed_cb(
-    component_h context, component_device_orientation_e orientation,
-    void* user_data) {
-}
-
-static void __frame_component_language_changed_cb(component_h context,
-    const char* language, void* user_data) {
-}
-
-static void __frame_component_region_format_changed_cb(component_h context,
-    const char* region, void* user_data) {
-}
-
-static void __frame_component_low_battery_cb(component_h context,
-    component_low_battery_status_e status, void* user_data) {
-}
-
-static void __frame_component_low_memory_cb(component_h context,
-    component_low_memory_status_e status, void* user_data) {
-}
-
-static void __frame_component_suspended_state_changed_cb(component_h context,
-    component_suspended_state_e state, void* user_data) {
-}
-
-static component_class_h __frame_component_add(
-    component_class_h component_class, const char* component_id,
-    void* user_data) {
-  frame_component_lifecycle_callback_s callback;
-  callback.create =
-      __frame_component_create_cb;
-  callback.start =
-      __frame_component_start_cb;
-  callback.resume =
-      __frame_component_resume_cb;
-  callback.pause =
-      __frame_component_pause_cb;
-  callback.stop =
-      __frame_component_stop_cb;
-  callback.destroy =
-      __frame_component_destroy_cb;
-  callback.restore_content =
-      __frame_component_restore_content_cb;
-  callback.save_content =
-      __frame_component_save_content_cb;
-  callback.action =
-      __frame_component_action_cb;
-  callback.device_orientation_changed =
-      __frame_component_device_orientation_changed_cb;
-  callback.language_changed =
-      __frame_component_language_changed_cb;
-  callback.region_format_changed =
-      __frame_component_region_format_changed_cb;
-  callback.low_battery =
-      __frame_component_low_battery_cb;
-  callback.low_memory =
-      __frame_component_low_memory_cb;
-  callback.suspended_state_changed =
-      __frame_component_suspended_state_changed_cb;
-
-  return component_based_app_add_frame_component(component_class,
-      component_id, &callback, user_data);
-}
-
-static component_class_h __component_based_app_create_cb(void* user_data) {
-  component_class_h component_class = nullptr;
-  component_class = __frame_component_add(component_class,
-      "test-frame-component", user_data);
-
-  return component_class;
-}
-
-static void __component_based_app_terminate_cb(void* user_data) {
-
-}
-
-TEST_F(FrameComponentTest, frame_component_test) {
-  component_based_app_lifecycle_callback_s callback;
-  callback.create = __component_based_app_create_cb;
-  callback.terminate = __component_based_app_terminate_cb;
-
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  int ret = component_based_app_main(argc, argv, &callback, this);
-  EXPECT_EQ(ret, APP_ERROR_NONE);
-}
-
-}  // namespace
diff --git a/unit_tests/src/efl_base/test_service_component.cc b/unit_tests/src/efl_base/test_service_component.cc
deleted file mode 100644 (file)
index 2ccff4c..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <glib.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-#include <aul.h>
-#include <bundle.h>
-
-#include <memory>
-
-#include "component_based/efl_base/api/frame_component.h"
-#include "component_based/efl_base/api/service_component.h"
-#include "component_based/efl_base/api/component_based_app.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_app_control.h"
-#include "mock/mock_appcore_multiwindow_base.h"
-#include "mock/mock_aul.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-static appcore_multiwindow_base_ops __ops;
-static int __argc;
-static char** __argv;
-static void* __user_data;
-static appcore_multiwindow_base_class __cls;
-static appcore_base_event_cb __event_cb[APPCORE_BASE_EVENT_MAX];
-static void* __event_data[APPCORE_BASE_EVENT_MAX];
-
-static int __fake_aul_comp_notify_start(const char *id) {
-  return 0;
-}
-
-static int __fake_aul_comp_status_update(const char *id, int status) {
-  return 0;
-}
-
-static void __generate_system_event(void)
-{
-  char lang[] = "en-US";
-  int intval = 1;
-  void* event;
-
-  for (int i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
-    if (i == APPCORE_BASE_EVENT_LANG_CHANGE ||
-        i == APPCORE_BASE_EVENT_REGION_CHANGE) {
-      event = static_cast<void*>(lang);
-    } else {
-      event = static_cast<void*>(&intval);
-    }
-
-    if (__event_cb[i]) {
-      __event_cb[i](event, __event_data[i]);
-    }
-  }
-}
-
-static int __fake_appcore_multiwindow_base_init(
-    appcore_multiwindow_base_ops ops,
-    int argc,
-    char** argv,
-    void* user_data) {
-  __ops = ops;
-  __argc = argc;
-  __argv = argv;
-  __user_data = user_data;
-
-  __ops.base.init(__argc, __argv, __user_data);
-  __ops.base.create(__user_data);
-  __ops.base.run(__user_data);
-
-  bundle* b = bundle_create();
-  bundle_add_str(b, AUL_K_COMPONENT_ID, "test-service-component");
-  bundle_add_str(b, AUL_K_INSTANCE_ID, "@test-service-component");
-  bundle_add_str(b, AUL_K_NEW_INSTANCE, "true");
-  std::unique_ptr<bundle, decltype(bundle_free)*> ptr(b, bundle_free);
-
-  __ops.base.receive(AUL_START, b, __user_data);
-
-  __generate_system_event();
-
-  __ops.base.control(b, __user_data);
-
-  __ops.base.receive(AUL_RESUME, b, __user_data);
-  __ops.base.receive(AUL_PAUSE, b, __user_data);
-
-  __ops.base.receive(AUL_WAKE, b, __user_data);
-  __ops.base.receive(AUL_SUSPEND, b, __user_data);
-
-  __ops.base.receive(AUL_TERMINATE_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BG_INST, b, __user_data);
-  __ops.base.receive(AUL_TERMINATE_BGAPP, b, __user_data);
-
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_fini(void) {
-  __cls.terminate(nullptr, __cls.data);
-
-  __ops.base.terminate(__user_data);
-  __ops.base.finish();
-}
-
-static void __fake_appcore_multiwindow_base_exit(void) {
-  __ops.base.exit(__user_data);
-}
-
-static int __fake_elm_init(int argc, char** argv) {
-  return 0;
-}
-
-static int __fake_elm_shutdown(void) {
-  return 0;
-}
-
-static void __fake_appcore_multiwindow_base_class_add(
-    appcore_multiwindow_base_class cls) {
-  __cls = cls;
-}
-
-static appcore_multiwindow_base_instance_h
-__fake_appcore_multiwindow_base_instance_run(const char* class_id,
-    const char* id, void* extra)
-{
-  static appcore_multiwindow_base_instance_h inst =
-      reinterpret_cast<appcore_multiwindow_base_instance_h>(&inst);
-
-  __cls.create(inst, __cls.data);
-
-  return inst;
-}
-
-static const char* __fake_appcore_multiwindow_base_instance_get_id(
-    appcore_multiwindow_base_instance_h context) {
-  return "@test-service-component";
-}
-
-static appcore_base_event_h __fake_appcore_base_add_event(
-    enum appcore_base_event type, appcore_base_event_cb cb, void* data) {
-  __event_cb[type] = cb;
-  __event_data[type] = data;
-  return nullptr;
-}
-
-static int __fake_app_control_add_action_handler(const char* action,
-    app_control_action_cb callback, void* user_data,
-    app_control_action_h* handle) {
-  callback(action, nullptr, user_data);
-  return 0;
-}
-
-static int __fake_app_control_send_launch_request_async(
-    app_control_h app_control,
-    app_control_result_cb result_cb,
-    app_control_reply_cb reply_cb,
-    void* user_data) {
-  result_cb(app_control, APP_CONTROL_ERROR_NONE, user_data);
-  reply_cb(app_control, app_control, APP_CONTROL_RESULT_SUCCEEDED, user_data);
-  return 0;
-}
-
-static int __fake_app_control_send_launch_request_sync(
-    app_control_h app_control,
-    app_control_h* reply,
-    app_control_result_e* result) {
-  app_control_h handle = nullptr;
-  app_control_create(&handle);
-  *reply = handle;
-  *result = APP_CONTROL_RESULT_SUCCEEDED;
-  return 0;
-}
-
-class ServiceComponentTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    appcore_multiwindow_base_init_fake.custom_fake =
-        __fake_appcore_multiwindow_base_init;
-    appcore_multiwindow_base_fini_fake.custom_fake =
-        __fake_appcore_multiwindow_base_fini;
-    appcore_multiwindow_base_exit_fake.custom_fake =
-        __fake_appcore_multiwindow_base_exit;
-    appcore_multiwindow_base_instance_run_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_run;
-    appcore_multiwindow_base_class_add_fake.custom_fake =
-        __fake_appcore_multiwindow_base_class_add;
-    appcore_multiwindow_base_instance_get_id_fake.custom_fake =
-        __fake_appcore_multiwindow_base_instance_get_id;
-    appcore_base_add_event_fake.custom_fake =
-        __fake_appcore_base_add_event;
-
-    elm_init_fake.custom_fake =
-        __fake_elm_init;
-    elm_shutdown_fake.custom_fake =
-        __fake_elm_shutdown;
-    aul_comp_notify_start_fake.custom_fake =
-        __fake_aul_comp_notify_start;
-    aul_comp_status_update_fake.custom_fake =
-        __fake_aul_comp_status_update;
-    app_control_add_action_handler_fake.custom_fake =
-        __fake_app_control_add_action_handler;
-    app_control_send_launch_request_async_fake.custom_fake =
-        __fake_app_control_send_launch_request_async;
-    app_control_send_launch_request_sync_fake.custom_fake =
-        __fake_app_control_send_launch_request_sync;
-  }
-
-  void TearDown() override {}
-};
-
-static void __app_control_result_cb(app_control_h request,
-    app_control_error_e result, void* user_data) {
-}
-
-static void __app_control_reply_cb(app_control_h request,
-    app_control_h reply, app_control_result_e result, void* user_data) {
-}
-
-static bool __service_component_create_cb(component_h context,
-    void* user_data) {
-  char* id = nullptr;
-  component_get_id(context, &id);
-  free(id);
-
-  char* inst_id = nullptr;
-  component_get_instance_id(context, &inst_id);
-  free(inst_id);
-  return true;
-}
-
-static void __service_component_start_command_cb(component_h context,
-    app_control_h app_control, bool restarted, void* user_data) {
-  component_register_action(context, "action");
-  component_deregister_action(context, "action");
-
-  app_control_h handle = nullptr;
-  app_control_create(&handle);
-  component_send_launch_request_async(context, handle, __app_control_result_cb,
-      __app_control_reply_cb, nullptr);
-
-  app_control_h reply = nullptr;
-  app_control_result_e result;
-  component_send_launch_request_sync(context, handle, &reply, &result);
-  app_control_destroy(reply);
-  app_control_destroy(handle);
-
-  component_finish(context);
-}
-
-static void __service_component_destroy_cb(component_h context,
-    void *user_data) {
-}
-
-static void __service_component_restore_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __service_component_save_content_cb(component_h context,
-    bundle* content, void* user_data) {
-}
-
-static void __service_component_action_cb(component_h context,
-    const char* action, app_control_h app_control, void* user_data) {
-}
-
-static void __service_component_device_orientation_changed_cb(
-    component_h context, component_device_orientation_e orientation,
-    void* user_data) {
-}
-
-static void __service_component_language_changed_cb(component_h context,
-    const char* language, void* user_data) {
-}
-
-static void __service_component_region_format_changed_cb(component_h context,
-    const char* region, void* user_data) {
-}
-
-static void __service_component_low_battery_cb(component_h context,
-    component_low_battery_status_e status, void* user_data) {
-}
-
-static void __service_component_low_memory_cb(component_h context,
-    component_low_memory_status_e status, void* user_data) {
-}
-
-static void __service_component_suspended_state_changed_cb(component_h context,
-    component_suspended_state_e state, void* user_data) {
-}
-
-static component_class_h __service_component_add(
-    component_class_h component_class, const char* component_id,
-    void* user_data) {
-  service_component_lifecycle_callback_s callback;
-  callback.create =
-      __service_component_create_cb;
-  callback.start_command =
-      __service_component_start_command_cb;
-  callback.destroy =
-      __service_component_destroy_cb;
-  callback.restore_content =
-      __service_component_restore_content_cb;
-  callback.save_content =
-      __service_component_save_content_cb;
-  callback.action =
-      __service_component_action_cb;
-  callback.device_orientation_changed =
-      __service_component_device_orientation_changed_cb;
-  callback.language_changed =
-      __service_component_language_changed_cb;
-  callback.region_format_changed =
-      __service_component_region_format_changed_cb;
-  callback.low_battery =
-      __service_component_low_battery_cb;
-  callback.low_memory =
-      __service_component_low_memory_cb;
-  callback.suspended_state_changed =
-      __service_component_suspended_state_changed_cb;
-
-  return component_based_app_add_service_component(component_class,
-      component_id, &callback, user_data);
-}
-
-static component_class_h __component_based_app_create_cb(void* user_data) {
-  component_class_h component_class = nullptr;
-  component_class = __service_component_add(component_class,
-      "test-service-component", user_data);
-
-  return component_class;
-}
-
-static void __component_based_app_terminate_cb(void* user_data) {
-}
-
-TEST_F(ServiceComponentTest, service_component_test) {
-  component_based_app_lifecycle_callback_s callback;
-  callback.create = __component_based_app_create_cb;
-  callback.terminate = __component_based_app_terminate_cb;
-
-  int argc = 1;
-  char tmp_arg[] = "test";
-  char** argv = reinterpret_cast<char**>(&tmp_arg);
-
-  int ret = component_based_app_main(argc, argv, &callback, this);
-  EXPECT_EQ(ret, APP_ERROR_NONE);
-}
-
-}  // namespace
diff --git a/unit_tests/src/test_component_based_app_control.cc b/unit_tests/src/test_component_based_app_control.cc
deleted file mode 100644 (file)
index fff17b5..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-
-#include <iostream>
-#include <memory>
-
-#include "mock/mock_app_control.h"
-#include "component_based/app_control/component_based_app_control.h"
-
-static const char ENCODED_URI[] = "https:%2F%2Fjohn.doe%40www.example.com%3A123%2Fforum%2Fquestions%2F?tag=networking&order=newest#top";
-static const char MIME_TYPE[] = "application/octet-stream";
-
-class AppControlTest : public testing::Test {
- public:
-  virtual void SetUp() { }
-  virtual void TearDown() {}
-};
-
-TEST_F(AppControlTest, AppControl_Builder) {
-  std::unique_ptr<component_based::AppControl::Builder> builder(
-      new component_based::AppControl::Builder());
-  EXPECT_NE(builder, nullptr);
-
-  builder->SetAppID("org.tizen.helloworld");
-  builder->SetOperation(APP_CONTROL_OPERATION_DEFAULT);
-  builder->SetLaunchMode(component_based::AppControl::LaunchMode::SINGLE);
-
-  component_based::Uri uri(ENCODED_URI);
-  builder->SetUri(uri);
-  builder->SetMime(MIME_TYPE);
-  builder->AddExtra("key", "value");
-  builder->SetComponentID("ElmFrame");
-
-  component_based::AppControl ctrl = builder->Build();
-  EXPECT_EQ(ctrl.GetAppID(), "org.tizen.helloworld");
-  EXPECT_EQ(ctrl.GetOperation(), APP_CONTROL_OPERATION_DEFAULT);
-  EXPECT_EQ(ctrl.GetLaunchMode(),
-      component_based::AppControl::LaunchMode::SINGLE);
-  EXPECT_EQ(ctrl.GetUri().Encode(), ENCODED_URI);
-  EXPECT_EQ(ctrl.GetMime(), MIME_TYPE);
-  EXPECT_EQ(ctrl.GetExtra("key"), "value");
-  EXPECT_EQ(ctrl.GetComponentID(), "ElmFrame");
-}
-
-TEST_F(AppControlTest, AppControl_Constructor) {
-  std::unique_ptr<component_based::AppControl::Builder> builder(
-      new component_based::AppControl::Builder());
-  EXPECT_NE(builder, nullptr);
-
-  builder->SetAppID("org.tizen.helloworld");
-  builder->SetOperation(APP_CONTROL_OPERATION_DEFAULT);
-  builder->SetLaunchMode(component_based::AppControl::LaunchMode::SINGLE);
-
-  component_based::Uri uri(ENCODED_URI);
-  builder->SetUri(uri);
-  builder->SetMime(MIME_TYPE);
-  builder->AddExtra("key", "value");
-  builder->SetComponentID("ElmFrame");
-
-  component_based::AppControl ctrl = builder->Build();
-
-  component_based::AppControl ctrl1(ctrl);
-  ctrl1 = ctrl;
-  component_based::AppControl ctrl3(std::move(ctrl));
-  ctrl3 = std::move(ctrl);
-}
diff --git a/unit_tests/src/test_component_based_application.cc b/unit_tests/src/test_component_based_application.cc
deleted file mode 100644 (file)
index cdad67a..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-
-#include "component_based/base/frame_component.h"
-#include "component_based/efl_base/application.h"
-#include "component_based/efl_base/elm_window.h"
-
-#include "mock/mock_app_common.h"
-#include "mock/mock_elementary.h"
-
-namespace {
-
-class ComponentBasedApplicationTest : public ::testing::Test {
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-class SimpleFrameComp : public component_based::FrameComponent {
- public:
-  class Factory : public component_based::Component::Factory {
-   public:
-    std::unique_ptr<component_based::Component> Create(std::string comp_id,
-              std::string inst_id, tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
-          new SimpleFrameComp(std::move(comp_id), std::move(inst_id)));
-    }
-  };
-
-  SimpleFrameComp(std::string comp_id, std::string inst_id)
-    : FrameComponent(std::move(comp_id), std::move(inst_id)) {
-  }
-
-  std::unique_ptr<component_based::IWindow> OnCreate() override {
-    return std::unique_ptr<component_based::IWindow>(new component_based::ElmWindow(GetInstanceID()));
-  }
-
-  void OnStart(component_based::AppControl app_control, bool restarted) override {
-  }
-
-  void OnResume() override {
-  }
-
-  void OnPause() override {
-  }
-
-  void OnStop() override {
-  }
-
-  void OnDestroy() override {
-  }
-};
-
-class ServiceComp : public component_based::ServiceComponent {
- public:
-  class Factory : public component_based::Component::Factory {
-   public:
-    std::unique_ptr<component_based::Component> Create(
-        std::string comp_id, std::string inst_id,
-        tizen_base::Bundle& start_data) override {
-      return std::unique_ptr<component_based::Component>(
-          new ServiceComp(std::move(comp_id), std::move(inst_id)));
-    }
-  };
-
-  ServiceComp(std::string comp_id, std::string inst_id)
-    : ServiceComponent(std::move(comp_id), std::move(inst_id)) {
-  }
-
-  bool OnCreate() override {
-    return true;
-  }
-
-  void OnStartCommand(component_based::AppControl app_control,
-                      bool restarted) override {
-  }
-
-  void OnDestroy() override {
-  }
-};
-
-int __fake_app_get_id(char** app_id) {
-  char id[] = "component_base_test";
-  *app_id = strdup(id);
-  return 0;
-}
-
-int __fake_elm_init(int argc, char** argv) {
-  return 0;
-}
-
-int __fake_elm_shutdown() {
-  return 0;
-}
-
-void __fake_elm_run() {
-  return;
-}
-
-void __fake_elm_exit() {
-  return;
-}
-
-Evas_Object* __fake_elm_win_util_standard_add(const char* name,
-    const char* title)
-{
-  return nullptr;
-}
-
-Evas* __fake_evas_object_evas_get(const Eo* win)
-{
-  return nullptr;
-}
-
-Ecore_Evas* __fake_ecore_evas_ecore_evas_get(const Evas* evas)
-{
-  return nullptr;
-}
-
-Ecore_Wl2_Window* __fake_ecore_evas_wayland2_window_get(const Ecore_Evas* ecore_evas)
-{
-  return nullptr;
-}
-
-int __fake_ecore_wl2_window_id_get(Ecore_Wl2_Window* wl_win)
-{
-  return 1;
-}
-
-TEST_F(ComponentBasedApplicationTest, ApplicationLifeCycle) {
-  app_get_id_fake.custom_fake = __fake_app_get_id;
-  elm_init_fake.custom_fake = __fake_elm_init;
-  elm_shutdown_fake.custom_fake = __fake_elm_shutdown;
-  elm_run_fake.custom_fake = __fake_elm_run;
-  elm_exit_fake.custom_fake = __fake_elm_exit;
-
-  char* argv[6];
-
-  std::unique_ptr<component_based::Application> app(
-      new component_based::Application());
-
-  app->OnInit(2, argv);
-  app->OnRun();
-  app->OnExit();
-  app->OnFini();
-}
-
-TEST_F(ComponentBasedApplicationTest, ElmWindow) {
-  elm_win_util_standard_add_fake.custom_fake = __fake_elm_win_util_standard_add;
-  evas_object_evas_get_fake.custom_fake = __fake_evas_object_evas_get;
-  ecore_evas_ecore_evas_get_fake.custom_fake = __fake_ecore_evas_ecore_evas_get;
-  ecore_evas_wayland2_window_get_fake.custom_fake =
-    __fake_ecore_evas_wayland2_window_get;
-  ecore_wl2_window_id_get_fake.custom_fake = __fake_ecore_wl2_window_id_get;
-
-  std::unique_ptr<component_based::ElmWindow> ew(
-      new component_based::ElmWindow("id"));
-
-  int resId = ew->GetResID();
-  EXPECT_EQ(resId, 1);
-  ew->GetRaw();
-}
-
-}  // namespace
diff --git a/unit_tests/src/test_component_based_uri.cc b/unit_tests/src/test_component_based_uri.cc
deleted file mode 100644 (file)
index 6bcd9ca..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-
-#include <iostream>
-#include <memory>
-
-#include "component_based/uri/component_based_uri.h"
-
-// The source of the following example is "https://en.wikipedia.org/wiki/Uniform_Resource_Identifier"
-static const char EXAM_URI1[] = "https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top";
-static const char EXAM_URI2[] = "ldap://[2001:db8::7]/c=GB?objectClass?one";
-static const char EXAM_URI3[] = "mailto:John.Doe@example.com";
-static const char EXAM_URI4[] = "news:comp.infosystems.www.servers.unix";
-static const char EXAM_URI5[] = "tel:+1-816-555-1212";
-static const char EXAM_URI6[] = "telnet://192.0.2.16:80/";
-static const char EXAM_URI7[] = "urn:oasis:names:specification:docbook:dtd:xml:4.1.2";
-
-static const char ENCODED_URI1[] = "https:%2F%2Fjohn.doe%40www.example.com%3A123%2Fforum%2Fquestions%2F?tag=networking&order=newest#top";
-static const char ENCODED_URI2[] = "ldap:%2F%2F%5B2001%3Adb8%3A%3A7%5D%2Fc%3DGB?objectClass?one";
-static const char ENCODED_URI3[] = "mailto:John.Doe%40example.com";
-static const char ENCODED_URI4[] = "news:comp.infosystems.www.servers.unix";
-static const char ENCODED_URI5[] = "tel:%2B1-816-555-1212";
-static const char ENCODED_URI6[] = "telnet:%2F%2F192.0.2.16%3A80%2F";
-static const char ENCODED_URI7[] = "urn:oasis%3Anames%3Aspecification%3Adocbook%3Adtd%3Axml%3A4.1.2";
-
-extern int gargc;
-extern char** gargv;
-
-class UriTest : public testing::Test {
- public:
-  virtual ~UriTest() {}
-
-  virtual void SetUp() {
-    std::string exam_uri[] = {
-      ENCODED_URI1,
-      ENCODED_URI2,
-      ENCODED_URI3,
-      ENCODED_URI4,
-      ENCODED_URI5,
-      ENCODED_URI6,
-      ENCODED_URI7,
-    };
-
-    for (int i = 0; i < 7; i++) {
-      uri_list_[i] = std::unique_ptr<component_based::Uri>(
-          new component_based::Uri(exam_uri[i]));
-    }
-  }
-
-  virtual void TearDown() {}
-
-  std::unique_ptr<component_based::Uri> uri_list_[7];
-};
-
-/*
- * @testcase Uri_Constructor
- * @description Creates a Uri object.
- * @apicovered component_based::Uri
- */
-TEST_F(UriTest, Uri_Constructor) {
-  std::unique_ptr<component_based::Uri> uri =
-      std::unique_ptr<component_based::Uri>(
-          new component_based::Uri(ENCODED_URI1));
-  EXPECT_NE(uri, nullptr);
-}
-
-/*
- * @testcase Uri_GetScheme
- * @description Gets a scheme component from a URI object.
- * @apicovered component_based::Uri::GetScheme
- */
-TEST_F(UriTest, Uri_GetScheme) {
-  std::string exam_scheme[] = {
-    "https",
-    "ldap",
-    "mailto",
-    "news",
-    "tel",
-    "telnet",
-    "urn",
-  };
-
-  for (int i = 0; i < 7; i++) {
-    EXPECT_EQ(uri_list_[i]->GetScheme(), exam_scheme[i]);
-  }
-}
-
-/*
- * @testcase Uri_GetAuthority
- * @description Gets an authority component from a URI object.
- * @apicovered component_based::Uri::GetAuthority
- */
-TEST_F(UriTest, Uri_GetAuthority) {
-  std::string exam_auth[] = {
-    "//john.doe@www.example.com:123",
-    "//[2001:db8::7]",
-    "",
-    "",
-    "",
-    "//192.0.2.16:80",
-    "",
-  };
-
-  for (int i = 0; i < 7; i++) {
-    EXPECT_EQ(uri_list_[i]->GetAuthority(), exam_auth[i]);
-  }
-}
-
-/*
- * @testcase Uri_GetPath
- * @description Gets a path component from a URI object.
- * @apicovered component_based::Uri::GetPath
- */
-TEST_F(UriTest, Uri_GetPath) {
-  std::string exam_path[] = {
-    "/forum/questions/",
-    "/c=GB",
-    "John.Doe@example.com",
-    "comp.infosystems.www.servers.unix",
-    "+1-816-555-1212",
-    "/",
-    "oasis:names:specification:docbook:dtd:xml:4.1.2",
-  };
-
-  for (int i = 0; i < 7; i++) {
-    EXPECT_EQ(uri_list_[i]->GetPath(), exam_path[i]);
-  }
-}
-
-/*
- * @testcase Uri_GetFragment
- * @description Gets a fragment component from a URI object.
- * @apicovered component_based::Uri::GetFragment
- */
-TEST_F(UriTest, Uri_GetFragment) {
-  std::string exam_fragment[] = {
-    "top",
-    "",
-    "",
-    "",
-    "",
-    "",
-    "",
-  };
-
-  for (int i = 0; i < 7; i++) {
-    EXPECT_EQ(uri_list_[i]->GetFragment(), exam_fragment[i]);
-  }
-}
-
-/*
- * @testcase Uri_GetHost
- * @description Gets a host subcomponent from a URI object.
- * @apicovered component_based::Uri::GetHost
- */
-TEST_F(UriTest, Uri_GetHost) {
-  std::string exam_host[] = {
-    "www.example.com",
-    "[2001:db8::7]",
-    "",
-    "",
-    "",
-    "192.0.2.16",
-    "",
-  };
-
-  for (int i = 0; i < 7; i++) {
-    EXPECT_EQ(uri_list_[i]->GetHost(), exam_host[i]);
-  }
-}
-
-/*
- * @testcase Uri_GetPort
- * @description Gets a port subcomponent from a URI object.
- * @apicovered component_based::Uri::GetPort
- */
-TEST_F(UriTest, Uri_GetPort) {
-  std::string exam_port[] = {
-    "123",
-    "",
-    "",
-    "",
-    "",
-    "80",
-    "",
-  };
-
-  for (int i = 0; i < 7; i++) {
-    EXPECT_EQ(uri_list_[i]->GetPort(), exam_port[i]);
-  }
-}
-
-/*
- * @testcase Uri_GetUser
- * @description Gets a user subcomponent from a URI object.
- * @apicovered component_based::Uri::GetUser
- */
-TEST_F(UriTest, Uri_GetUser) {
-  std::string exam_user[] = {
-    "john.doe",
-    "",
-    "",
-    "",
-    "",
-    "",
-    "",
-  };
-
-  for (int i = 0; i < 7; i++) {
-    EXPECT_EQ(uri_list_[i]->GetUser(), exam_user[i]);
-  }
-}
-
-/*
- * @testcase Uri_GetQuery
- * @description Gets a query component from a URI object.
- * @apicovered component_based::Uri::GetQuery
- */
-TEST_F(UriTest, Uri_GetQuery) {
-  int match_count = 0;
-  auto& query = uri_list_[0]->GetQuery();
-  for (auto& q : query) {
-    if (q.GetKey() == "tag" &&
-        q.GetValue() == "networking") {
-      match_count++;
-    } else if (q.GetKey() == "order" &&
-               q.GetValue() == "newest") {
-      match_count++;
-    }
-  }
-
-  EXPECT_EQ(match_count, 2);
-}
-
-/*
- * @testcase Uri_Encode
- * @description Encodes a URI object to string.
- * @apicovered component_base::Uri::Encode
- */
-TEST_F(UriTest, Uri_Encode) {
-  std::unique_ptr<component_based::Uri> uri =
-      std::unique_ptr<component_based::Uri>(
-          new component_based::Uri(EXAM_URI1));
-  EXPECT_NE(uri, nullptr);
-  EXPECT_EQ(uri->Encode(), ENCODED_URI1);
-}
-
-/*
- * @testcase Uri_Builder
- * @description Builds a URI builder object to create a URI object.
- * @apicovered component_based::Uri::Builder,
- *             component_based::Uri::Builder::SetScheme,
- *             component_based::Uri::Builder::SetAuthority,
- *             component_based::Uri::Builder::SetPath,
- *             component_based::Uri::Builder::AddQuery,
- *             component_based::Uri::Builder::SetFragment,
- *             component_based::Uri::Builder::Build
- */
-TEST_F(UriTest, Uri_Builder) {
-  std::unique_ptr<component_based::Uri::Builder> builder(
-      new component_based::Uri::Builder());
-  EXPECT_NE(builder, nullptr);
-  builder->SetScheme("https");
-  builder->SetAuthority("//john.doe@www.example.com:123");
-  builder->SetPath("/forum");
-  builder->AddPath("questions/");
-  builder->AddQuery("tag", "networking");
-  builder->AddQuery("order", "newest");
-  builder->SetFragment("top");
-
-  component_based::Uri uri = builder->Build();
-  EXPECT_EQ(uri.Encode(), ENCODED_URI1);
-}
diff --git a/unit_tests/src/test_main.cc b/unit_tests/src/test_main.cc
deleted file mode 100644 (file)
index ab0f087..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-int main(int argc, char** argv){
-  int ret = -1;
-  try {
-    testing::InitGoogleTest(&argc, argv);
-  } catch(...) {
-    std::cout << "Exception occurred" << std::endl;
-  }
-
-  try {
-    ret = RUN_ALL_TESTS();
-  } catch (const ::testing::internal::GoogleTestFailureException& e) {
-    ret = -1;
-    std::cout << "GoogleTestFailureException was thrown:" << e.what() <<
-        std::endl;
-  }
-
-  return ret;
-}