Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
time
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rinat Striungis
time
Commits
d03429e1
Commit
d03429e1
authored
8 years ago
by
Ashley Yakeley
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests on 32 bit
parent
2060aed5
No related branches found
Branches containing commit
Tags
1.8.0.1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Checklist
+0
-1
0 additions, 1 deletion
Checklist
test/unix/Test/Format/Format.hs
+11
-5
11 additions, 5 deletions
test/unix/Test/Format/Format.hs
with
11 additions
and
6 deletions
Checklist
+
0
−
1
View file @
d03429e1
...
...
@@ -49,7 +49,6 @@ Before release:
git pull
stack build --pedantic --test --haddock && echo OK
(ignore errors)
11. Build and test on Windows
...
...
This diff is collapsed.
Click to expand it.
test/unix/Test/Format/Format.hs
+
11
−
5
View file @
d03429e1
...
...
@@ -12,6 +12,7 @@ import Test.QuickCheck hiding (Result)
import
Test.QuickCheck.Property
import
Test.Tasty
import
Test.Tasty.HUnit
import
Test.Tasty.QuickCheck
import
Test.TestUtil
import
System.IO.Unsafe
...
...
@@ -67,6 +68,13 @@ instance Arbitrary TimeOfDay where
s
<-
choose
(
0
,
59.999999999999
)
-- don't allow leap-seconds
return
$
TimeOfDay
h
m
s
-- | The size of 'CTime' is platform-dependent.
secondsFitInCTime
::
Integer
->
Bool
secondsFitInCTime
sec
=
let
CTime
ct
=
fromInteger
sec
sec'
=
toInteger
ct
in
sec
==
sec'
instance
Arbitrary
UTCTime
where
arbitrary
=
do
day
<-
choose
(
-
25000
,
75000
)
...
...
@@ -76,9 +84,7 @@ instance Arbitrary UTCTime where
localT
=
LocalTime
(
ModifiedJulianDay
day
)
time
utcT
=
localTimeToUTC
utc
localT
secondsInteger
=
floor
(
utcTimeToPOSIXSeconds
utcT
)
CTime
secondsCTime
=
fromInteger
secondsInteger
secondsInteger'
=
toInteger
secondsCTime
if
secondsInteger
==
secondsInteger'
if
secondsFitInCTime
(
secondsInteger
+
2
*
86400
)
&&
secondsFitInCTime
(
secondsInteger
-
2
*
86400
)
-- two days slop each way
then
return
utcT
else
arbitrary
...
...
@@ -108,7 +114,7 @@ compareFormat modUnix fmt zone time = let
haskellText
=
formatTime
locale
fmt
ctime
unixText
=
unixFormatTime
fmt
zone
time
expectedText
=
unixWorkarounds
fmt
(
modUnix
unixText
)
in
assertEqualQC
""
expectedText
haskellText
in
assertEqualQC
(
show
time
++
" with "
++
show
zone
)
expectedText
haskellText
-- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
-- plus FgGklz
...
...
@@ -211,4 +217,4 @@ testQs = [
]
testFormat
::
TestTree
testFormat
=
testGroup
"testFormat"
$
testCompareFormat
++
testCompareHashFormat
++
testQs
testFormat
=
localOption
(
QuickCheckTests
10000
)
$
testGroup
"testFormat"
$
testCompareFormat
++
testCompareHashFormat
++
testQs
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment