aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example/Core/Tests/FIROptionsTest.m
blob: 2ebad154990f3fb685efd5db75ff9fa3b56d8fcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
126
127
128
129
130
131
132
133
134
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
// Copyright 2017 Google
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import "FIRTestCase.h"

#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseCore/FIRBundleUtil.h>
#import <FirebaseCore/FIROptionsInternal.h>

extern NSString *const kFIRIsMeasurementEnabled;
extern NSString *const kFIRIsAnalyticsCollectionEnabled;
extern NSString *const kFIRIsAnalyticsCollectionDeactivated;
extern NSString *const kFIRLibraryVersionID;

@interface FIROptions (Test)

@property(nonatomic, readonly) NSDictionary *analyticsOptionsDictionary;

@end

@interface FIROptionsTest : FIRTestCase

@end

@implementation FIROptionsTest

- (void)setUp {
  [super setUp];
  [FIROptions resetDefaultOptions];
}

- (void)testInit {
  NSDictionary *optionsDictionary = [FIROptions defaultOptionsDictionary];
  FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  [self assertOptionsMatchDefaults:options andProjectID:YES];
  XCTAssertNil(options.deepLinkURLScheme);
  XCTAssertTrue(options.usingOptionsFromDefaultPlist);

  options.deepLinkURLScheme = kDeepLinkURLScheme;
  XCTAssertEqualObjects(options.deepLinkURLScheme, kDeepLinkURLScheme);
}

- (void)testDefaultOptionsDictionaryWithNilFilePath {
  id mockBundleUtil = OCMClassMock([FIRBundleUtil class]);
  [OCMStub([mockBundleUtil optionsDictionaryPathWithResourceName:kServiceInfoFileName
                                                     andFileType:kServiceInfoFileType
                                                       inBundles:[FIRBundleUtil relevantBundles]])
      andReturn:nil];
  XCTAssertNil([FIROptions defaultOptionsDictionary]);
}

- (void)testDefaultOptionsDictionaryWithInvalidSourceFile {
  id mockBundleUtil = OCMClassMock([FIRBundleUtil class]);
  [OCMStub([mockBundleUtil optionsDictionaryPathWithResourceName:kServiceInfoFileName
                                                     andFileType:kServiceInfoFileType
                                                       inBundles:[FIRBundleUtil relevantBundles]])
      andReturn:@"invalid.plist"];
  XCTAssertNil([FIROptions defaultOptionsDictionary]);
}

- (void)testDefaultOptions {
  FIROptions *options = [FIROptions defaultOptions];
  [self assertOptionsMatchDefaults:options andProjectID:YES];
  XCTAssertNil(options.deepLinkURLScheme);
  XCTAssertTrue(options.usingOptionsFromDefaultPlist);

  options.deepLinkURLScheme = kDeepLinkURLScheme;
  XCTAssertEqualObjects(options.deepLinkURLScheme, kDeepLinkURLScheme);
}

- (void)testInitCustomizedOptions {
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
  FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
                                                       bundleID:kBundleID
                                                    GCMSenderID:kGCMSenderID
                                                         APIKey:kAPIKey
                                                       clientID:kClientID
                                                     trackingID:kTrackingID
                                                androidClientID:kAndroidClientID
                                                    databaseURL:kDatabaseURL
                                                  storageBucket:kStorageBucket
                                              deepLinkURLScheme:kDeepLinkURLScheme];
#pragma clang pop
  [self assertOptionsMatchDefaults:options andProjectID:NO];
  XCTAssertEqualObjects(options.deepLinkURLScheme, kDeepLinkURLScheme);
  XCTAssertFalse(options.usingOptionsFromDefaultPlist);

  FIROptions *options2 =
      [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
  options2.androidClientID = kAndroidClientID;
  options2.APIKey = kAPIKey;
  options2.bundleID = kBundleID;
  options2.clientID = kClientID;
  options2.databaseURL = kDatabaseURL;
  options2.deepLinkURLScheme = kDeepLinkURLScheme;
  options2.projectID = kProjectID;
  options2.storageBucket = kStorageBucket;
  options2.trackingID = kTrackingID;
  [self assertOptionsMatchDefaults:options2 andProjectID:YES];
  XCTAssertEqualObjects(options2.deepLinkURLScheme, kDeepLinkURLScheme);
  XCTAssertFalse(options.usingOptionsFromDefaultPlist);

// nil GoogleAppID should throw an exception
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
  XCTAssertThrows([[FIROptions alloc] initWithGoogleAppID:nil
                                                 bundleID:kBundleID
                                              GCMSenderID:kGCMSenderID
                                                   APIKey:kCustomizedAPIKey
                                                 clientID:nil
                                               trackingID:nil
                                          androidClientID:nil
                                              databaseURL:nil
                                            storageBucket:nil
                                        deepLinkURLScheme:nil]);
#pragma clang diagnostic pop
}

