Skip to content

Commit

Permalink
Applied quick check for leftist heap
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinyu95 committed Apr 17, 2023
1 parent bfee90e commit 44d0eda
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions datastruct/heap/binary-heap/src/LeftistHeap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

module LeftistHeap where

import Test.QuickCheck
import Data.List (sort)

-- Definition

data LHeap a = E -- Empty
Expand Down Expand Up @@ -60,6 +63,7 @@ heapSort = hsort . fromList where

-- test

testFromList = fromList [16, 14, 10, 8, 7, 9, 3, 2, 4, 1]
prop_sort :: [Int] -> Bool
prop_sort xs = heapSort xs == sort xs

testHeapSort = heapSort [16, 14, 10, 8, 7, 9, 3, 2, 4, 1]
-- example = fromList [16, 14, 10, 8, 7, 9, 3, 2, 4, 1]

0 comments on commit 44d0eda

Please sign in to comment.