Newer
Older
//
// LinphoneTesterTests.m
// LinphoneTesterTests
//
// Created by Danmei Chen on 13/02/2019.
// Copyright © 2019 belledonne. All rights reserved.
//
#import <XCTest/XCTest.h>
#include "linphone/linphonecore.h"
#include "linphonetester/liblinphone_tester.h"
#import "NSObject+DTRuntime.h"
//#import "Utils.h"
#import "Log.h"
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
@interface LinphoneTesterBase : XCTestCase
@end
@implementation LinphoneTesterBase
+ (NSString *)safetyTestString:(NSString *)testString {
NSCharacterSet *charactersToRemove = [[NSCharacterSet alphanumericCharacterSet] invertedSet];
return [[testString componentsSeparatedByCharactersInSet:charactersToRemove] componentsJoinedByString:@"_"];
}
void dummy_logger(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args) {
}
+ (void)initialize {
}
+ (void)testForSuite:(NSString *)sSuite {
LOGI(@"[message] Launching tests from suite %@", sSuite);
const char *suite = sSuite.UTF8String;
bc_tester_register_suite_by_name(suite);
int test_count = bc_tester_nb_tests(suite);
for (int k = 0; k < test_count; k++) {
const char *test = bc_tester_test_name(suite, k);
if (test) {
NSString *sTest = [NSString stringWithUTF8String:test];
// prepend "test_" so that it gets found by introspection
NSString *safesTest = [LinphoneTesterBase safetyTestString:sTest];
NSString *safesSuite = [LinphoneTesterBase safetyTestString:sSuite];
// ordering tests
NSString *safesIndex = nil;
if (k < 10) {
safesIndex = [NSString stringWithFormat:@"00%d",k];
} else if (k <100) {
safesIndex = [NSString stringWithFormat:@"0%d",k];
} else if (k <1000) {
safesIndex = [NSString stringWithFormat:@"%d",k];
}
NSString *selectorName = [NSString stringWithFormat:@"test%@_%@__%@", safesIndex, safesSuite, safesTest];
[self addInstanceMethodWithSelectorName:selectorName
block:^(LinphoneTesterBase *myself) {
[myself testForSuiteTest:sSuite andTest:sTest];
}];
}
}
}
- (void)testForSuiteTest:(NSString *)suite andTest:(NSString *)test {
LOGI(@"[message] Launching test %@ from suite %@", test, suite);
XCTAssertFalse(bc_tester_run_tests(suite.UTF8String, test.UTF8String, NULL), @"Suite '%@' / Test '%@' failed",
suite, test);
}
@end
@interface SetupTests : LinphoneTesterBase
@end
@implementation SetupTests
+ (void)initialize {
[self testForSuite:@"Setup"];
}
@end
@interface TunnelTests : LinphoneTesterBase
@end
@implementation TunnelTests
+ (void)initialize {
[self testForSuite:@"Tunnel"];
}
@end
@interface OfferAnswerTests : LinphoneTesterBase
@end
@implementation OfferAnswerTests
+ (void)initialize {
[self testForSuite:@"Offer-answer"];
}
@end
@interface PresenceTests : LinphoneTesterBase
@end
@implementation PresenceTests
+ (void)initialize {
[self testForSuite:@"Presence"];
}
@end
@interface AccountCreatorTests : LinphoneTesterBase
@end
@implementation AccountCreatorTests
+ (void)initialize {
[self testForSuite:@"Account creator"];
}
@end
@interface ConferenceEventTests : LinphoneTesterBase
@end
@implementation ConferenceEventTests
+ (void)initialize {
[self testForSuite:@"Conference event"];
}
@end
// TODO enable LogCollection in IOS
/*@interface LogCollectionTests : LinphoneTesterBase
@end
@implementation LogCollectionTests
+ (void)initialize {
[self testForSuite:@"LogCollection"];
}
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
@interface PlayerTests : LinphoneTesterBase
@end
@implementation PlayerTests
+ (void)initialize {
[self testForSuite:@"Player"];
}
@end
@interface DTMFTests : LinphoneTesterBase
@end
@implementation DTMFTests
+ (void)initialize {
[self testForSuite:@"DTMF"];
}
@end
/*@interface CpimTests : LinphoneTesterBase
@end
@implementation CpimTests
+ (void)initialize {
[self testForSuite:@"Cpim"];
}
@end*/
@interface MultipartTests : LinphoneTesterBase
@end
@implementation MultipartTests
+ (void)initialize {
[self testForSuite:@"Multipart"];
}
@end
@interface ClonableObjectTests : LinphoneTesterBase
@end
@implementation ClonableObjectTests
+ (void)initialize {
[self testForSuite:@"ClonableObject"];
}
@end
@interface MainDbTests : LinphoneTesterBase
@end
@implementation MainDbTests
+ (void)initialize {
[self testForSuite:@"MainDb"];
}
@end
@interface PropertyContainerTests : LinphoneTesterBase
@end
@implementation PropertyContainerTests
+ (void)initialize {
[self testForSuite:@"PropertyContainer"];
}
@end
@interface ProxyConfigTests : LinphoneTesterBase
@end
@implementation ProxyConfigTests
+ (void)initialize {
[self testForSuite:@"Proxy config"];
}
@end
@interface VCardTests : LinphoneTesterBase
@end
@implementation VCardTests
+ (void)initialize {
[self testForSuite:@"VCard"];
}
@end
@interface VideoCallTests : LinphoneTesterBase
@end
@implementation VideoCallTests
+ (void)initialize {
[self testForSuite:@"Video Call"];
}
@end
@interface AudioBypassTests : LinphoneTesterBase
@end
@implementation AudioBypassTests
+ (void)initialize {
[self testForSuite:@"Audio Bypass"];
}
@end
@interface ContentsTests : LinphoneTesterBase
@end
@implementation ContentsTests
+ (void)initialize {
[self testForSuite:@"Contents"];
}
@end
@interface VideoTests : LinphoneTesterBase
@end
@implementation VideoTests
+ (void)initialize {
[self testForSuite:@"Video"];
}
@end
@interface MulticastCallTests : LinphoneTesterBase
@end
@implementation MulticastCallTests
+ (void)initialize {
[self testForSuite:@"Multicast Call"];
}
@end
@interface StunTests : LinphoneTesterBase
@end
@implementation StunTests
+ (void)initialize {
[self testForSuite:@"Stun"];
}
@end
@interface EventTests : LinphoneTesterBase
@end
@implementation EventTests
+ (void)initialize {
[self testForSuite:@"Event"];
}
@end
@interface MessageTests : LinphoneTesterBase
@end
@implementation MessageTests
+ (void)initialize {
[self testForSuite:@"Message"];
}
@end
@interface RemoteProvisioningTests : LinphoneTesterBase
@end
@implementation RemoteProvisioningTests
+ (void)initialize {
[self testForSuite:@"RemoteProvisioning"];
}
@end
@interface QualityReportingTests : LinphoneTesterBase
@end
@implementation QualityReportingTests
+ (void)initialize {
[self testForSuite:@"QualityReporting"];
}
@end
@interface RegisterTests : LinphoneTesterBase
@end
@implementation RegisterTests
+ (void)initialize {
[self testForSuite:@"Register"];
}
@end
@interface GroupChatTests : LinphoneTesterBase
@end
@implementation GroupChatTests
+ (void)initialize {
[self testForSuite:@"Group Chat"];
}
@interface SecureGroupChatTests : LinphoneTesterBase
@end
@implementation SecureGroupChatTests
+ (void)initialize {
[self testForSuite:@"Secure group chat"];
}
@end
@interface FlexisipTests : LinphoneTesterBase
@end
@implementation FlexisipTests
+ (void)initialize {
[self testForSuite:@"Flexisip"];
@interface MultiCallTests : LinphoneTesterBase
@end
@implementation MultiCallTests
+ (void)initialize {
[self testForSuite:@"Multi call"];
@interface SecureCallTests : LinphoneTesterBase
@end
@implementation SecureCallTests
+ (void)initialize {
[self testForSuite:@"Secure Call"];
}
@end
@interface SingleCallTests : LinphoneTesterBase
@end
@implementation SingleCallTests
+ (void)initialize {
[self testForSuite:@"Single Call"];
@interface VideoCallQualityTests : LinphoneTesterBase
@end
@implementation VideoCallQualityTests
+ (void)initialize {
[self testForSuite:@"Video Call quality"];
}
@end
@interface PresenceUsingServerTests : LinphoneTesterBase
@end
@implementation PresenceUsingServerTests
+ (void)initialize {
[self testForSuite:@"Presence using server"];
@end
@interface CallRecoveryTests : LinphoneTesterBase
@end
@implementation CallRecoveryTests
+ (void)initialize {
[self testForSuite:@"Call recovery"];
}
@end
@implementation CallWithICETests
+ (void)initialize {
[self testForSuite:@"Call with ICE"];
}
@end
@interface UtilsTests : LinphoneTesterBase
@end
@implementation UtilsTests
+ (void)initialize {
[self testForSuite:@"Utils"];
}
@end