From a7e4480129a50db452eab212a9f82ee1ac93191c Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Thu, 31 Jan 2013 21:46:09 +0000 Subject: PostgresKit: Enable additional data type integration tests. --- .../PostgresKit.xcodeproj/project.pbxproj | 2 +- Frameworks/PostgresKit/Tests/PGDataTypeTests.m | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj b/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj index 10711d65..b534f8aa 100644 --- a/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj +++ b/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj @@ -11,7 +11,7 @@ 170465CF15C2960F00DC5BE5 /* PGPostgresTypeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 170465CD15C2960F00DC5BE5 /* PGPostgresTypeHandler.m */; }; 171D58701612E9B900F84472 /* PGDataTypeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 171D586F1612E9B900F84472 /* PGDataTypeTests.m */; }; 1724C9B815F9ED8600AB2291 /* libpqtypes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1724C9B715F9ED8600AB2291 /* libpqtypes.a */; }; - 1724CC9215FB4CC200AB2291 /* PGPostgresTimeTZ.h in Headers */ = {isa = PBXBuildFile; fileRef = 1724CC9015FB4CC200AB2291 /* PGPostgresTimeTZ.h */; }; + 1724CC9215FB4CC200AB2291 /* PGPostgresTimeTZ.h in Headers */ = {isa = PBXBuildFile; fileRef = 1724CC9015FB4CC200AB2291 /* PGPostgresTimeTZ.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1724CC9315FB4CC200AB2291 /* PGPostgresTimeTZ.m in Sources */ = {isa = PBXBuildFile; fileRef = 1724CC9115FB4CC200AB2291 /* PGPostgresTimeTZ.m */; }; 1724CD1515FB69EC00AB2291 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17E595F114F3058F0054EE08 /* Foundation.framework */; }; 1724CD1815FB6A0500AB2291 /* PostgresKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* PostgresKit.framework */; }; diff --git a/Frameworks/PostgresKit/Tests/PGDataTypeTests.m b/Frameworks/PostgresKit/Tests/PGDataTypeTests.m index 4c96a97c..765404a3 100644 --- a/Frameworks/PostgresKit/Tests/PGDataTypeTests.m +++ b/Frameworks/PostgresKit/Tests/PGDataTypeTests.m @@ -30,6 +30,8 @@ #import "PGDataTypeTests.h" +#import + static NSString *PGTestDatabaseHost = @"localhost"; static NSString *PGTestDatabaseUser = @"pgkit_test"; static NSString *PGTestDatabaseName = @"pgkit_test"; @@ -72,11 +74,18 @@ static NSUInteger PGTestDatabasePort = 5432; [self _addTestForField:@"numeric" withExpectedResult:[NSNumber numberWithDouble:12345.678] connection:connection toTestSuite:testSuite]; [self _addTestForField:@"char" withExpectedResult:@"CHAR" connection:connection toTestSuite:testSuite]; [self _addTestForField:@"varchar" withExpectedResult:@"VARCHAR" connection:connection toTestSuite:testSuite]; - //[self _addTestForField:@"date" withExpectedResult: connection:connection toTestSuite:testSuite]; - //[self _addTestForField:@"time" withExpectedResult: connection:connection toTestSuite:testSuite]; - //[self _addTestForField:@"timetz" withExpectedResult: connection:connection toTestSuite:testSuite]; - //[self _addTestForField:@"timestamp" withExpectedResult: connection:connection toTestSuite:testSuite]; - //[self _addTestForField:@"timestamptz" withExpectedResult: connection:connection toTestSuite:testSuite]; + [self _addTestForField:@"date" withExpectedResult:[NSDate dateWithTimeIntervalSince1970:544834800] connection:connection toTestSuite:testSuite]; + [self _addTestForField:@"time" withExpectedResult:[NSDate dateWithTimeIntervalSince1970:946692122] connection:connection toTestSuite:testSuite]; + [self _addTestForField:@"timestamp" withExpectedResult:[NSDate dateWithTimeIntervalSince1970:544845722] connection:connection toTestSuite:testSuite]; + + PGPostgresTimeTZ *timeTz = [PGPostgresTimeTZ timeWithDate:[NSDate dateWithTimeIntervalSince1970:946692122] timeZoneGMTOffset:36000]; + PGPostgresTimeTZ *timestampTz = [PGPostgresTimeTZ timeWithDate:[NSDate dateWithTimeIntervalSince1970:544845722] timeZoneGMTOffset:3600]; + + [timeTz setHasDate:YES]; + [timestampTz setHasDate:YES]; + + [self _addTestForField:@"timetz" withExpectedResult:timeTz connection:connection toTestSuite:testSuite]; + [self _addTestForField:@"timestamptz" withExpectedResult:timestampTz connection:connection toTestSuite:testSuite]; [connection release]; @@ -112,7 +121,7 @@ static NSUInteger PGTestDatabasePort = 5432; #pragma mark - #pragma mark Tests -- (void)testResultValueIsNotNull +- (void)testResultValueIsNotNil { STAssertNotNil(_result, nil); } -- cgit v1.2.3