unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 11ad425eae0b8dbf74abad1de343eadf7d89b9f5 954 bytes (raw)
name: packages/patches/ghc-aeson-encodeDouble.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
From 58766a1916b4980792763bab74f0c86e2a7ebf20 Mon Sep 17 00:00:00 2001
From: Oleg Grenrus <oleg.grenrus@iki.fi>
Date: Thu, 1 Jun 2023 22:58:28 +0300
Subject: [PATCH] QC-2.14.3 Double generators generates infinite number too

---
 tests/PropUtils.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/PropUtils.hs b/tests/PropUtils.hs
index 3c449029a..43de85d7f 100644
--- a/tests/PropUtils.hs
+++ b/tests/PropUtils.hs
@@ -51,8 +51,9 @@ import qualified Data.Aeson.Decoding as Dec
 
 encodeDouble :: Double -> Double -> Property
 encodeDouble num denom
-    | isInfinite d || isNaN d = encode d === "null"
-    | otherwise               = (read . L.unpack . encode) d === d
+    | isNaN d      = encode d === "null"
+    | isInfinite d = if d > 0 then encode d === "\"+inf\"" else encode d === "\"-inf\""
+    | otherwise    = (read . L.unpack . encode) d === d
   where d = num / denom
 
 encodeInteger :: Integer -> Property

debug log:

solving 11ad425eae0b8dbf74abad1de343eadf7d89b9f5 ...
found 11ad425eae0b8dbf74abad1de343eadf7d89b9f5 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).