File: decoder_small_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 (29 lines) | stat: -rw-r--r-- 994 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
24
25
26
27
28
29
package benchmarks

import (
	"testing"

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

func TestGoJayDecodeObjSmall(t *testing.T) {
	result := benchmarks.SmallPayload{}
	err := gojay.Unmarshal(benchmarks.SmallFixture, &result)
	assert.Nil(t, err, "err should be nil")
	assert.Equal(t, result.St, 1, "result.St should be 1")
	assert.Equal(t, result.Sid, 486, "result.Sid should be 486")
	assert.Equal(t, result.Tt, "active", "result.Sid should be 'active'")
	assert.Equal(t, result.Gr, 0, "result.Gr should be 0")
	assert.Equal(
		t,
		result.Uuid,
		"de305d54-75b4-431b-adb2-eb6b9e546014",
		"result.Gr should be 'de305d54-75b4-431b-adb2-eb6b9e546014'",
	)
	assert.Equal(t, result.Ip, "127.0.0.1", "result.Ip should be '127.0.0.1'")
	assert.Equal(t, result.Ua, "user_agent", "result.Ua should be 'user_agent'")
	assert.Equal(t, result.Tz, -6, "result.Tz should be 6")
	assert.Equal(t, result.V, 1, "result.V should be 1")
}