I'm currently working with a simple object that holds a lat and lng value as NSString. But when I attempt to assert they are equal I get a failure w/ this approach
- (void) testLocationParseJson {
NSArray* items = //some array the represents the json returned from google ...
LocationParseJson* sut = [[LocationParseJson alloc] init];
Location* actualLocation = [sut parseJson:items];
NSString* actualLatitude = actualLocation.lat;
NSString* actualLongitude = actualLocation.lng;
STAssertEqualObjects(expectedLocation.lat, actualLocation.lat, @"The actual location latitude was %@", actualLocation.lat);
}
here is the error shown
error: -[LocationParseJsonTest testLocationParseJson] : '41.6756668' should be equal to '41.6756668' The actual location latitude was 41.6756668
So instead I tried the AssertTrue approach with an "isEqual"
STAssertTrue([expectedLocation.lat isEqual: actualLocation.lat], @"The actual location latitude was %@", actualLocation.lat);
And I get the same error
error: -[LocationParseJsonTest testLocationParseJson] : "[expectedLocation.lat isEqual: actualLocation.lat]" should be true. The actual location latitude was 41.6756668
How should I compare these NSString values in ocUnit? here is the .h file for Location fyi
@interface Location : NSObject {
NSString* lng;
NSString* lat;
}
@property (nonatomic, retain) NSString* lng;
@property (nonatomic, retain) NSString* lat;
@end