Merging tizen into ckm. Stage 1.
[platform/core/test/security-tests.git] / tests / framework / include / dpl / test / test_results_collector_commons.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /*
17  * @file        test_results_collector_commons.h
18  * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
19  * @version     1.0
20  * @brief       Header file containing declarations of collectors common
21  *              functions and macros
22  */
23
24 #ifndef DPL_TEST_RESULTS_COLLECTOR_COMMONS_H
25 #define DPL_TEST_RESULTS_COLLECTOR_COMMONS_H
26
27 #include <chrono>
28 #include <string>
29
30 namespace DPL {
31 namespace Test {
32
33 #define GREEN_RESULT_OK "[%s%s%s]\n", BOLD_GREEN_BEGIN, "   OK   ", \
34     BOLD_GREEN_END
35 #define GREEN_RESULT_OK_TIME "[%s%s%s] [elapsed: %0.3fms]\n", BOLD_GREEN_BEGIN, \
36     "   OK   ", BOLD_GREEN_END
37 #define GREEN_RESULT_OK_TIME_MAX(elapsed, max) \
38     "[%s%s%s] %s[elapsed: %0.3fms, expected < %0.3fms]%s\n", BOLD_GREEN_BEGIN, \
39     "   OK   ", BOLD_GREEN_END, BOLD_GREEN_BEGIN, elapsed, max, BOLD_GREEN_END
40 #define GREEN_RESULT_OK_TIME_TOO_LONG(elapsed, max) \
41     "[%s%s%s] %s[elapsed: %0.3fms, expected < %0.3fms]%s\n", BOLD_GREEN_BEGIN, \
42     "   OK   ", BOLD_GREEN_END, BOLD_RED_BEGIN, elapsed, max, BOLD_RED_END
43
44 // Get duration as a fraction of millisecond (max precision is 1 microsecond)
45 double get_milliseconds (const std::chrono::system_clock::duration& performanceTime);
46
47 bool ParseCollectorFileArg(const std::string &arg, std::string &filename);
48
49 } // namespace Test
50 } // namespace DPL
51
52 #endif // DPL_TEST_RESULTS_COLLECTOR_COMMONS_H