@@ -25,19 +25,9 @@ import Proto.Compiler_Fields (argKind, argName, column, constrName, constructors
25
25
import Proto.Compiler_Fields qualified as P
26
26
import Test.LambdaBuffers.Compiler.Utils (distribute , indexBy )
27
27
28
-
29
- -- | Default constant range
30
- defRange = HR. constant lowerBound upperBound
31
- -- or defSize
32
-
33
- -- | Upper bound on various generators
34
- upperBound :: Int
35
- upperBound = 5
36
-
37
- -- | Lower bound on various generators
38
- lowerBound :: Int
39
- lowerBound = 1
40
-
28
+ -- | Default constant range used in various generators
29
+ defRange :: H. Range Int
30
+ defRange = HR. constant 0 5
41
31
42
32
-- | Names
43
33
genAlphaNum :: H. Gen Char
@@ -156,7 +146,7 @@ genTyApp kind tydefs args =
156
146
157
147
genConstructor :: TyDefs -> Set TyArg -> ConstrName -> H. Gen Sum'Constructor
158
148
genConstructor tydefs args cn = do
159
- tys <- H. list ( HR. constant 0 limit) (genTy starKind tydefs args)
149
+ tys <- H. list defRange (genTy starKind tydefs args)
160
150
return $
161
151
defMessage
162
152
& constrName .~ cn
@@ -183,7 +173,7 @@ genTyAbs tydefs ctorNs = do
183
173
vns <-
184
174
if tydefs == mempty
185
175
then return mempty
186
- else H. set ( HR. constant 0 limit) genVarName
176
+ else H. set defRange genVarName
187
177
args <- for (Set. toList vns) genTyArg
188
178
body <- genTyBody tydefs (Set. fromList args) ctorNs
189
179
return $
@@ -203,8 +193,8 @@ genTyDef tydefs tyn ctors = do
203
193
204
194
genModule :: Map ModuleName Module -> ModuleName -> H. Gen Module
205
195
genModule availableMods mn = do
206
- tyNs <- NESet. fromList <$> H. nonEmpty ( HR. constant 0 limit) genTyName
207
- ctorNs <- H. set (HR. constant (length tyNs) (length tyNs * limit )) genConstrName
196
+ tyNs <- NESet. fromList <$> H. nonEmpty defRange genTyName
197
+ ctorNs <- H. set (HR. constant (length tyNs) (length tyNs * 10 )) genConstrName
208
198
tyNsWithCtorNs <- Map. map NESet. fromList <$> distribute (toList ctorNs) (NESet. toSet tyNs)
209
199
let foreignTyDefs = collectTyDefs availableMods
210
200
tydefs <-
@@ -229,7 +219,7 @@ genModule availableMods mn = do
229
219
230
220
genCompilerInput :: H. Gen CompilerInput
231
221
genCompilerInput = do
232
- mns <- H. set ( HR. constant 0 limit) genModuleName
222
+ mns <- H. set defRange genModuleName
233
223
ms <-
234
224
foldM
235
225
( \ availableMods mn -> do
0 commit comments