File: 0002-Use-Stdlib.compare-instead-of-for-roundtrip-tests.patch

package info (click to toggle)
ocaml-containers 3.16%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,472 kB
  • sloc: ml: 33,466; sh: 122; ansic: 53; makefile: 32
file content (23 lines) | stat: -rw-r--r-- 879 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
From: =?utf-8?q?St=C3=A9phane_Glondu?= <glondu@debian.org>
Date: Sun, 14 Sep 2025 09:08:25 +0200
Subject: Use Stdlib.compare instead of ( = ) for roundtrip tests

Since not (nan = nan), the test fails whenever nan is involved, which
happens with qcheck 0.26. Use Stdlib.compare instead.
---
 tests/core/t_cbor.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/core/t_cbor.ml b/tests/core/t_cbor.ml
index 1752715..4f36b44 100644
--- a/tests/core/t_cbor.ml
+++ b/tests/core/t_cbor.ml
@@ -104,7 +104,7 @@ let arb = Q.make ~shrink ~print:Cbor.to_string_diagnostic gen_c;;
 q ~count:1_000 ~long_factor:10 arb @@ fun c ->
 let s = Cbor.encode c in
 let c' = Cbor.decode_exn s in
-if not (c = c') then
+if Stdlib.compare c c' <> 0 then
   Q.Test.fail_reportf "@[<hv2>roundtrip failed:@ from %a@ to %a@]"
     Cbor.pp_diagnostic c Cbor.pp_diagnostic c';
 true