diff 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
line wrap: on
line diff
--- a/test/suite_aggrs/rand-sig.lua	Wed Jan 26 18:41:31 2022 +0100
+++ b/test/suite_aggrs/rand-sig.lua	Wed Jan 26 23:04:07 2022 +0100
@@ -52,8 +52,8 @@
       sig[#sig+1] = mktype(types:sub(id,id), 0, math.random(maxaggrdepth)) -- random depth avoids excessive nesting
     end
     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
+    -- reject dupes, sigs without any aggregate (as this is about aggrs after all), and empty ones (if not wanted)
+  until string.match(l, '{') ~= nil and uniq_sigs[l] == nil and (emptyaggrs or string.match(l, '{}') == nil)
   uniq_sigs[l] = 1
   io.write(l.."\n")
 end