- (void)testinitWithContentsOfFile {
  NSString *filePath =
      [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
  FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
  [self assertOptionsMatchDefaults:options andProjectID:YES];
  XCTAssertNil(options.deepLinkURLScheme);
  XCTAssertFalse(options.usingOptionsFromDefaultPlist);

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
  FIROptions *emptyOptions = [[FIROptions alloc] initWithContentsOfFile:nil];
#pragma clang diagnostic pop
  XCTAssertNil(emptyOptions);

  FIROptions *invalidOptions = [[FIROptions alloc] initWithContentsOfFile:@"invalid.plist"];
  XCTAssertNil(invalidOptions);
}

- (void)assertOptionsMatchDefaults:(FIROptions *)options andProjectID:(BOOL)matchProjectID {
  XCTAssertEqualObjects(options.googleAppID, kGoogleAppID);
  XCTAssertEqualObjects(options.APIKey, kAPIKey);
  XCTAssertEqualObjects(options.clientID, kClientID);
  XCTAssertEqualObjects(options.trackingID, kTrackingID);
  XCTAssertEqualObjects(options.GCMSenderID, kGCMSenderID);
  XCTAssertEqualObjects(options.androidClientID, kAndroidClientID);
  XCTAssertEqualObjects(options.libraryVersionID, kFIRLibraryVersionID);
  XCTAssertEqualObjects(options.databaseURL, kDatabaseURL);
  XCTAssertEqualObjects(options.storageBucket, kStorageBucket);
  XCTAssertEqualObjects(options.bundleID, kBundleID);

  // Custom `matchProjectID` parameter to be removed once the deprecated `FIROptions` constructor is
  // removed.
  if (matchProjectID) {
    XCTAssertEqualObjects(options.projectID, kProjectID);
  }
}

- (void)testCopyingProperties {
  NSMutableString *mutableString;
  FIROptions *options =
      [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.APIKey = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.APIKey, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.bundleID = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.bundleID, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.clientID = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.clientID, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.trackingID = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.trackingID, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.GCMSenderID = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.GCMSenderID, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.projectID = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.projectID, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.androidClientID = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.androidClientID, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.googleAppID = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.googleAppID, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.databaseURL = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.databaseURL, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.deepLinkURLScheme = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.deepLinkURLScheme, @"1");

  mutableString = [[NSMutableString alloc] initWithString:@"1"];
  options.storageBucket = mutableString;
  [mutableString appendString:@"2"];
  XCTAssertEqualObjects(options.storageBucket, @"1");
}

- (void)testCopyWithZone {
  // default options
  FIROptions *options = [FIROptions defaultOptions];
  options.deepLinkURLScheme = kDeepLinkURLScheme;
  XCTAssertEqualObjects(options.deepLinkURLScheme, kDeepLinkURLScheme);

  FIROptions *newOptions = [options copy];
  XCTAssertEqualObjects(newOptions.deepLinkURLScheme, kDeepLinkURLScheme);

  [options setDeepLinkURLScheme:kNewDeepLinkURLScheme];
  XCTAssertEqualObjects(options.deepLinkURLScheme, kNewDeepLinkURLScheme);
  XCTAssertEqualObjects(newOptions.deepLinkURLScheme, kDeepLinkURLScheme);

  // customized options
  FIROptions *customizedOptions = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
                                                                 bundleID:kBundleID
                                                              GCMSenderID:kGCMSenderID
                                                                   APIKey:kAPIKey
                                                                 clientID:kClientID
                                                               trackingID:kTrackingID
                                                          androidClientID:kAndroidClientID
                                                              databaseURL:kDatabaseURL
                                                            storageBucket:kStorageBucket
                                                        deepLinkURLScheme:kDeepLinkURLScheme];
  FIROptions *copyCustomizedOptions = [customizedOptions copy];
  [copyCustomizedOptions setDeepLinkURLScheme:kNewDeepLinkURLScheme];
  XCTAssertEqualObjects(customizedOptions.deepLinkURLScheme, kDeepLinkURLScheme);
  XCTAssertEqualObjects(copyCustomizedOptions.deepLinkURLScheme, kNewDeepLinkURLScheme);
}

