OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_VOICE_ENGINE_VOE_TEST_DEFINES_H | |
12 #define WEBRTC_VOICE_ENGINE_VOE_TEST_DEFINES_H | |
13 | |
14 #include "webrtc/voice_engine/test/auto_test/voe_test_common.h" | |
15 | |
16 // Select the tests to execute, list order below is same as they will be | |
17 // executed. Note that, all settings below will be overriden by sub-API | |
18 // settings in voice_engine_configurations.h. | |
19 #define _TEST_BASE_ | |
20 #define _TEST_RTP_RTCP_ | |
21 #define _TEST_CODEC_ | |
22 #define _TEST_FILE_ | |
23 #define _TEST_NETWORK_ | |
24 | |
25 // Enable this when running instrumentation of some kind to exclude tests | |
26 // that will not pass due to slowed down execution. | |
27 // #define _INSTRUMENTATION_TESTING_ | |
28 | |
29 // Some parts can cause problems while running Insure | |
30 #ifdef __INSURE__ | |
31 #define _INSTRUMENTATION_TESTING_ | |
32 #endif | |
33 | |
34 #define MARK() TEST_LOG("."); fflush(NULL); // Add test marker | |
35 #define ANL() TEST_LOG("\n") // Add New Line | |
36 #define AOK() TEST_LOG("[Test is OK]"); fflush(NULL); // Add OK | |
37 #if defined(_WIN32) | |
38 #define PAUSE \ | |
39 { \ | |
40 TEST_LOG("Press any key to continue..."); \ | |
41 _getch(); \ | |
42 TEST_LOG("\n"); \ | |
43 } | |
44 #else | |
45 #define PAUSE \ | |
46 { \ | |
47 TEST_LOG("Continuing (pause not supported)\n"); \ | |
48 } | |
49 #endif | |
50 | |
51 #define TEST(s) \ | |
52 { \ | |
53 TEST_LOG("Testing: %s", #s); \ | |
54 } \ | |
55 | |
56 #ifdef _INSTRUMENTATION_TESTING_ | |
57 // Don't stop execution if error occurs | |
58 #define TEST_MUSTPASS(expr) \ | |
59 { \ | |
60 if ((expr)) \ | |
61 { \ | |
62 TEST_LOG_ERROR("Error at line:%i, %s \n",__LINE__, #expr); \ | |
63 TEST_LOG_ERROR("Error code: %i\n",voe_base_->LastError()); \ | |
64 } \ | |
65 } | |
66 #define TEST_ERROR(code) \ | |
67 { \ | |
68 int err = voe_base_->LastError(); \ | |
69 if (err != code) \ | |
70 { \ | |
71 TEST_LOG_ERROR("Invalid error code (%d, should be %d) at line %d\n", | |
72 code, err, __LINE__); | |
73 } | |
74 } | |
75 #else | |
76 #define ASSERT_TRUE(expr) TEST_MUSTPASS(!(expr)) | |
77 #define ASSERT_FALSE(expr) TEST_MUSTPASS(expr) | |
78 #define TEST_MUSTFAIL(expr) TEST_MUSTPASS(!((expr) == -1)) | |
79 #define TEST_MUSTPASS(expr) \ | |
80 { \ | |
81 if ((expr)) \ | |
82 { \ | |
83 TEST_LOG_ERROR("\nError at line:%i, %s \n",__LINE__, #expr); \ | |
84 TEST_LOG_ERROR("Error code: %i\n", voe_base_->LastError()); \ | |
85 PAUSE \ | |
86 return -1; \ | |
87 } \ | |
88 } | |
89 #define TEST_ERROR(code) \ | |
90 {
\ | |
91 int err = voe_base_->LastError(); \ | |
92 if (err != code) \ | |
93 { \ | |
94 TEST_LOG_ERROR("Invalid error code (%d, should be %d) at line %d\n", \ | |
95 err, code, __LINE__); \ | |
96 PAUSE \ | |
97 return -1; \ | |
98 }
\ | |
99 } | |
100 #endif // #ifdef _INSTRUMENTATION_TESTING_ | |
101 #define EXCLUDE() \ | |
102 { \ | |
103 TEST_LOG("\n>>> Excluding test at line: %i <<<\n\n",__LINE__); \ | |
104 } | |
105 | |
106 #define INCOMPLETE() \ | |
107 { \ | |
108 TEST_LOG("\n>>> Incomplete test at line: %i <<<\n\n",__LINE__); \ | |
109 } | |
110 | |
111 #endif // WEBRTC_VOICE_ENGINE_VOE_TEST_DEFINES_H | |
OLD | NEW |