(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func TestEncodeMemory(t *testing.T) { |
| 27 | // if testing.Short() { |
| 28 | t.Skip("Skipping TestEncodeMemory") |
| 29 | // } |
| 30 | var wg sync.WaitGroup |
| 31 | |
| 32 | for range runtime.NumCPU() { |
| 33 | enc := newEncoder() |
| 34 | n := enc.newNode(0) |
| 35 | require.NotNil(t, n) |
| 36 | for i := range 15000 { |
| 37 | require.NoError(t, enc.AddValue(n, enc.idForAttr(fmt.Sprintf("very long attr name %06d", i)), |
| 38 | types.ValueForType(types.StringID))) |
| 39 | enc.AddListChild(n, |
| 40 | enc.newNode(enc.idForAttr(fmt.Sprintf("another long child %06d", i)))) |
| 41 | } |
| 42 | wg.Add(1) |
| 43 | go func() { |
| 44 | defer wg.Done() |
| 45 | for range 1000 { |
| 46 | enc.buf.Reset() |
| 47 | require.NoError(t, enc.encode(n)) |
| 48 | } |
| 49 | }() |
| 50 | } |
| 51 | |
| 52 | wg.Wait() |
| 53 | } |
| 54 | |
| 55 | func TestNormalizeJSONLimit(t *testing.T) { |
| 56 | // Set default normalize limit. |
nothing calls this directly
no test coverage detected