Mercurial > pub > dyncall > dyncall
diff test/suite_aggrs/rand-sig.lua @ 438:b4ddad459690
suite_aggr;
- made generator produce unique signatures
- reduced dcNewStruct() calls to once only per sig
- added missing free()s
- cleanup: removal of unused decl, func renaming for clarity, static for tu-local symbols, ...
author | Tassilo Philipp |
---|---|
date | Wed, 26 Jan 2022 13:37:19 +0100 |
parents | 3d2c5d156d78 |
children | 54c1dc2e6ea5 |
line wrap: on
line diff
--- a/test/suite_aggrs/rand-sig.lua Wed Jan 26 13:26:39 2022 +0100 +++ b/test/suite_aggrs/rand-sig.lua Wed Jan 26 13:37:19 2022 +0100 @@ -3,7 +3,6 @@ -- assure aggr chars are present in pairs (can be weighted, though), to avoid -- inf loops if string.match(types,'{') and not string.match(types,'}') then types = types..'}' end --- @@@ unions, arrays rtypes = "v"..types @@ -41,6 +40,7 @@ math.randomseed(seed) local id +local uniq_sigs = { } for i = 1, ncases do local nargs = math.random(minargs,maxargs) local l = '' @@ -51,9 +51,10 @@ id = math.random(#types) sig[#sig+1] = mktype(types:sub(id,id), 0, math.random(maxaggrdepth)) -- random depth avoids excessive nesting end - l = table.concat(sig) - -- reject sigs without any aggregate, as this is about aggrs after all - until string.match(l, '{') ~= nil + l = table.concat(sig) + -- reject dupes and sigs without any aggregate, as this is about aggrs after all + until string.match(l, '{') ~= nil and uniq_sigs[l] == nil + uniq_sigs[l] = 1 io.write(l.."\n") end