Re: Confusing test failure

Grant Rettke <[email protected]>
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>
Quoting Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]>:

> grantrettke wrote:
>> Hi,
>>
>> I tried to build the goanna test/utility project with SmartEiffel
>> 1.2r6 on Windows XP Pro with VC++ 2003 and got the following errors:
>>
>> C:\eiffel\goanna\test\utility>geant test_se
>>
>> Testing xutility...
>> Preparing Test Cases
>> Compiling Test Cases
>> Running Test Cases
>>
>> Test Summary for xutility
>>
>> # Passed:     6 tests
>> # FAILED:     2 tests
>> # Aborted:    0 test
>> # Total:      8 tests (30 assertions)
>>
>> Test Results:
>> FAIL:  [UTILITY_TEST_POOL.test_unbounded_pool] free_count
>>   expected: 0
>>   but  got: 0
>> FAIL:  [UTILITY_TEST_STRING_MANIPULATION.test_last_index_of] two_positions
>>   expected: 9
>>   but  got: 9
>>
>> BUILD FAILED!
>>
>> I don't understand why the test is failing. What is going on here?
>
> You'll have to show us the code of the routine `test_unbounded_pool'
> from class UTILITY_TEST_POOL and of the routine `test_last_index_of'
> from class UTILITY_TEST_STRING_MANIPULATION. Otherwise it's hard to
> say why getest reports an error while claiming that we get the
> expected value.

{UTILITY_TEST_POOL}.
test_unbounded_pool is
-- Test unbounded pool
local
pool: POOL [POOL_ELEMENT]
item, item2, item3: POOL_ELEMENT
do
create pool.make
assert_equal ("free_count" , 0, pool.free_count)
assert_equal ("busy_count" , 0, pool.busy_count)
assert_equal ("count" , 0, pool.count)

-- put elements in pool
create item
pool.put (item)
assert ("item_added", pool.has (item))
assert ("free_item", pool.is_free (item))
assert ("not_busy_item", not pool.is_busy (item))
assert_equal ("free_count1" , 1, pool.free_count)

create item2
pool.put (item2)
assert ("item2_added", pool.has (item2))
assert ("free_item2", pool.is_free (item2))
assert ("not_busy_item2", not pool.is_busy (item2))
assert_equal ("free_count2" , 2, pool.free_count)

create item3
pool.put (item3)
assert ("item3_added", pool.has (item3))
assert ("free_item3", pool.is_free (item3))
assert ("not_busy_item3", not pool.is_busy (item3))
assert_equal ("free_count3" , 3, pool.free_count)

item := pool.item
assert ("busy", pool.is_busy (item))
item2 := pool.item
item3 := pool.item
assert_equal ("free_count" , 0, pool.free_count)
assert_equal ("busy_count" , 3, pool.busy_count)
pool.return (item)
assert_equal ("free", True, pool.is_free (item))
assert_equal ("free_count2", 1, pool.free_count)
assert_equal ("busy_count2", 2, pool.busy_count)
end


{UTILITY_TEST_STRING_MANIPULATION}.
test_last_index_of is
local
str: STRING
do
str := "test.one.two"
assert_equal ("two_positions", last_index_of (str, '.', str.count), 9)
str := "test.one"
assert_equal ("one_position", last_index_of (str, '.', str.count), 5)
str := "test"
assert_equal ("no_positions", last_index_of (str, '.', str.count), 0)
str := "test."
assert_equal ("at_end", last_index_of (str, '.', str.count), 5)
str := "test.one.two"
assert_equal ("start_before_end", last_index_of (str, '.', 8), 5)
str := "."
assert_equal ("one_char", last_index_of (str, '.', str.count), 1)
end



To Post a message, send it to:   [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/gobo-eiffel/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.