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
18 * @author Kyungwook Tak(k.tak@samsung.com)
21 #define BOOST_TEST_MODULE CSR_API_TEST
22 #include <boost/test/unit_test.hpp>
23 #include <boost/test/unit_test_log.hpp>
24 #include <boost/test/results_reporter.hpp>
25 #include <colour_log_formatter.h>
27 #include <csr-engine-manager.h>
31 csr_state_e setEngineState(csr_engine_id_e id, csr_state_e state)
34 auto ret = csr_get_current_engine(id, &handle);
35 if (ret != CSR_ERROR_NONE)
36 throw std::logic_error("Failed to csr_get_current_engine.");
39 ret = csr_engine_get_state(handle, ¤t);
40 if (ret != CSR_ERROR_NONE)
41 throw std::logic_error("Failed to csr_get_state.");
46 ret = csr_engine_set_state(handle, state);
47 if (ret != CSR_ERROR_NONE)
48 throw std::logic_error("Failed to csr_engine_set_state.");
58 boost::unit_test::unit_test_log.set_threshold_level(
59 boost::unit_test::log_test_units);
60 boost::unit_test::results_reporter::set_level(boost::unit_test::SHORT_REPORT);
61 boost::unit_test::unit_test_log.set_formatter(new Csr::Test::colour_log_formatter);
65 bool isEngineInitialized = false;
69 m_oldCsState = setEngineState(CSR_ENGINE_CS, CSR_STATE_ENABLE);
70 m_oldWpState = setEngineState(CSR_ENGINE_WP, CSR_STATE_ENABLE);
75 setEngineState(CSR_ENGINE_CS, m_oldCsState);
76 setEngineState(CSR_ENGINE_WP, m_oldWpState);
79 csr_state_e m_oldCsState;
80 csr_state_e m_oldWpState;
83 BOOST_GLOBAL_FIXTURE(TestConfig)
84 BOOST_GLOBAL_FIXTURE(Initializer)