2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
17 * @file test-api-engine-manager.cpp
18 * @author Kyungwook Tak (k.tak@samsung.com)
20 * @brief CSR Engine manager API test
22 #include <csr/engine-manager.h>
25 #include <boost/test/unit_test.hpp>
27 #include "test-common.h"
33 Engine(csr_engine_id_e id)
35 ASSERT_IF(csr_get_current_engine(id, &m_engine), CSR_ERROR_NONE);
40 ASSERT_IF(csr_engine_destroy(m_engine), CSR_ERROR_NONE);
43 csr_engine_h &get(void)
49 csr_engine_h m_engine;
52 } // namespace anonymous
54 BOOST_AUTO_TEST_SUITE(API_ENGINE_MANAGER)
55 BOOST_AUTO_TEST_SUITE(CS)
57 BOOST_AUTO_TEST_CASE(fields_getters)
61 Engine e(CSR_ENGINE_CS);
63 const char *vendor = nullptr;
64 ASSERT_IF(csr_engine_get_vendor(e.get(), &vendor), CSR_ERROR_NONE);
65 ASSERT_IF(std::string("TEST_VENDOR"), vendor);
67 const char *name = nullptr;
68 ASSERT_IF(csr_engine_get_name(e.get(), &name), CSR_ERROR_NONE);
69 ASSERT_IF(std::string("TEST_LOCAL_TCS_ENGINE"), name);
71 const char *version = nullptr;
72 ASSERT_IF(csr_engine_get_version(e.get(), &version), CSR_ERROR_NONE);
73 ASSERT_IF(std::string("0.0.1"), version);
75 const char *dataVersion = nullptr;
76 ASSERT_IF(csr_engine_get_version(e.get(), &dataVersion), CSR_ERROR_NONE);
77 ASSERT_IF(std::string("0.0.1"), dataVersion);
79 csr_activated_e activated;
80 ASSERT_IF(csr_engine_get_activated(e.get(), &activated), CSR_ERROR_NONE);
81 ASSERT_IF(activated, CSR_ACTIVATED);
83 csr_state_e state = CSR_ENABLE;
84 ASSERT_IF(csr_engine_set_state(e.get(), state), CSR_ERROR_NONE);
86 ASSERT_IF(csr_engine_get_state(e.get(), &state), CSR_ERROR_NONE);
87 ASSERT_IF(state, CSR_ENABLE);
92 BOOST_AUTO_TEST_SUITE_END() // CS
94 BOOST_AUTO_TEST_SUITE(WP)
96 BOOST_AUTO_TEST_CASE(fields_getters)
100 Engine e(CSR_ENGINE_WP);
102 const char *vendor = nullptr;
103 ASSERT_IF(csr_engine_get_vendor(e.get(), &vendor), CSR_ERROR_NONE);
104 ASSERT_IF(std::string("TEST_VENDOR"), vendor);
106 const char *name = nullptr;
107 ASSERT_IF(csr_engine_get_name(e.get(), &name), CSR_ERROR_NONE);
108 ASSERT_IF(std::string("TEST_LOCAL_TWP_ENGINE"), name);
110 const char *version = nullptr;
111 ASSERT_IF(csr_engine_get_version(e.get(), &version), CSR_ERROR_NONE);
112 ASSERT_IF(std::string("0.0.1"), version);
114 const char *dataVersion = nullptr;
115 ASSERT_IF(csr_engine_get_version(e.get(), &dataVersion), CSR_ERROR_NONE);
116 ASSERT_IF(std::string("0.0.1"), dataVersion);
118 csr_activated_e activated;
119 ASSERT_IF(csr_engine_get_activated(e.get(), &activated), CSR_ERROR_NONE);
120 ASSERT_IF(activated, CSR_ACTIVATED);
122 csr_state_e state = CSR_ENABLE;
123 ASSERT_IF(csr_engine_set_state(e.get(), state), CSR_ERROR_NONE);
125 ASSERT_IF(csr_engine_get_state(e.get(), &state), CSR_ERROR_NONE);
126 ASSERT_IF(state, CSR_ENABLE);
131 BOOST_AUTO_TEST_SUITE_END() // WP
132 BOOST_AUTO_TEST_SUITE_END() // API_ENGINE_MANAGER