forked from nygard/class-dump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestThinFile_Intel64_lib64.m
62 lines (48 loc) · 1.9 KB
/
TestThinFile_Intel64_lib64.m
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
// -*- mode: ObjC -*-
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
// Copyright (C) 1997-1998, 2000-2001, 2004-2012 Steve Nygard.
#import "TestThinFile_Intel64_lib64.h"
#import "CDFatArch.h"
#import "CDFatFile.h"
#import "CDMachOFile.h"
@implementation TestThinFile_Intel64_lib64
{
CDMachOFile *_macho_x86_64;
}
- (void)setUp;
{
[super setUp];
// Set-up code here.
_macho_x86_64 = [[CDMachOFile alloc] init];
_macho_x86_64.cputype = CPU_TYPE_X86_64;
_macho_x86_64.cpusubtype = CPU_SUBTYPE_386 | CPU_SUBTYPE_LIB64; // For example, /Applications/Utilities/Grab.app on 10.8
}
- (void)tearDown;
{
// Tear-down code here.
_macho_x86_64 = nil;
[super tearDown];
}
#pragma mark -
- (void)test_bestMatchIntel64;
{
CDArch arch = { CPU_TYPE_X86_64, CPU_SUBTYPE_386 };
BOOL result = [_macho_x86_64 bestMatchForArch:&arch];
STAssertTrue(result, @"Didn't find a best match for x86_64");
STAssertTrue(arch.cputype == CPU_TYPE_X86_64, @"Best match cputype should be CPU_TYPE_X86_64");
STAssertTrue(arch.cpusubtype == (cpu_subtype_t)(CPU_SUBTYPE_386 | CPU_SUBTYPE_LIB64), @"Best match cpusubtype should be CPU_SUBTYPE_386");
}
- (void)test_machOFileWithArch_x86_64;
{
CDArch arch = { CPU_TYPE_X86_64, CPU_SUBTYPE_386 };
CDMachOFile *machOFile = [_macho_x86_64 machOFileWithArch:arch];
STAssertNotNil(machOFile, @"The Mach-O file shouldn't be nil", NULL);
STAssertEquals(machOFile, _macho_x86_64, @"Didn't find correct Mach-O file", NULL);
}
- (void)test_machOFileWithArch_i386;
{
CDArch arch = { CPU_TYPE_X86, CPU_SUBTYPE_386 };
CDMachOFile *machOFile = [_macho_x86_64 machOFileWithArch:arch];
STAssertNil(machOFile, @"The Mach-O file should be nil", NULL);
}
@end