(b *testing.B)
| 520 | } |
| 521 | |
| 522 | func BenchmarkTypes(b *testing.B) { |
| 523 | var ( |
| 524 | // Build a approximate 1KB request |
| 525 | req = buildRequest(WriteQuery, []Query{ |
| 526 | buildQuery( |
| 527 | `INSERT INTO "t1" VALUES (?, ?, ?, ?)`, |
| 528 | rand.Int(), |
| 529 | randBytes(333), |
| 530 | randBytes(333), |
| 531 | randBytes(333), |
| 532 | ), |
| 533 | }) |
| 534 | // Build a approximate 1KB response with the previous request header |
| 535 | resp = buildResponse( |
| 536 | &req.Header, |
| 537 | []string{"k", "v1", "v2", "v3"}, |
| 538 | []string{"INT", "TEXT", "TEXT", "TEXT"}, |
| 539 | []ResponseRow{ |
| 540 | { |
| 541 | Values: []interface{}{ |
| 542 | rand.Int(), |
| 543 | randBytes(333), |
| 544 | randBytes(333), |
| 545 | randBytes(333), |
| 546 | }, |
| 547 | }, |
| 548 | }, |
| 549 | ) |
| 550 | ) |
| 551 | var subjects = [...]interface{}{req, resp} |
| 552 | for _, v := range subjects { |
| 553 | var name = reflect.ValueOf(v).Elem().Type().Name() |
| 554 | b.Run(fmt.Sprint(name, "Enc"), func(b *testing.B) { benchmarkEnc(b, v) }) |
| 555 | b.Run(fmt.Sprint(name, "Dec"), func(b *testing.B) { benchmarkDec(b, v) }) |
| 556 | if x, ok := v.(ver); ok { |
| 557 | b.Run(fmt.Sprint(name, "Verify"), func(b *testing.B) { benchmarkVerify(b, x) }) |
| 558 | } |
| 559 | if x, ok := v.(ser); ok { |
| 560 | b.Run(fmt.Sprint(name, "Sign"), func(b *testing.B) { benchmarkSign(b, x) }) |
| 561 | } |
| 562 | } |
| 563 | } |
nothing calls this directly
no test coverage detected