@@ -25,19 +25,9 @@ import Proto.Compiler_Fields (argKind, argName, column, constrName, constructors
2525import Proto.Compiler_Fields qualified as P
2626import Test.LambdaBuffers.Compiler.Utils (distribute , indexBy )
2727
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
4131
4232-- | Names
4333genAlphaNum :: H. Gen Char
@@ -156,7 +146,7 @@ genTyApp kind tydefs args =
156146
157147genConstructor :: TyDefs -> Set TyArg -> ConstrName -> H. Gen Sum'Constructor
158148genConstructor 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)
160150 return $
161151 defMessage
162152 & constrName .~ cn
@@ -183,7 +173,7 @@ genTyAbs tydefs ctorNs = do
183173 vns <-
184174 if tydefs == mempty
185175 then return mempty
186- else H. set ( HR. constant 0 limit) genVarName
176+ else H. set defRange genVarName
187177 args <- for (Set. toList vns) genTyArg
188178 body <- genTyBody tydefs (Set. fromList args) ctorNs
189179 return $
@@ -203,8 +193,8 @@ genTyDef tydefs tyn ctors = do
203193
204194genModule :: Map ModuleName Module -> ModuleName -> H. Gen Module
205195genModule 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
208198 tyNsWithCtorNs <- Map. map NESet. fromList <$> distribute (toList ctorNs) (NESet. toSet tyNs)
209199 let foreignTyDefs = collectTyDefs availableMods
210200 tydefs <-
@@ -229,7 +219,7 @@ genModule availableMods mn = do
229219
230220genCompilerInput :: H. Gen CompilerInput
231221genCompilerInput = do
232- mns <- H. set ( HR. constant 0 limit) genModuleName
222+ mns <- H. set defRange genModuleName
233223 ms <-
234224 foldM
235225 ( \ availableMods mn -> do
0 commit comments