properly test nanosecond precision with oracle and datetime_setup
Rafael Kitover [Tue, 23 Jun 2009 23:36:12 +0000 (23:36 +0000)]
t/73oracle_inflate.t

index 949a6c3..22fabce 100644 (file)
@@ -17,7 +17,7 @@ else {
         plan skip_all => 'needs DateTime and DateTime::Format::Oracle for testing';
     }
     else {
-        plan tests => 9;
+        plan tests => 10;
     }
 }
 
@@ -81,7 +81,7 @@ $schema->connection($dsn, $user, $pass, {
 $dt = DateTime->now();
 
 my $timestamp = $dt->clone;
-$timestamp->millisecond( 80 );
+$timestamp->set_nanosecond( int 500_000_000 );
 
 $track = $schema->resultset('Track')->find( 1 );
 $track->update({ last_updated_on => $dt, last_updated_at => $timestamp });
@@ -91,6 +91,9 @@ $track = $schema->resultset('Track')->find(1);
 is( $track->last_updated_on, $dt, 'DateTime round-trip as DATE' );
 is( $track->last_updated_at, $timestamp, 'DateTime round-trip as TIMESTAMP' );
 
+is( int $track->last_updated_at->nanosecond, int 500_000_000,
+  'TIMESTAMP nanoseconds survived' );
+
 # clean up our mess
 END {
     if($schema && ($dbh = $schema->storage->dbh)) {