libasterix 0.17.1 → 0.17.2
raw patch · 3 files changed
+20/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- libasterix.cabal +1/−1
- src/Asterix/Base.hs +6/−1
- test/TestAsterix.hs +13/−0
libasterix.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: libasterix-version: 0.17.1+version: 0.17.2 synopsis: Asterix data processing library description: This library provides features to process asterix data format, including
src/Asterix/Base.hs view
@@ -572,7 +572,12 @@ | otherwise = (a+1) * 7 when (n == 0) $ parsingError "empty fspec" case pm of- StrictParsing -> when (n > maxSize) $ parsingError "fspec too big"+ StrictParsing -> do+ -- check max size+ when (n > maxSize) $ parsingError "fspec too big"+ -- check trailing bits, expect all zero+ when (or $ drop definedItems result) $+ parsingError "unexpected fspec bit set" PartialParsing -> pure () pure $ Fspec $ take definedItems result where
test/TestAsterix.hs view
@@ -61,6 +61,7 @@ , testCase "testExplicit3b" testExplicit3b , testCase "testExplicit3c" testExplicit3c , testCase "testCompound0" testCompound0+ , testCase "testCompoundFspecError" testCompoundFspecError , testCase "testCompound1" testCompound1 , testCase "testCompoundSet" testCompoundSet , testCase "testCompoundDel" testCompoundDel@@ -631,6 +632,18 @@ act = parseNonSpare (schema @(RecordOf Cat_000_1_0 ~> "091") Proxy) result = parse @StrictParsing act bs assertEqual "result" True (isLeft result)++testCompoundFspecError :: Assertion+testCompoundFspecError = do+ let -- error: fspec bit is set between 'I1' and 'I2'+ bs1 = fromJust $ unhexlify "c01122"+ -- error: fspec bit is set between 'I1' and 'I2'+ bs2 = fromJust $ unhexlify "a21122"+ act = parseNonSpare (schema @(RecordOf Cat_000_1_0 ~> "092") Proxy)+ result1 = parse @StrictParsing act bs1+ result2 = parse @StrictParsing act bs2+ assertEqual "result1" True (isLeft result1)+ assertEqual "result2" True (isLeft result2) testCompound1 :: Assertion testCompound1 = do