FIRCLSSymbolResolverTests.m 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2019 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "Crashlytics/Crashlytics/Models/FIRCLSSymbolResolver.h"
  15. #import <XCTest/XCTest.h>
  16. @interface FIRCLSSymbolResolverTests : XCTestCase
  17. @end
  18. @implementation FIRCLSSymbolResolverTests
  19. - (void)setUp {
  20. [super setUp];
  21. }
  22. - (void)tearDown {
  23. [super tearDown];
  24. }
  25. - (NSString*)resourcePath {
  26. return [[NSBundle bundleForClass:[self class]] resourcePath];
  27. }
  28. - (NSString*)pathForResource:(NSString*)name {
  29. return [[self resourcePath] stringByAppendingPathComponent:name];
  30. }
  31. - (void)testLoadingBinaryImagesWithInvalidFile {
  32. FIRCLSSymbolResolver* resolver = [[FIRCLSSymbolResolver alloc] init];
  33. XCTAssertFalse([resolver loadBinaryImagesFromFile:nil]);
  34. XCTAssertFalse([resolver loadBinaryImagesFromFile:@""]);
  35. }
  36. - (void)testLoadingBinaryImagesWithNullBaseValue {
  37. FIRCLSSymbolResolver* resolver = [[FIRCLSSymbolResolver alloc] init];
  38. NSString* binaryImagePath =
  39. [self pathForResource:@"binary_images_with_null_base_entry.clsrecord"];
  40. XCTAssert([resolver loadBinaryImagesFromFile:binaryImagePath]);
  41. }
  42. - (void)testLoadingBinaryImagesWithMissingBaseValue {
  43. FIRCLSSymbolResolver* resolver = [[FIRCLSSymbolResolver alloc] init];
  44. NSString* binaryImagePath = [self pathForResource:@"binary_images_missing_base_entry.clsrecord"];
  45. XCTAssert([resolver loadBinaryImagesFromFile:binaryImagePath]);
  46. }
  47. @end