-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathregression_tests.mm
73 lines (56 loc) · 2.81 KB
/
regression_tests.mm
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
//
// regression_tests.mm
// regression-tests
//
// Created by Gabriel Beauchemin on 11/11/22.
//
#import <XCTest/XCTest.h>
#import "cppfront.h"
@interface regression_tests : XCTestCase {
NSString* resourcePath;
NSArray* cpp2Array;
NSArray* expectedFailures;
}
@end
@implementation regression_tests
- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class.
resourcePath = [NSBundle bundleForClass:[self class]].resourcePath;
cpp2Array = [[NSBundle bundleForClass:[self class]] pathsForResourcesOfType:@"cpp2"
inDirectory:@"regression-tests"];
expectedFailures = [NSArray arrayWithObjects:@"mixed-initialization-safety-1.cpp2", @"mixed-initialization-safety-2.cpp2",
@"mixed-lifetime-safety-pointer-init-1.cpp2", @"mixed-lifetime-safety-pointer-init-2.cpp2", @"mixed-lifetime-safety-pointer-init-3.cpp2",
@"pure2-bounds-safety-pointer-arithmetic-error.cpp2", @"pure2-lifetime-safety-pointer-init-1.cpp2", @"pure2-lifetime-safety-reject-null.cpp2",
nil];
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
- (void)testMixed {
[cpp2Array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSString *filename = [(NSString *)obj lastPathComponent];
if ([filename hasPrefix:@"mixed-"] && ![expectedFailures containsObject: filename]) {
NSString* result = [NSString stringWithFormat:@"%@%@%@%@", resourcePath, @"/regression-tests/test-results/", [filename stringByDeletingPathExtension], @".cpp"];
cppfront((NSString *)obj, result, FALSE);
}
}];
}
- (void)testPure {
[cpp2Array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSString *filename = [(NSString *)obj lastPathComponent];
if ([filename hasPrefix:@"pure2-"] && ![expectedFailures containsObject: filename]) {
NSString* result = [NSString stringWithFormat:@"%@%@%@%@", resourcePath, @"/regression-tests/test-results/", [filename stringByDeletingPathExtension], @".cpp"];
cppfront((NSString *)obj, result, TRUE);
}
}];
}
- (void)testFailures {
[cpp2Array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSString *filename = [(NSString *)obj lastPathComponent];
if ([expectedFailures containsObject: filename]) {
NSString* result = [NSString stringWithFormat:@"%@%@%@%@", resourcePath, @"/regression-tests/test-results/", [filename stringByDeletingPathExtension], @".cpp"];
cppfront((NSString *)obj, result, FALSE, FALSE);
}
}];
}
@end