hw-rankselect 0.0.0.3 → 0.0.0.4
raw patch · 4 files changed
+146/−149 lines, 4 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- HaskellWorks.Data.Succinct.BalancedParens.Internal: depth :: (BalancedParens v, Rank0 v, Rank1 v) => v -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Internal: depth :: (BalancedParens v, Rank0 v, Rank1 v) => v -> Count -> Maybe Count
- HaskellWorks.Data.Succinct.BalancedParens.Internal: enclose :: BalancedParens v => v -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Internal: enclose :: BalancedParens v => v -> Count -> Maybe Count
- HaskellWorks.Data.Succinct.BalancedParens.Internal: findClose :: BalancedParens v => v -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Internal: findClose :: BalancedParens v => v -> Count -> Maybe Count
- HaskellWorks.Data.Succinct.BalancedParens.Internal: findOpen :: BalancedParens v => v -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Internal: findOpen :: BalancedParens v => v -> Count -> Maybe Count
- HaskellWorks.Data.Succinct.BalancedParens.Internal: subtreeSize :: BalancedParens v => v -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Internal: subtreeSize :: BalancedParens v => v -> Count -> Maybe Count
- HaskellWorks.Data.Succinct.BalancedParens.Simple: findClose :: BalancedParens v => v -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Simple: findClose :: BalancedParens v => v -> Count -> Maybe Count
- HaskellWorks.Data.Succinct.BalancedParens.Simple: findClose' :: (BitLength a, TestBit a) => Count -> SimpleBalancedParens a -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Simple: findClose' :: (BitLength a, TestBit a) => Count -> SimpleBalancedParens a -> Count -> Maybe Count
- HaskellWorks.Data.Succinct.BalancedParens.Simple: findOpen :: BalancedParens v => v -> Count -> Count
+ HaskellWorks.Data.Succinct.BalancedParens.Simple: findOpen :: BalancedParens v => v -> Count -> Maybe Count
Files
- hw-rankselect.cabal +1/−1
- src/HaskellWorks/Data/Succinct/BalancedParens/Internal.hs +7/−7
- src/HaskellWorks/Data/Succinct/BalancedParens/Simple.hs +56/−59
- test/HaskellWorks/Data/Succinct/BalancedParensSpec.hs +82/−82
hw-rankselect.cabal view
@@ -1,5 +1,5 @@ name: hw-rankselect-version: 0.0.0.3+version: 0.0.0.4 synopsis: Conduits for tokenizing streams. description: Please see README.md homepage: http://github.com/haskell-works/hw-rankselect#readme
src/HaskellWorks/Data/Succinct/BalancedParens/Internal.hs view
@@ -9,15 +9,15 @@ import HaskellWorks.Data.Succinct.RankSelect.Binary.Basic.Rank1 class BalancedParens v where- findOpen :: v -> Count -> Count- findClose :: v -> Count -> Count- enclose :: v -> Count -> Count+ findOpen :: v -> Count -> Maybe Count+ findClose :: v -> Count -> Maybe Count+ enclose :: v -> Count -> Maybe Count firstChild :: v -> Count -> Maybe Count nextSibling :: v -> Count -> Maybe Count parent :: v -> Count -> Maybe Count -depth :: (BalancedParens v, Rank0 v, Rank1 v) => v -> Count -> Count-depth v p = let q = findOpen v p in rank1 v q - rank0 v q+depth :: (BalancedParens v, Rank0 v, Rank1 v) => v -> Count -> Maybe Count+depth v p = (\q -> rank1 v q - rank0 v q) <$> findOpen v p -subtreeSize :: BalancedParens v => v -> Count -> Count-subtreeSize v p = (findClose v p - p + 1) `quot` 2+subtreeSize :: BalancedParens v => v -> Count -> Maybe Count+subtreeSize v p = (\q -> (q - p + 1) `quot` 2) <$> findClose v p
src/HaskellWorks/Data/Succinct/BalancedParens/Simple.hs view
@@ -10,6 +10,7 @@ , openAt ) where +import Control.Monad import qualified Data.Vector.Storable as DVS import Data.Word import HaskellWorks.Data.Bits.BitLength@@ -41,37 +42,33 @@ openAt v c = v .?. toPosition (c - 1) {-# INLINABLE openAt #-} -require :: Bool -> String -> a -> a-require p msg v = if p then v else error msg-{-# INLINABLE require #-}--findOpen' :: (BitLength a, TestBit a) => Count -> SimpleBalancedParens a -> Count -> Count-findOpen' c v p =- require (0 < p && p <= bitLength v) "Out of bounds" $- if v `openAt` p+findOpen' :: (BitLength a, TestBit a) => Count -> SimpleBalancedParens a -> Count -> Maybe Count+findOpen' c v p = if 0 < p && p <= bitLength v+ then if v `openAt` p then if c == 0- then p+ then Just p else findOpen' (c - 1) v (p - 1) else findOpen' (c + 1) v (p - 1)+ else Nothing {-# INLINABLE findOpen' #-} -findClose' :: (BitLength a, TestBit a) => Count -> SimpleBalancedParens a -> Count -> Count-findClose' c v p =- require (1 < p && p <= bitLength v) "Out of bounds" $- if v `closeAt` p+findClose' :: (BitLength a, TestBit a) => Count -> SimpleBalancedParens a -> Count -> Maybe Count+findClose' c v p = if 1 < p && p <= bitLength v+ then if v `closeAt` p then if c == 0- then p+ then Just p else findClose' (c + 1) v (p + 1) else findClose' (c - 1) v (p + 1)+ else Nothing {-# INLINABLE findClose' #-} instance BalancedParens (SimpleBalancedParens [Bool]) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -80,12 +77,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens (DVS.Vector Word8)) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -94,12 +91,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens (DVS.Vector Word16)) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -108,12 +105,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens (DVS.Vector Word32)) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -122,12 +119,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens (DVS.Vector Word64)) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -136,12 +133,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens Word8) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -150,12 +147,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens Word16) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -164,12 +161,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens Word32) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}@@ -178,12 +175,12 @@ {-# INLINABLE parent #-} instance BalancedParens (SimpleBalancedParens Word64) where- findOpen v p = if v `openAt` p then p else findOpen' (Count 0) v (p - 1)- findClose v p = if v `closeAt` p then p else findClose' (Count 0) v (p + 1)+ findOpen v p = if v `openAt` p then Just p else findOpen' (Count 0) v (p - 1)+ findClose v p = if v `closeAt` p then Just p else findClose' (Count 0) v (p + 1) enclose = findOpen' (Count 1)- firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing- nextSibling v p = let q = findClose v p in if p == q then Nothing else Just (q + 1)- parent v p = Just (enclose v p)+ firstChild v p = if openAt v p && openAt v (p + 1) then Just (p + 1) else Nothing+ nextSibling v p = findClose v p >>= (\q -> if (p /= q) then return (q + 1) else Nothing)+ parent v p = enclose v p >>= (\r -> if (r >= 1) then return r else Nothing) {-# INLINABLE findOpen #-} {-# INLINABLE findClose #-} {-# INLINABLE enclose #-}
test/HaskellWorks/Data/Succinct/BalancedParensSpec.hs view
@@ -16,101 +16,101 @@ spec = describe "HaskellWorks.Data.Succinct.BalancedParensSpec" $ do describe "For (()(()())) 1101101000" $ do let bs = SimpleBalancedParens (91 :: Word64)- it "Test 1a" $ findClose bs 1 `shouldBe` 10- it "Test 1b" $ findClose bs 2 `shouldBe` 3- it "Test 1b" $ findClose bs 3 `shouldBe` 3- it "Test 1b" $ findClose bs 4 `shouldBe` 9- it "Test 1b" $ findClose bs 5 `shouldBe` 6- it "Test 1b" $ findClose bs 6 `shouldBe` 6- it "Test 1b" $ findClose bs 7 `shouldBe` 8- it "Test 1b" $ findClose bs 8 `shouldBe` 8- it "Test 1b" $ findClose bs 9 `shouldBe` 9- it "Test 1b" $ findClose bs 10 `shouldBe` 10- it "Test 2a" $ findOpen bs 10 `shouldBe` 1- it "Test 2b" $ findOpen bs 3 `shouldBe` 2- it "Test 3a" $ enclose bs 2 `shouldBe` 1- it "Test 3b" $ enclose bs 7 `shouldBe` 4+ it "Test 1a" $ findClose bs 1 `shouldBe` Just 10+ it "Test 1b" $ findClose bs 2 `shouldBe` Just 3+ it "Test 1b" $ findClose bs 3 `shouldBe` Just 3+ it "Test 1b" $ findClose bs 4 `shouldBe` Just 9+ it "Test 1b" $ findClose bs 5 `shouldBe` Just 6+ it "Test 1b" $ findClose bs 6 `shouldBe` Just 6+ it "Test 1b" $ findClose bs 7 `shouldBe` Just 8+ it "Test 1b" $ findClose bs 8 `shouldBe` Just 8+ it "Test 1b" $ findClose bs 9 `shouldBe` Just 9+ it "Test 1b" $ findClose bs 10 `shouldBe` Just 10+ it "Test 2a" $ findOpen bs 10 `shouldBe` Just 1+ it "Test 2b" $ findOpen bs 3 `shouldBe` Just 2+ it "Test 3a" $ enclose bs 2 `shouldBe` Just 1+ it "Test 3b" $ enclose bs 7 `shouldBe` Just 4 describe "For (()(()())) 1101101000" $ do let bs = SimpleBalancedParens (fromJust (bitRead "1101101000") :: [Bool])- it "Test 1a" $ findClose bs 1 `shouldBe` 10- it "Test 1b" $ findClose bs 2 `shouldBe` 3- it "Test 1b" $ findClose bs 3 `shouldBe` 3- it "Test 1b" $ findClose bs 4 `shouldBe` 9- it "Test 1b" $ findClose bs 5 `shouldBe` 6- it "Test 1b" $ findClose bs 6 `shouldBe` 6- it "Test 1b" $ findClose bs 7 `shouldBe` 8- it "Test 1b" $ findClose bs 8 `shouldBe` 8- it "Test 1b" $ findClose bs 9 `shouldBe` 9- it "Test 1b" $ findClose bs 10 `shouldBe` 10- it "Test 2a" $ findOpen bs 10 `shouldBe` 1- it "Test 2b" $ findOpen bs 3 `shouldBe` 2- it "Test 3a" $ enclose bs 2 `shouldBe` 1- it "Test 3b" $ enclose bs 7 `shouldBe` 4+ it "Test 1a" $ findClose bs 1 `shouldBe` Just 10+ it "Test 1b" $ findClose bs 2 `shouldBe` Just 3+ it "Test 1b" $ findClose bs 3 `shouldBe` Just 3+ it "Test 1b" $ findClose bs 4 `shouldBe` Just 9+ it "Test 1b" $ findClose bs 5 `shouldBe` Just 6+ it "Test 1b" $ findClose bs 6 `shouldBe` Just 6+ it "Test 1b" $ findClose bs 7 `shouldBe` Just 8+ it "Test 1b" $ findClose bs 8 `shouldBe` Just 8+ it "Test 1b" $ findClose bs 9 `shouldBe` Just 9+ it "Test 1b" $ findClose bs 10 `shouldBe` Just 10+ it "Test 2a" $ findOpen bs 10 `shouldBe` Just 1+ it "Test 2b" $ findOpen bs 3 `shouldBe` Just 2+ it "Test 3a" $ enclose bs 2 `shouldBe` Just 1+ it "Test 3b" $ enclose bs 7 `shouldBe` Just 4 it "firstChild 1" $ firstChild bs 1 `shouldBe` Just 2 it "firstChild 4" $ firstChild bs 4 `shouldBe` Just 5 it "nextSibling 2" $ nextSibling bs 2 `shouldBe` Just 4 it "nextSibling 5" $ nextSibling bs 5 `shouldBe` Just 7 it "parent 2" $ parent bs 2 `shouldBe` Just 1 it "parent 5" $ parent bs 5 `shouldBe` Just 4- it "depth 1" $ depth bs 1 `shouldBe` 1- it "depth 2" $ depth bs 2 `shouldBe` 2- it "depth 3" $ depth bs 3 `shouldBe` 2- it "depth 4" $ depth bs 4 `shouldBe` 2- it "depth 5" $ depth bs 5 `shouldBe` 3- it "depth 6" $ depth bs 6 `shouldBe` 3- it "depth 7" $ depth bs 7 `shouldBe` 3- it "depth 8" $ depth bs 8 `shouldBe` 3- it "depth 9" $ depth bs 9 `shouldBe` 2- it "depth 10" $ depth bs 10 `shouldBe` 1- it "subtreeSize 1" $ subtreeSize bs 1 `shouldBe` 5- it "subtreeSize 2" $ subtreeSize bs 2 `shouldBe` 1- it "subtreeSize 3" $ subtreeSize bs 3 `shouldBe` 0- it "subtreeSize 4" $ subtreeSize bs 4 `shouldBe` 3- it "subtreeSize 5" $ subtreeSize bs 5 `shouldBe` 1- it "subtreeSize 6" $ subtreeSize bs 6 `shouldBe` 0- it "subtreeSize 7" $ subtreeSize bs 7 `shouldBe` 1- it "subtreeSize 8" $ subtreeSize bs 8 `shouldBe` 0- it "subtreeSize 9" $ subtreeSize bs 9 `shouldBe` 0- it "subtreeSize 10" $ subtreeSize bs 10 `shouldBe` 0+ it "depth 1" $ depth bs 1 `shouldBe` Just 1+ it "depth 2" $ depth bs 2 `shouldBe` Just 2+ it "depth 3" $ depth bs 3 `shouldBe` Just 2+ it "depth 4" $ depth bs 4 `shouldBe` Just 2+ it "depth 5" $ depth bs 5 `shouldBe` Just 3+ it "depth 6" $ depth bs 6 `shouldBe` Just 3+ it "depth 7" $ depth bs 7 `shouldBe` Just 3+ it "depth 8" $ depth bs 8 `shouldBe` Just 3+ it "depth 9" $ depth bs 9 `shouldBe` Just 2+ it "depth 10" $ depth bs 10 `shouldBe` Just 1+ it "subtreeSize 1" $ subtreeSize bs 1 `shouldBe` Just 5+ it "subtreeSize 2" $ subtreeSize bs 2 `shouldBe` Just 1+ it "subtreeSize 3" $ subtreeSize bs 3 `shouldBe` Just 0+ it "subtreeSize 4" $ subtreeSize bs 4 `shouldBe` Just 3+ it "subtreeSize 5" $ subtreeSize bs 5 `shouldBe` Just 1+ it "subtreeSize 6" $ subtreeSize bs 6 `shouldBe` Just 0+ it "subtreeSize 7" $ subtreeSize bs 7 `shouldBe` Just 1+ it "subtreeSize 8" $ subtreeSize bs 8 `shouldBe` Just 0+ it "subtreeSize 9" $ subtreeSize bs 9 `shouldBe` Just 0+ it "subtreeSize 10" $ subtreeSize bs 10 `shouldBe` Just 0 describe "For (()(()())) 11011010 00000000 :: DVS.Vector Word8" $ do let bs = SimpleBalancedParens (fromJust (bitRead "11011010 00000000") :: DVS.Vector Word8)- it "Test 1a" $ findClose bs 1 `shouldBe` 10- it "Test 1b" $ findClose bs 2 `shouldBe` 3- it "Test 1b" $ findClose bs 3 `shouldBe` 3- it "Test 1b" $ findClose bs 4 `shouldBe` 9- it "Test 1b" $ findClose bs 5 `shouldBe` 6- it "Test 1b" $ findClose bs 6 `shouldBe` 6- it "Test 1b" $ findClose bs 7 `shouldBe` 8- it "Test 1b" $ findClose bs 8 `shouldBe` 8- it "Test 1b" $ findClose bs 9 `shouldBe` 9- it "Test 1b" $ findClose bs 10 `shouldBe` 10- it "Test 2a" $ findOpen bs 10 `shouldBe` 1- it "Test 2b" $ findOpen bs 3 `shouldBe` 2- it "Test 3a" $ enclose bs 2 `shouldBe` 1- it "Test 3b" $ enclose bs 7 `shouldBe` 4+ it "Test 1a" $ findClose bs 1 `shouldBe` Just 10+ it "Test 1b" $ findClose bs 2 `shouldBe` Just 3+ it "Test 1b" $ findClose bs 3 `shouldBe` Just 3+ it "Test 1b" $ findClose bs 4 `shouldBe` Just 9+ it "Test 1b" $ findClose bs 5 `shouldBe` Just 6+ it "Test 1b" $ findClose bs 6 `shouldBe` Just 6+ it "Test 1b" $ findClose bs 7 `shouldBe` Just 8+ it "Test 1b" $ findClose bs 8 `shouldBe` Just 8+ it "Test 1b" $ findClose bs 9 `shouldBe` Just 9+ it "Test 1b" $ findClose bs 10 `shouldBe` Just 10+ it "Test 2a" $ findOpen bs 10 `shouldBe` Just 1+ it "Test 2b" $ findOpen bs 3 `shouldBe` Just 2+ it "Test 3a" $ enclose bs 2 `shouldBe` Just 1+ it "Test 3b" $ enclose bs 7 `shouldBe` Just 4 it "firstChild 1" $ firstChild bs 1 `shouldBe` Just 2 it "firstChild 4" $ firstChild bs 4 `shouldBe` Just 5 it "nextSibling 2" $ nextSibling bs 2 `shouldBe` Just 4 it "nextSibling 5" $ nextSibling bs 5 `shouldBe` Just 7 it "parent 2" $ parent bs 2 `shouldBe` Just 1 it "parent 5" $ parent bs 5 `shouldBe` Just 4- it "depth 1" $ depth bs 1 `shouldBe` 1- it "depth 2" $ depth bs 2 `shouldBe` 2- it "depth 3" $ depth bs 3 `shouldBe` 2- it "depth 4" $ depth bs 4 `shouldBe` 2- it "depth 5" $ depth bs 5 `shouldBe` 3- it "depth 6" $ depth bs 6 `shouldBe` 3- it "depth 7" $ depth bs 7 `shouldBe` 3- it "depth 8" $ depth bs 8 `shouldBe` 3- it "depth 9" $ depth bs 9 `shouldBe` 2- it "depth 10" $ depth bs 10 `shouldBe` 1- it "subtreeSize 1" $ subtreeSize bs 1 `shouldBe` 5- it "subtreeSize 2" $ subtreeSize bs 2 `shouldBe` 1- it "subtreeSize 3" $ subtreeSize bs 3 `shouldBe` 0- it "subtreeSize 4" $ subtreeSize bs 4 `shouldBe` 3- it "subtreeSize 5" $ subtreeSize bs 5 `shouldBe` 1- it "subtreeSize 6" $ subtreeSize bs 6 `shouldBe` 0- it "subtreeSize 7" $ subtreeSize bs 7 `shouldBe` 1- it "subtreeSize 8" $ subtreeSize bs 8 `shouldBe` 0- it "subtreeSize 9" $ subtreeSize bs 9 `shouldBe` 0- it "subtreeSize 10" $ subtreeSize bs 10 `shouldBe` 0+ it "depth 1" $ depth bs 1 `shouldBe` Just 1+ it "depth 2" $ depth bs 2 `shouldBe` Just 2+ it "depth 3" $ depth bs 3 `shouldBe` Just 2+ it "depth 4" $ depth bs 4 `shouldBe` Just 2+ it "depth 5" $ depth bs 5 `shouldBe` Just 3+ it "depth 6" $ depth bs 6 `shouldBe` Just 3+ it "depth 7" $ depth bs 7 `shouldBe` Just 3+ it "depth 8" $ depth bs 8 `shouldBe` Just 3+ it "depth 9" $ depth bs 9 `shouldBe` Just 2+ it "depth 10" $ depth bs 10 `shouldBe` Just 1+ it "subtreeSize 1" $ subtreeSize bs 1 `shouldBe` Just 5+ it "subtreeSize 2" $ subtreeSize bs 2 `shouldBe` Just 1+ it "subtreeSize 3" $ subtreeSize bs 3 `shouldBe` Just 0+ it "subtreeSize 4" $ subtreeSize bs 4 `shouldBe` Just 3+ it "subtreeSize 5" $ subtreeSize bs 5 `shouldBe` Just 1+ it "subtreeSize 6" $ subtreeSize bs 6 `shouldBe` Just 0+ it "subtreeSize 7" $ subtreeSize bs 7 `shouldBe` Just 1+ it "subtreeSize 8" $ subtreeSize bs 8 `shouldBe` Just 0+ it "subtreeSize 9" $ subtreeSize bs 9 `shouldBe` Just 0+ it "subtreeSize 10" $ subtreeSize bs 10 `shouldBe` Just 0