diff options
-rwxr-xr-x | scripts/size (renamed from scripts/size.py) | 15 | ||||
-rw-r--r-- | src/VeriFuzz.hs | 14 |
2 files changed, 18 insertions, 11 deletions
diff --git a/scripts/size.py b/scripts/size index 5fe2f48..d6d7466 100755 --- a/scripts/size.py +++ b/scripts/size @@ -2,6 +2,8 @@ import subprocess import statistics +import argparse +import os def file_len(fname): with open(fname) as f: @@ -9,15 +11,20 @@ def file_len(fname): pass return i + 1 -def main(): +def main(c, n): l = [] - for x in range(0, 10): - subprocess.call(["verifuzz", "generate", "-o", "main.v", "-c", "config.toml"]) + for x in range(0, n): + subprocess.call(["verifuzz", "generate", "-o", "main.v", "-c", c]) l.append(file_len("main.v")) + os.remove("main.v") print("mean: ", statistics.mean(l)) print("median: ", statistics.median(l)) print("stdev: ", statistics.stdev(l)) print("variance: ", statistics.variance(l)) if __name__ == '__main__': - main() + parser = argparse.ArgumentParser(description='Check the average size of a generated program.') + parser.add_argument('config', metavar='CONFIG', help='The config file to test.') + parser.add_argument('-n', '--num', help='How many iterations to run.', default=10, type=int) + args = parser.parse_args() + main(args.config, args.num) diff --git a/src/VeriFuzz.hs b/src/VeriFuzz.hs index b7d46d1..7b79633 100644 --- a/src/VeriFuzz.hs +++ b/src/VeriFuzz.hs @@ -293,14 +293,14 @@ randDelete i = do randomise :: Config -> IO Config randomise config@(Config a _ c d e) = do - mia <- randDelete $ cm ^. probModItemAssign + mia <- return $ cm ^. probModItemAssign misa <- return $ cm ^. probModItemSeqAlways - mica <- randDelete $ cm ^. probModItemCombAlways - mii <- randDelete $ cm ^. probModItemInst - ssb <- randDelete $ cs ^. probStmntBlock - ssnb <- randDelete $ cs ^. probStmntNonBlock - ssc <- randDelete $ cs ^. probStmntCond - ssf <- randDelete $ cs ^. probStmntFor + mica <- return $ cm ^. probModItemCombAlways + mii <- return $ cm ^. probModItemInst + ssb <- return $ cs ^. probStmntBlock + ssnb <- return $ cs ^. probStmntNonBlock + ssc <- return $ cs ^. probStmntCond + ssf <- return $ cs ^. probStmntFor en <- return $ ce ^. probExprNum ei <- randDelete $ ce ^. probExprId ers <- randDelete $ ce ^. probExprRangeSelect |