gobo-eiffel / gobo

The Gobo Eiffel Project provides the Eiffel community with free and portable Eiffel tools and libraries.
https://sourceforge.net/projects/gobo-eiffel/
Other
59 stars 24 forks source link

Postcondition violation in {DS_HASH_TABLE}.search #6

Closed oligot closed 11 years ago

oligot commented 11 years ago

Hi,

After setting the key equality tester of a DS_HASH_TABLE, a call to `search' will throw a postcondition violation:

found_set: found = has (k)

When digging a but futher, I can see that the postcondition of {DS_SPARSE_CONTAINER}.search_position is also violated:

slots_position_set: slots_position = hash_position (k)

I don't know how to fix this bug, but I've pushed a branch with a test case to reproduce it: https://github.com/oligot/gobo/tree/bug-ds Here is the appropriate commit: https://github.com/oligot/gobo/commit/ca7b465b8f9a0cb596f302a63031d9f063bad2f7

To reproduce:

Testing xstructure...
Preparing Test Cases
Compiling Test Cases
Running Test Cases

Test Summary for xstructure

# Passed:     202 tests
# Failed:     0 test
# ABORTED:    2 tests
# Total:      204 tests (1678 assertions)

Test Results:
ABORT:  [DS_TEST_HASH_TABLE.test_reentrant_search_position] Eiffel exception
-------------------------------------------------------------------------------
Class / Object      Routine                Nature of exception           Effect
-------------------------------------------------------------------------------
DS_HASH_TABLE       search @3              found_set:                   
<00007FD767489478>  (From DS_SPARSE_TABLE) Postcondition violated.       Fail
-------------------------------------------------------------------------------
DS_HASH_TABLE       search @3                                           
<00007FD767489478>  (From DS_SPARSE_TABLE) Routine failure.              Fail
-------------------------------------------------------------------------------
DS_TEST_HASH_TABLE  test_reentrant_search_position @7
<00007FD7674418F8>                         Routine failure.              Fail
-------------------------------------------------------------------------------
PROCEDURE           fast_call                                           
<00007FD767441978>                         Routine failure.              Fail
-------------------------------------------------------------------------------
PROCEDURE           call @5                                             
<00007FD767441978>                         Routine failure.              Fail
-------------------------------------------------------------------------------
DS_TEST_HASH_TABLE  execute_without_rescue @4
<00007FD7674418F8>  (From TS_TEST_CASE)    Routine failure.              Fail
-------------------------------------------------------------------------------
DS_TEST_HASH_TABLE  execute_with_rescue @3                              
<00007FD7674418F8>  (From TS_TEST_CASE)    Routine failure.              Fail
-------------------------------------------------------------------------------
DS_TEST_HASH_TABLE  execute @10                                         
<00007FD7674418F8>  (From TS_TEST_CASE)    Routine failure.              Fail
-------------------------------------------------------------------------------
TS_TEST_SUITE       execute @5                                          
<00007FD76743B948>                         Routine failure.              Fail
-------------------------------------------------------------------------------
XSTRUCTURE          execute_with_summary @44
<00007FD767439558>  (From TS_TESTER)       Routine failure.              Fail
-------------------------------------------------------------------------------
XSTRUCTURE          execute_with_output @10
<00007FD767439558>  (From TS_TESTER)       Routine failure.              Fail
-------------------------------------------------------------------------------
XSTRUCTURE          execute @9                                          
<00007FD767439558>  (From TS_TESTER)       Routine failure.              Fail
-------------------------------------------------------------------------------
XSTRUCTURE          make @5                                             
<00007FD767439558>  (From TS_TESTER)       Routine failure.              Fail
-------------------------------------------------------------------------------
XSTRUCTURE          root's creation                                     
<00007FD767439558>                         Routine failure.              Exit
-------------------------------------------------------------------------------
ebezault commented 11 years ago

Fixed in commit https://github.com/gobo-eiffel/gobo/commit/56ac97c5c7b6433ce42267e95b45d2f2147fbdf2.