Remove unused methods/tests

pull/1/head
Michael Kirk 7 years ago
parent 8472801c4b
commit 06b763dfc4

@ -38,15 +38,6 @@
test([[(@[@1,@2]) filter:^(NSNumber* x) { return x.intValue == 2; }] isEqualToArray:(@[@2])]);
}
-(void) testKeyedBy {
test([[@[] keyedBy:^id(id value) { return @true; }] isEqual:@{}]);
test([[@[@1] keyedBy:^id(id value) { return @true; }] isEqual:@{@true : @1}]);
testThrows(([(@[@1, @2]) keyedBy:^id(id value) { return @true; }]));
test([[(@[@1, @2]) keyedBy:^id(id value) { return value; }] isEqual:(@{@1 : @1, @2 : @2})]);
testThrows([(@[@1, @1, @2, @3, @5]) keyedBy:^id(NSNumber* value) { return @(value.intValue/2); }]);
test([[(@[@3, @5, @7, @11, @13]) keyedBy:^id(NSNumber* value) { return @(value.intValue/2); }] isEqual:(@{@1 : @3, @2 : @5, @3 : @7, @5 : @11, @6 : @13})]);
}
-(void) testGroupBy {
test([[@[] groupBy:^id(id value) { return @true; }] isEqual:@{}]);
test([[@[@1] groupBy:^id(id value) { return @true; }] isEqual:@{@true : @[@1]}]);

@ -10,16 +10,12 @@
/// Returns true when all of the items in this array match the given predicate.
- (bool)all:(int (^)(id item))predicate;
/// Returns the first item in this array that matches the given predicate, or else returns nil if none match it.
- (id)firstMatchingElseNil:(int (^)(id item))predicate;
/// Returns an array of all the results of passing items from this array through the given projection function.
- (NSArray *)map:(id (^)(id item))projection;
/// Returns an array of all the results of passing items from this array through the given projection function.
- (NSArray *)filter:(int (^)(id item))predicate;
- (NSDictionary *)keyedBy:(id (^)(id))keySelector;
- (NSDictionary *)groupBy:(id (^)(id value))keySelector;
@end

@ -46,15 +46,6 @@
}
return true;
}
- (id)firstMatchingElseNil:(int (^)(id item))predicate {
tskit_require(predicate != nil);
for (id e in self) {
if (predicate(e)) {
return e;
}
}
return nil;
}
- (NSArray *)map:(id (^)(id item))projection {
tskit_require(projection != nil);
@ -76,18 +67,6 @@
return r;
}
- (NSDictionary *)keyedBy:(id (^)(id value))keySelector {
tskit_require(keySelector != nil);
NSMutableDictionary *result = [NSMutableDictionary dictionary];
for (id value in self) {
result[keySelector(value)] = value;
}
tskit_require(result.count == self.count);
return result;
}
- (NSDictionary *)groupBy:(id (^)(id value))keySelector {
tskit_require(keySelector != nil);

Loading…
Cancel
Save