Mercurial > pub > dyncall > dyncall
comparison test/common/rand-sig.lua @ 626:667fe7b2be62
whitespace
author | Tassilo Philipp |
---|---|
date | Fri, 28 Oct 2022 14:03:33 +0200 |
parents | 3fc677ff16e5 |
children |
comparison
equal
deleted
inserted
replaced
625:3fc677ff16e5 | 626:667fe7b2be62 |
---|---|
121 local varargstart = (ellipsis and nargs > 0 and math.random(0,ellipsis) == 0) and math.random(0,nargs-1) or nargs -- generate vararg sigs? | 121 local varargstart = (ellipsis and nargs > 0 and math.random(0,ellipsis) == 0) and math.random(0,nargs-1) or nargs -- generate vararg sigs? |
122 local sig = { } | 122 local sig = { } |
123 for j = 1, nargs do | 123 for j = 1, nargs do |
124 id = math.random(#types) | 124 id = math.random(#types) |
125 sig[#sig+1] = mktype(types:sub(id,id), 0, math.random(maxaggrdepth), nil) -- random depth avoids excessive nesting | 125 sig[#sig+1] = mktype(types:sub(id,id), 0, math.random(maxaggrdepth), nil) -- random depth avoids excessive nesting |
126 -- start vararg part? | 126 -- start vararg part? |
127 if j > varargstart and #sig > 0 then | 127 if j > varargstart and #sig > 0 then |
128 sig[#sig+1] = "." | 128 sig[#sig+1] = "." |
129 varargstart = nargs | 129 varargstart = nargs |
130 end | 130 end |
131 end | 131 end |
132 repeat | 132 repeat |
133 id = math.random(#rtypes) | 133 id = math.random(#rtypes) |
134 r = mktype(rtypes:sub(id,id), 0, math.random(maxaggrdepth), nil) -- random depth avoids excessive nesting | 134 r = mktype(rtypes:sub(id,id), 0, math.random(maxaggrdepth), nil) -- random depth avoids excessive nesting |
135 until r | 135 until r |
136 sig[#sig+1] = ')'..r | 136 sig[#sig+1] = ')'..r |
137 l = table.concat(sig) | 137 l = table.concat(sig) |
138 -- reject dupes, sigs without any aggregate (as this is about aggrs after all), and empty ones (if not wanted) | 138 -- reject dupes, sigs without any aggregate (as this is about aggrs after all), and empty ones (if not wanted) |
139 until (reqaggrinsig ~= true or string.match(l, aggr_op_pattern) ~= nil) and uniq_sigs[l] == nil | 139 until (reqaggrinsig ~= true or string.match(l, aggr_op_pattern) ~= nil) and uniq_sigs[l] == nil |
140 uniq_sigs[l] = 1 | 140 uniq_sigs[l] = 1 |
141 | 141 |