The Inbox: KernelTests-ul.278.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: KernelTests-ul.278.mcz

commits-2
A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-ul.278.mcz

==================== Summary ====================

Name: KernelTests-ul.278
Author: ul
Time: 8 October 2014, 12:38:15.725 pm
UUID: 6ee3d1ac-77c4-4550-bff8-7db203c28f50
Ancestors: KernelTests-dtl.277

RandomTest changes:
- updated #testWellKnownSequence to match the new seed hashing values
- added two new test cases for edge case seed values

=============== Diff against KernelTests-dtl.277 ===============

Item was changed:
  ----- Method: RandomTest>>testNext (in category 'tests') -----
  testNext
 
  10000 timesRepeat: [
  | next |
  next := gen next.
+ self assert: next >= 0.0.
+ self assert: next < 1.0 ].!
- self assert: (next >= 0).
- self assert: (next < 1).
- ].!

Item was added:
+ ----- Method: RandomTest>>testNextForEdgeCases (in category 'tests') -----
+ testNextForEdgeCases
+ " Test #next for edge case input-output pairs "
+
+ self assert: 0.0 equals: (Random seed: 1407677000) next.
+ self assert: (1 << 31 - 1) asFloat / (1 << 31) asFloat equals: (Random seed: 0) next!

Item was added:
+ ----- Method: RandomTest>>testNextValueForEdgeCases (in category 'tests') -----
+ testNextValueForEdgeCases
+ " Test #nextValue for edge case input-output pairs "
+
+ self assert: 1.0 equals: (Random seed: 1407677000) nextValue.
+ self assert: (1 << 31 - 1) asFloat equals: (Random seed: 0) nextValue!

Item was changed:
  ----- Method: RandomTest>>testWellKnownSequence (in category 'tests') -----
  testWellKnownSequence
  "This test assert the immutability of Random generation algorithm.
  It uses Float equality tests, which is a very strict notion of immutability.
  Anyone changing Random algorithm will have to adapt this test."
 
  | theSeedOfWellKnownSequence wellKnownSequence rng effectiveSequence |
  theSeedOfWellKnownSequence := 2345678901.
+ wellKnownSequence :=  #(0.32506402597067136 0.3510923149767762 0.8085456405806102 0.22658906421930952 0.28241015983857687 0.46756423286514553 0.3520695904046621 0.23361375705972953 0.3464227287780599 0.32681039875690376).
- wellKnownSequence := #(0.14924326965084453 0.3316330217437972 0.7561964480002394 0.3937015400238808 0.9417831813645471 0.5499291939427746 0.6599625962134277 0.991354559078512 0.6960744325518955 0.922987899707159 ).
  rng := Random new.
  rng seed: theSeedOfWellKnownSequence.
  effectiveSequence := (1 to: 10) collect: [:i | rng next ].
  self assert: effectiveSequence equals: wellKnownSequence!