- (void)testAnalyticsConstants {
  // The keys are public values and should never change.
  XCTAssertEqualObjects(kFIRIsMeasurementEnabled, @"IS_MEASUREMENT_ENABLED");
  XCTAssertEqualObjects(kFIRIsAnalyticsCollectionEnabled, @"FIREBASE_ANALYTICS_COLLECTION_ENABLED");
  XCTAssertEqualObjects(kFIRIsAnalyticsCollectionDeactivated,
                        @"FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED");
}

- (void)testAnalyticsOptions {
  id mainBundleMock = OCMPartialMock([NSBundle mainBundle]);

  // No keys anywhere.
  NSDictionary *optionsDictionary = nil;
  FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  NSDictionary *mainDictionary = nil;
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  NSDictionary *expectedAnalyticsOptions = @{};
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

  optionsDictionary = @{};
  options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  mainDictionary = @{};
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  expectedAnalyticsOptions = @{};
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

  // Main has no keys.
  optionsDictionary = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @YES
  };
  options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  mainDictionary = @{};
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  expectedAnalyticsOptions = optionsDictionary;
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

  // Main overrides all the keys.
  optionsDictionary = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @YES
  };
  options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  mainDictionary = @{
    kFIRIsAnalyticsCollectionDeactivated : @NO,
    kFIRIsAnalyticsCollectionEnabled : @NO,
    kFIRIsMeasurementEnabled : @NO
  };
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  expectedAnalyticsOptions = mainDictionary;
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

  // Keys exist only in main.
  optionsDictionary = @{};
  options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  mainDictionary = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @YES
  };
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  expectedAnalyticsOptions = mainDictionary;
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

  // Main overrides single keys.
  optionsDictionary = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @YES
  };
  options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  mainDictionary = @{ kFIRIsAnalyticsCollectionDeactivated : @NO };
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  expectedAnalyticsOptions = @{
    kFIRIsAnalyticsCollectionDeactivated : @NO,  // override
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @YES
  };
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

  optionsDictionary = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @YES
  };
  options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  mainDictionary = @{ kFIRIsAnalyticsCollectionEnabled : @NO };
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  expectedAnalyticsOptions = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @NO,  // override
    kFIRIsMeasurementEnabled : @YES
  };
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

  optionsDictionary = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @YES
  };
  options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
  mainDictionary = @{ kFIRIsMeasurementEnabled : @NO };
  OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
  expectedAnalyticsOptions = @{
    kFIRIsAnalyticsCollectionDeactivated : @YES,
    kFIRIsAnalyticsCollectionEnabled : @YES,
    kFIRIsMeasurementEnabled : @NO  // override
  };
  XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
}

