From f0d46570a42bd08210739eb32dbd25f4e2141a3c Mon Sep 17 00:00:00 2001 From: Catherine Tower Date: Sun, 27 Feb 2022 14:15:34 -0800 Subject: [PATCH 1/2] Add missing break statement to cl_hash_table_test Without the break statement an error is signalled for any hash table with a custom test function --- src/c/hash.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/hash.d b/src/c/hash.d index f580b72f5..c42c61690 100644 --- a/src/c/hash.d +++ b/src/c/hash.d @@ -1239,7 +1239,7 @@ cl_hash_table_test(cl_object ht) case ecl_htt_equal: output = @'equal'; break; case ecl_htt_equalp: output = @'equalp'; break; case ecl_htt_pack: output = @'equal'; break; - case ecl_htt_generic: output = ht->hash.generic_test; + case ecl_htt_generic: output = ht->hash.generic_test; break; default: FEerror("hash-table-test: unknown test.", 0); } @(return output); From 88b09a6b60ca9ff1c998c3dadae8e9be27da85a4 Mon Sep 17 00:00:00 2001 From: Catherine Tower Date: Sun, 27 Feb 2022 15:19:01 -0800 Subject: [PATCH 2/2] Add unit test for HASH-TABLE-TEST The test ensures that there's no error when HASH-TABLE-TEST is called on a hash table with a custom equality function. The tests pass, with some caveats: - I'm only about 70% sure that FINISHES is the right test-predicate to use for something like this - The test suite would consistently fail with non-deterministic segfaults while testing the MULTIPROCESSING subtest. This could easily be due to the fact that I'm using a FreeBSD machine, and don't have access to a Linux machine at the moment -- though I'd be happy to re-run the tests when I do. The test suite completed when I commented out the MULTIPROCESSING subtest from the ASD file. I don't believe this would have any bearing on whether or not the hash table tests should pass --- src/tests/normal-tests/hash-tables.lsp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/normal-tests/hash-tables.lsp b/src/tests/normal-tests/hash-tables.lsp index 1e979040c..7e7f32e15 100644 --- a/src/tests/normal-tests/hash-tables.lsp +++ b/src/tests/normal-tests/hash-tables.lsp @@ -147,6 +147,7 @@ (signals error (gethash "foobar" ht)) (signals error (setf (gethash "foobar" ht) 15)) (finishes (remhash 3 ht)) + (finishes (hash-table-test ht)) (is (null (gethash 1 ht))) (finishes (setf (gethash 55 ht) 0)) (is (= (gethash 13 ht) 0)))))