File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/Codec/CBOR/Cuddle/CBOR Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
cabal-version : 3.4
2
2
name : cuddle
3
- version : 0.1.6 .0
3
+ version : 0.1.7 .0
4
4
synopsis : CDDL Generator and test utilities
5
5
6
6
-- description:
Original file line number Diff line number Diff line change @@ -277,6 +277,22 @@ genForCTree (CTree.Control op target controller) = do
277
277
CTree. Postlude PTBytes -> S . TBytes <$> genBytes (fromIntegral n)
278
278
CTree. Postlude PTUInt -> S . TInteger <$> genUniformRM (0 , 2 ^ n - 1 )
279
279
_ -> error " Cannot apply size operator to target "
280
+ (CtlOp. Size , CTree. Range {CTree. from, CTree. to}) -> do
281
+ f <- resolveIfRef from
282
+ t <- resolveIfRef to
283
+ case (f, t) of
284
+ (CTree. Literal (VUInt f1), CTree. Literal (VUInt t1)) -> case tt of
285
+ CTree. Postlude PTBytes ->
286
+ genUniformRM (fromIntegral f1, fromIntegral t1)
287
+ >>= (fmap (S . TBytes ) . genBytes)
288
+ CTree. Postlude PTUInt ->
289
+ S . TInteger
290
+ <$> genUniformRM (fromIntegral f1, fromIntegral t1)
291
+ _ -> error $ " Cannot apply size operator to target: " <> show tt
292
+ _ ->
293
+ error $
294
+ " Invalid controller for .size operator: "
295
+ <> show controller
280
296
(CtlOp. Size , _) ->
281
297
error $
282
298
" Invalid controller for .size operator: "
You can’t perform that action at this time.
0 commit comments