- (void)testAnalyticsOptions_combinatorial {
  // Complete combinatorial test.
  id mainBundleMock = OCMPartialMock([NSBundle mainBundle]);
  // Possible values for the flags in the plist, where NSNull means the flag is not present.
  NSArray *values = @[ [NSNull null], @NO, @YES ];

  // Sanity checks for the combination generation.
  int combinationCount = 0;
  NSMutableArray *uniqueMainCombinations = [[NSMutableArray alloc] init];
  NSMutableArray *uniqueOptionsCombinations = [[NSMutableArray alloc] init];

  // Generate all optout flag combinations for { main plist X GoogleService-info options plist }.
  // Options present in the main plist should override options of the same key in the service plist.
  for (id mainDeactivated in values) {
    for (id mainAnalyticsEnabled in values) {
      for (id mainMeasurementEnabled in values) {
        for (id optionsDeactivated in values) {
          for (id optionsAnalyticsEnabled in values) {
            for (id optionsMeasurementEnabled in values) {
              @autoreleasepool {
                // Fill the GoogleService-info options plist dictionary.
                NSMutableDictionary *optionsDictionary = [[NSMutableDictionary alloc] init];
                if (![optionsDeactivated isEqual:[NSNull null]]) {
                  optionsDictionary[kFIRIsAnalyticsCollectionDeactivated] = optionsDeactivated;
                }
                if (![optionsAnalyticsEnabled isEqual:[NSNull null]]) {
                  optionsDictionary[kFIRIsAnalyticsCollectionEnabled] = optionsAnalyticsEnabled;
                }
                if (![optionsMeasurementEnabled isEqual:[NSNull null]]) {
                  optionsDictionary[kFIRIsMeasurementEnabled] = optionsMeasurementEnabled;
                }
                FIROptions *options =
                    [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
                if (![uniqueOptionsCombinations containsObject:optionsDictionary]) {
                  [uniqueOptionsCombinations addObject:optionsDictionary];
                }

                // Fill the main plist dictionary.
                NSMutableDictionary *mainDictionary = [[NSMutableDictionary alloc] init];
                if (![mainDeactivated isEqual:[NSNull null]]) {
                  mainDictionary[kFIRIsAnalyticsCollectionDeactivated] = mainDeactivated;
                }
                if (![mainAnalyticsEnabled isEqual:[NSNull null]]) {
                  mainDictionary[kFIRIsAnalyticsCollectionEnabled] = mainAnalyticsEnabled;
                }
                if (![mainMeasurementEnabled isEqual:[NSNull null]]) {
                  mainDictionary[kFIRIsMeasurementEnabled] = mainMeasurementEnabled;
                }
                OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
                if (![uniqueMainCombinations containsObject:mainDictionary]) {
                  [uniqueMainCombinations addObject:mainDictionary];
                }

                // Generate the expected options by adding main values on top of the service options
                // values. The main values will replace any existing options values with the same
                // key. This is a different way of combining the two sets of flags from the actual
                // implementation in FIROptions, with equivalent output.
                NSMutableDictionary *expectedAnalyticsOptions =
                    [[NSMutableDictionary alloc] initWithDictionary:optionsDictionary];
                [expectedAnalyticsOptions addEntriesFromDictionary:mainDictionary];
                XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);

                combinationCount++;
              }
            }
          }
        }
      }
    }
  }

  // Verify the sanity checks.
  XCTAssertEqual(combinationCount, 729);  // = 3^6.

  XCTAssertEqual(uniqueOptionsCombinations.count, 27);
  int optionsSizeCount[4] = {0};
  for (NSDictionary *dictionary in uniqueOptionsCombinations) {
    optionsSizeCount[dictionary.count]++;
  }
  XCTAssertEqual(optionsSizeCount[0], 1);
  XCTAssertEqual(optionsSizeCount[1], 6);
  XCTAssertEqual(optionsSizeCount[2], 12);
  XCTAssertEqual(optionsSizeCount[3], 8);

  XCTAssertEqual(uniqueMainCombinations.count, 27);
  int mainSizeCount[4] = {0};
  for (NSDictionary *dictionary in uniqueMainCombinations) {
    mainSizeCount[dictionary.count]++;
  }
  XCTAssertEqual(mainSizeCount[0], 1);
  XCTAssertEqual(mainSizeCount[1], 6);
  XCTAssertEqual(mainSizeCount[2], 12);
  XCTAssertEqual(mainSizeCount[3], 8);
}

- (void)testVersionFormat {
  NSRegularExpression *sLibraryVersionRegex =
      [NSRegularExpression regularExpressionWithPattern:@"^[0-9]{8,}$" options:0 error:NULL];
  NSUInteger numberOfMatches =
      [sLibraryVersionRegex numberOfMatchesInString:kFIRLibraryVersionID
                                            options:0
                                              range:NSMakeRange(0, kFIRLibraryVersionID.length)];
  XCTAssertEqual(numberOfMatches, 1, @"Incorrect library version format.");
}

@end