comparison test/suite_aggrs/rand-sig.lua @ 446:54c1dc2e6ea5

suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them)
author Tassilo Philipp
date Wed, 26 Jan 2022 23:04:07 +0100
parents b4ddad459690
children 236015fdf7a8
comparison
equal deleted inserted replaced
445:4bd3ed699de8 446:54c1dc2e6ea5
50 for j = 1, nargs do 50 for j = 1, nargs do
51 id = math.random(#types) 51 id = math.random(#types)
52 sig[#sig+1] = mktype(types:sub(id,id), 0, math.random(maxaggrdepth)) -- random depth avoids excessive nesting 52 sig[#sig+1] = mktype(types:sub(id,id), 0, math.random(maxaggrdepth)) -- random depth avoids excessive nesting
53 end 53 end
54 l = table.concat(sig) 54 l = table.concat(sig)
55 -- reject dupes and sigs without any aggregate, as this is about aggrs after all 55 -- reject dupes, sigs without any aggregate (as this is about aggrs after all), and empty ones (if not wanted)
56 until string.match(l, '{') ~= nil and uniq_sigs[l] == nil 56 until string.match(l, '{') ~= nil and uniq_sigs[l] == nil and (emptyaggrs or string.match(l, '{}') == nil)
57 uniq_sigs[l] = 1 57 uniq_sigs[l] = 1
58 io.write(l.."\n") 58 io.write(l.."\n")
59 end 59 end
60 60