add another test

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38653 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2015-06-17 14:26:25 +00:00
parent e472d45d38
commit 08808d55b8

View file

@ -254,8 +254,10 @@ main()
NSString *oddChars; NSString *oddChars;
NSString *nonLatin; NSString *nonLatin;
id e1, e2, e3, e4, e5; id e1, e2, e3, e4, e5;
id d;
id d0; id d0;
id d1; id d1;
id d2;
id r0; id r0;
id r1; id r1;
@ -450,14 +452,18 @@ main()
NSLog(@"Records - %@", [GSCache class]); NSLog(@"Records - %@", [GSCache class]);
d = [NSCalendarDate date];
[d setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 240]];
[db begin]; [db begin];
[db execute: @"create table xxx ( " [db execute: @"create table xxx ( "
@"id int, " @"id int, "
@"when0 timestamp with time zone, "
@"when1 timestamp with time zone, " @"when1 timestamp with time zone, "
@"when2 timestamp)", @"when2 timestamp)",
nil]; nil];
[db execute: @"insert into xxx (id, when1, when2) " [db execute: @"insert into xxx (id, when0, when1, when2) "
@"values (99,", @"values (99,",
d, @", ",
[NSDate distantPast], @", ", [NSDate distantPast], @", ",
[NSDate distantFuture], @")", [NSDate distantFuture], @")",
nil]; nil];
@ -465,13 +471,17 @@ main()
[db execute: @"drop table xxx", nil]; [db execute: @"drop table xxx", nil];
[db commit]; [db commit];
d0 = [r0 objectForKey:@"when1"]; d0 = [r0 objectForKey:@"when0"];
d1 = [r0 objectForKey:@"when2"]; NSCAssert(floor([d0 timeIntervalSinceReferenceDate])
NSCAssert([d0 timeIntervalSinceReferenceDate] == floor([d timeIntervalSinceReferenceDate]),
== [[NSDate distantPast]timeIntervalSinceReferenceDate],
NSInternalInconsistencyException); NSInternalInconsistencyException);
d1 = [r0 objectForKey:@"when1"];
NSCAssert([d1 timeIntervalSinceReferenceDate] NSCAssert([d1 timeIntervalSinceReferenceDate]
== [[NSDate distantFuture]timeIntervalSinceReferenceDate], == [[NSDate distantPast] timeIntervalSinceReferenceDate],
NSInternalInconsistencyException);
d2 = [r0 objectForKey:@"when2"];
NSCAssert([d2 timeIntervalSinceReferenceDate]
== [[NSDate distantFuture] timeIntervalSinceReferenceDate],
NSInternalInconsistencyException); NSInternalInconsistencyException);
} }