Skip to content

Commit

Permalink
Pruning some unused and confusing functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jagill committed Apr 3, 2012
1 parent aea4cf9 commit 8505b78
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 55 deletions.
8 changes: 0 additions & 8 deletions JAGPropertyConverter/JAGProperty.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ JAGPropertySetterSemantics;
property.isObject == YES; property.isObject == YES;
property.propertyClass == [NSString class]; property.propertyClass == [NSString class];
property.isNumber == NO; property.isNumber == NO;
property.isScalar == NO;
property.typeEncoding == @"@\"NSString\""; property.typeEncoding == @"@\"NSString\"";
property.isNonAtomic == YES; property.isNonAtomic == YES;
property.isReadOnly == YES; property.isReadOnly == YES;
Expand All @@ -78,7 +77,6 @@ JAGPropertySetterSemantics;
property.isObject == YES; property.isObject == YES;
property.propertyClass == nil; property.propertyClass == nil;
property.isNumber == YES; property.isNumber == YES;
property.isScalar == YES;
property.typeEncoding == @"i"; property.typeEncoding == @"i";
property.isNonAtomic == NO; property.isNonAtomic == NO;
property.isReadOnly == NO; property.isReadOnly == NO;
Expand Down Expand Up @@ -225,15 +223,9 @@ JAGPropertySetterSemantics;
*/ */
- (BOOL)isEligibleForGarbageCollection; - (BOOL)isEligibleForGarbageCollection;


/// @return YES if the property is char (signed or unsigned) or char array
- (BOOL) isCharacterType;

/// @return YES if the property is any sort of integer, float, char, or BOOL /// @return YES if the property is any sort of integer, float, char, or BOOL
- (BOOL) isNumber; - (BOOL) isNumber;


/// @return YES if the property is for a Number, Bool, or CharacterType
- (BOOL) isScalar;

/// @return YES if the property is for an NSObject subclass or `id`. /// @return YES if the property is for an NSObject subclass or `id`.
- (BOOL) isObject; - (BOOL) isObject;


Expand Down
17 changes: 0 additions & 17 deletions JAGPropertyConverter/JAGProperty.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -194,16 +194,6 @@ - (Class) propertyClass {
return class; return class;
} }


- (BOOL) isCharacterType
{
NSString *typeEncoding = [self typeEncoding];
return ([typeEncoding isEqualToString: @"c"]
|| [typeEncoding isEqualToString: @"C"]
|| [typeEncoding isEqualToString: @"*"]
);
}

//Temporarily including characters.
- (BOOL) isNumber - (BOOL) isNumber
{ {
NSString *typeEncoding = [self typeEncoding]; NSString *typeEncoding = [self typeEncoding];
Expand All @@ -223,13 +213,6 @@ - (BOOL) isNumber
); );
} }


- (BOOL) isScalar
{
return ([self isCharacterType]
|| [self isNumber] //isNumber includes Boolean
);
}

