Add 'hash' test for keywords.
authorLudovic Courtès <ludo@gnu.org>
Fri, 6 Mar 2020 16:17:41 +0000 (17:17 +0100)
committerLudovic Courtès <ludo@gnu.org>
Fri, 6 Mar 2020 16:17:41 +0000 (17:17 +0100)
This is a followup to 8b3cad618314f02ad3921fa104f17ca0f721dfcb.

* test-suite/tests/hash.test ("hash")["keyword"]: New test prefix.

test-suite/tests/hash.test

index 4c21d712934b53a3f4f4a56774c2d9c5b6abb7a4..779043c9a9c031c2b1b2e37b4f313badcb831b81 100644 (file)
@@ -1,7 +1,7 @@
 ;;;; hash.test --- test guile hashing     -*- scheme -*-
 ;;;;
 ;;;; Copyright (C) 2004, 2005, 2006, 2008, 2011, 2012,
-;;;;   2014 Free Software Foundation, Inc.
+;;;;   2014, 2020 Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
   (pass-if (= 0 (hash +nan.0 1)))
   (pass-if (= 0 (hash '#() 1)))
 
+  (with-test-prefix "keyword"
+    (pass-if "equality"
+      (= (hash #:foo most-positive-fixnum)
+         (hash #:foo most-positive-fixnum)))
+    (pass-if "inequality"
+      ;; Inequality cannot be 100% guaranteed but should definitely be
+      ;; met for such a case.
+      (not (= (hash #:foo most-positive-fixnum)
+              (hash #:bar most-positive-fixnum)))))
+
   (pass-if "cyclic vectors"
     (let ()
       (define (cyclic-vector n)