MCPcopy Create free account
hub / github.com/brimdata/super / GenType

Function GenType

fuzz/fuzz.go:272–371  ·  view source on GitHub ↗
(b *bytes.Reader, context *super.Context, depth int)

Source from the content-addressed store, hash-verified

270}
271
272func GenType(b *bytes.Reader, context *super.Context, depth int) super.Type {
273 if depth < 0 || GenByte(b)%2 == 0 {
274 switch GenByte(b) % 19 {
275 case 0:
276 return super.TypeUint8
277 case 1:
278 return super.TypeUint16
279 case 2:
280 return super.TypeUint32
281 case 3:
282 return super.TypeUint64
283 case 4:
284 return super.TypeInt8
285 case 5:
286 return super.TypeInt16
287 case 6:
288 return super.TypeInt32
289 case 7:
290 return super.TypeInt64
291 case 8:
292 return super.TypeDuration
293 case 9:
294 return super.TypeTime
295 case 10:
296 return super.TypeFloat16
297 case 11:
298 return super.TypeFloat32
299 case 12:
300 return super.TypeBool
301 case 13:
302 return super.TypeBytes
303 case 14:
304 return super.TypeString
305 case 15:
306 return super.TypeIP
307 case 16:
308 return super.TypeNet
309 case 17:
310 return super.TypeType
311 case 18:
312 return super.TypeNull
313 default:
314 panic("Unreachable")
315 }
316 } else {
317 depth--
318 switch GenByte(b) % 5 {
319 case 0:
320 fieldTypes := GenTypes(b, context, depth)
321 fields := make([]super.Field, len(fieldTypes))
322 for i, fieldType := range fieldTypes {
323 fields[i] = super.Field{
324 Name: fmt.Sprintf("f%d", i),
325 Type: fieldType,
326 }
327 }
328 typ, err := context.LookupTypeRecord(fields)
329 if err != nil {

Callers 2

GenValueFunction · 0.85
GenTypesFunction · 0.85

Calls 7

GenByteFunction · 0.85
GenTypesFunction · 0.85
LookupTypeRecordMethod · 0.80
LookupTypeArrayMethod · 0.80
LookupTypeMapMethod · 0.80
LookupTypeSetMethod · 0.80
LookupTypeUnionMethod · 0.80

Tested by

no test coverage detected