File: decoder_large_test.go

package info (click to toggle)
golang-github-francoispqt-gojay 1.2.13-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,456 kB
  • sloc: makefile: 86
file content (23 lines) | stat: -rw-r--r-- 687 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package benchmarks

import (
	"testing"

	"github.com/francoispqt/gojay"
	"github.com/francoispqt/gojay/benchmarks"
	"github.com/stretchr/testify/assert"
)

func TestGoJayDecodeObjLarge(t *testing.T) {
	result := benchmarks.LargePayload{}
	err := gojay.UnmarshalJSONObject(benchmarks.LargeFixture, &result)
	assert.Nil(t, err, "err should be nil")
	assert.Len(t, result.Users, 32, "Len of users should be 32")
	for _, u := range result.Users {
		assert.True(t, len(u.Username) > 0, "User should have username")
	}
	assert.Len(t, result.Topics.Topics, 30, "Len of topics should be 30")
	for _, top := range result.Topics.Topics {
		assert.True(t, top.Id > 0, "Topic should have Id")
	}
}