- (BOOL) isObject - (BOOL) isObject
{ {
return [[self typeEncoding] hasPrefix: @"@"] && ![self isBlock]; return [[self typeEncoding] hasPrefix: @"@"] && ![self isBlock];
Expand Down
4 changes: 0 additions & 4 deletions JAGPropertyConverterTests/JAGPropertyTest.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ - (void) setUp {
- (void) testIntProperty { - (void) testIntProperty {
STAssertTrue([[intProp typeEncoding] isEqualToString:@"i"], @"Type encoding should be i, is %@", [intProp typeEncoding]); STAssertTrue([[intProp typeEncoding] isEqualToString:@"i"], @"Type encoding should be i, is %@", [intProp typeEncoding]);
STAssertTrue([intProp isNumber], @"Property should be Number."); STAssertTrue([intProp isNumber], @"Property should be Number.");
STAssertFalse([intProp isCharacterType], @"Property should not be CharacterType.");
STAssertTrue([intProp isScalar], @"Property should be scalar.");
STAssertFalse([intProp isObject], @"Property should not be object."); STAssertFalse([intProp isObject], @"Property should not be object.");
STAssertEqualObjects([intProp ivarName], @"_intProperty", @"ivarName should be correct."); STAssertEqualObjects([intProp ivarName], @"_intProperty", @"ivarName should be correct.");
STAssertEquals([intProp setterSemantics], JAGPropertySetterSemanticsAssign, @"Setter semantics should be assign."); STAssertEquals([intProp setterSemantics], JAGPropertySetterSemanticsAssign, @"Setter semantics should be assign.");
Expand All @@ -89,8 +87,6 @@ - (void) testModelProperty {
STAssertTrue([[modelProp typeEncoding] isEqualToString:@"@\"TestModel\""], STAssertTrue([[modelProp typeEncoding] isEqualToString:@"@\"TestModel\""],
@"Type encoding should be @\"TestModel\", is %@", [modelProp typeEncoding]); @"Type encoding should be @\"TestModel\", is %@", [modelProp typeEncoding]);
STAssertFalse([modelProp isNumber], @"Property should not be Number."); STAssertFalse([modelProp isNumber], @"Property should not be Number.");
STAssertFalse([modelProp isCharacterType], @"Property should not be CharacterType.");
STAssertFalse([modelProp isScalar], @"Property should not be scalar.");
STAssertEqualObjects([modelProp ivarName], @"_modelProperty", @"ivarName should be correct."); STAssertEqualObjects([modelProp ivarName], @"_modelProperty", @"ivarName should be correct.");
STAssertEquals([modelProp setterSemantics], JAGPropertySetterSemanticsRetain, @"Setter semantics should be retain."); STAssertEquals([modelProp setterSemantics], JAGPropertySetterSemanticsRetain, @"Setter semantics should be retain.");
STAssertEqualObjects([modelProp name], @"modelProperty", @"Name should be correct."); STAssertEqualObjects([modelProp name], @"modelProperty", @"Name should be correct.");
Expand Down
36 changes: 10 additions & 26 deletions JAGPropertyConverterTests/PropertyModelTests.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@
#import "TestModel.h" #import "TestModel.h"
#import "JAGPropertyFinder.h" #import "JAGPropertyFinder.h"


@interface PropertyModelTests() {
@private
TestModel *model;
}

@end

@implementation PropertyModelTests @implementation PropertyModelTests


- (void) setUp {
model = [TestModel testModel];
}


- (void) testMixedModelToDict { - (void) testMixedModelToDict {
TestModel *model = [TestModel testModel];
int intProp = 5; int intProp = 5;
model.intProperty = intProp; model.intProperty = intProp;
NSString *stringProp = @"Title!"; NSString *stringProp = @"Title!";
Expand Down Expand Up @@ -83,7 +92,6 @@ - (void) testMixedModelFromDict {


[props setValue:otherModelProps forKey:@"modelProperty"]; [props setValue:otherModelProps forKey:@"modelProperty"];


TestModel *model = [TestModel testModel];
[model setPropertiesFromDictionary:props]; [model setPropertiesFromDictionary:props];


STAssertEquals(model.intProperty, intProp, STAssertEquals(model.intProperty, intProp,
Expand All @@ -106,35 +114,11 @@ - (void) testMixedModelFromDict {
} }


- (void) testCoordinate { - (void) testCoordinate {
TestModel *model = [TestModel testModel];
NSArray *propertyNames = [JAGPropertyFinder propertyNamesForClass:[TestModel class]]; NSArray *propertyNames = [JAGPropertyFinder propertyNamesForClass:[TestModel class]];
NSLog(@"Found property names for TestModel: %@", propertyNames); NSLog(@"Found property names for TestModel: %@", propertyNames);
TestModel *model2 = [TestModel testModel]; TestModel *model2 = [TestModel testModel];
//We should not have crashed on coordinate here. //We should not have crashed on coordinate here.
[model2 setPropertiesFromDictionary:[model propertiesAsDictionary]]; [model2 setPropertiesFromDictionary:[model propertiesAsDictionary]];
} }


/*
- (void) testGetIntProperty {}
- (void) testSetIntProperty {}
- (void) testGetModelProperty;
- (void) testSetModelProperty;
- (void) testGetArrayWithNumbersProperty;
- (void) testSetArrayWithNumbersProperty;
- (void) testGetArrayWithModelsProperty;
- (void) testSetArrayWithModelsProperty;
- (void) testGetSetWithNumbersProperty;
- (void) testSetSetWithNumbersProperty;
- (void) testGetSetWithModelsProperty;
- (void) testSetSetWithModelsProperty;
- (void) testGetDictionaryProperty;
- (void) testSetDictionaryProperty;
*/

@end @end

0 comments on commit 8505b78

Please sign in to comment.