From 7561f55fce9009a2b693b0c77b58040a59a2421e Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Tue, 5 Mar 2024 11:05:47 -0600 Subject: [PATCH] Fix time range in test cases SQL Server doesn't support leap seconds --- src/Database/ODBC/Internal.hs | 3 --- test/Main.hs | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Database/ODBC/Internal.hs b/src/Database/ODBC/Internal.hs index 1609d14..d7a3457 100644 --- a/src/Database/ODBC/Internal.hs +++ b/src/Database/ODBC/Internal.hs @@ -1449,9 +1449,6 @@ sql_ss_length_unlimited = 0 type I16 = Int #endif --- FIXME fail with Randomized with seed 1862667972 --- (on 9.2 as well) - -------- 'T.fromPtr' but compatible with text v1 and v2 fromPtrCompat :: Ptr Word16 -> I16 -> IO Text diff --git a/test/Main.hs b/test/Main.hs index f24dc3f..68721d0 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -696,7 +696,7 @@ instance Arbitrary Day where instance Arbitrary TimeOfDay where arbitrary = do fractional <- choose (0, 9999999) :: Gen Integer - seconds <- choose (0, 86400) + seconds <- choose (0, 86399) pure (timeToTimeOfDay (secondsToDiffTime seconds + (fromRational (fractional % 10000000)))) @@ -706,7 +706,7 @@ instance Arbitrary LocalTime where where arbitraryLimited = do fractional <- choose (0, 9999999) :: Gen Integer - seconds <- choose (0, 86400) + seconds <- choose (0, 86399) pure (timeToTimeOfDay (secondsToDiffTime seconds + (fromRational (fractional % 10000000)))) @@ -719,7 +719,7 @@ newtype TestTimeOfDay = TestTimeOfDay TimeOfDay instance Arbitrary TestTimeOfDay where arbitrary = do - seconds <- choose (0, 86400) + seconds <- choose (0, 86399) pure (TestTimeOfDay (timeToTimeOfDay (secondsToDiffTime seconds))) instance Arbitrary TestDateTime where @@ -729,7 +729,7 @@ instance Arbitrary TestDateTime where fractional <- elements [993, 003, 497, 007, 000, 127] :: Gen Integer -- Rounded to increments of .000, .003, or .007 seconds -- from: https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime-transact-sql - seconds <- choose (0, 86400) + seconds <- choose (0, 86399) pure (timeToTimeOfDay (secondsToDiffTime seconds + (fromRational (fractional % 1000)))) @@ -737,7 +737,7 @@ instance Arbitrary TestDateTime where deriving instance Arbitrary Datetime2 instance Arbitrary Smalldatetime where arbitrary = do - minutes <- choose (0, 1440) + minutes <- choose (0, 1439) day <- do offset <- choose (0, 179) pure (addDays offset (fromGregorian 1900 01 01))