Show
Ignore:
Timestamp:
04/28/09 07:36:58 (7 months ago)
Author:
jmaessen
Message:

[libraries] Fixed bug in shuffle (and added test to see that shuffling
was happening; this can fail with astronomically low probability).
Removed bounds checking from quicksort as it's quite reliable and
wants to run fast. Added list interface to quicksort.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/tests/ShuffleTest.fss

    r3569 r3675  
    2525    lt(a:ZZ32,b:ZZ32): Boolean = a < b 
    2626    a = array[\ZZ32\](50).fill(fn i => i) 
    27     for _ <- 1#10 do 
     27    matches : ZZ32 := 0 
     28    for _ <- seq(1#10) do 
     29        println(a) 
    2830        shuffle(a) 
    2931        c = a.copy() 
     
    4042            end 
    4143        end 
     44        if (a=c) then 
     45            atomic matches += 1 
     46        end 
    4247    end 
     48    assert(matches < 10, true, "No shuffling ever occurred!") 
    4349  end 
    4450