• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7826: The HASHREVERSE test case in SpreadSheetPluginTestCases fails.... randomly

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension SpreadSheetPlugin Low Closed TWiki:Main.HaraldJoerg minor 6.1.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

For the semi-automatic test for SpreadSheetPlugin, the tests are shipped as an extra topic SpreadSheetPluginTestCases. Every now and then the test for $HASHREVERSE fails like this:

Expected HASHREVERSE
<ul> <li> $SETHASH()=|| </li> <li> $LIST2HASH(age, Jane, 26, Tim, 27, Sam, 27)=|| </li> <li> $HASHREVERSE(age)=|| </li> <li>
$HASH2LIST(age, $key: $value)=|26: Jane, 27: Tim|
$HASH2LIST(age, $key: $value)=|26: Jane, 27: Sam|
</li> <li> $HASHREVERSE(height)=|| </li> <li> $HASH2LIST(height)=|| </li> <li> $HASHREVERSE()=|| </li> </ul>

Root cause: Since Perl 5.18, Perl randomizes the order of keys in a hash. The two hash entries for Tim and Sam both share a value of 27. On flipping the hash over, it has always been known and expected behavior that only one of the two can survive under the key of 27 in the reversed hash. But as of today, we can't know which one.

Fix: Pretend that Sam had his birthday yesterday and make him 28 years old. This should to be changed in the plugin docs, too, though the warning " Hash keys are always unique, e.g. multiple identical values will be reduced to one key." should be kept in place.

Side note: The function $HASH2LIST sorts the keys of the hash before converting to a list and is therefore not affected by the randomization.

-- TWiki:Main/HaraldJoerg - 2017-10-20

ItemTemplate
Summary The HASHREVERSE test case in SpreadSheetPluginTestCases fails.... randomly
ReportedBy TWiki:Main.HaraldJoerg
Codebase ~twiki4, 6.0.2
SVN Range TWiki-6.0.2-trunk, Thu, 17 Aug 2017, build 30373
AppliesTo Extension
Component SpreadSheetPlugin
Priority Low
CurrentState Closed
WaitingFor TWiki:Main.HaraldJoerg
Checkins TWikirev:30400
TargetRelease minor
ReleasedIn 6.1.0
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2018-07-17 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback