FIRCLSMachOBinaryTests.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/UnitTests/FIRCLSMachO/FIRCLSMachOBinaryTests.h"
  15. #import "Crashlytics/Shared/FIRCLSMachO/FIRCLSMachOBinary.h"
  16. @implementation FIRCLSMachOBinaryTests
  17. - (NSString*)resourcePath {
  18. return [[NSBundle bundleForClass:[self class]] resourcePath];
  19. }
  20. - (NSURL*)URLForResource:(NSString*)resource {
  21. NSString* path;
  22. path = [[self resourcePath] stringByAppendingPathComponent:resource];
  23. return [NSURL fileURLWithPath:path];
  24. }
  25. - (void)testInstanceIdentifierForSingleArchdSYM {
  26. FIRCLSMachOBinary* binary;
  27. binary = [[FIRCLSMachOBinary alloc] initWithURL:[self URLForResource:@"x86_64-executable"]];
  28. XCTAssertEqualObjects([binary instanceIdentifier], @"442eb836efe1f56bf8a65b2a0a78b2f8d3e792e7",
  29. @"");
  30. }
  31. - (void)testInstanceIdentifierForMultipleArchitectures {
  32. FIRCLSMachOBinary* binary;
  33. binary = [[FIRCLSMachOBinary alloc] initWithURL:[self URLForResource:@"armv7-armv7s-executable"]];
  34. XCTAssertEqualObjects([binary instanceIdentifier], @"80cc0ec0af8a0169831abcc73177eb2b57990bc0",
  35. @"");
  36. }
  37. @end