<commit_before>package store

import (
	"testing"
	"testing/quick"
)

func TestRoundTripString(t *testing.T) {
	t.Parallel()

	f := func(value string) bool {
		marshalled := marshal(value)
		unmarshalled, err := unmarshal(marshalled, "string")
		newValue, ok := unmarshalled.(string)

		return err == nil && ok && newValue == value
	}

	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}

func TestRoundtripInteger(t *testing.T) {
	t.Parallel()

	f := func(value int) bool {
		marshalled := marshal(value)
		unmarshalled, err := unmarshal(marshalled, "integer")
		newValue, ok := unmarshalled.(int)

		return err == nil && ok && newValue == value
	}

	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}

func TestRoundtripFloat(t *testing.T) {
	t.Parallel()

	f := func(value float64) bool {
		marshalled := marshal(value)
		unmarshalled, err := unmarshal(marshalled, "float")
		newValue, ok := unmarshalled.(float64)

		return err == nil && ok && newValue == value
	}

	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}

func TestRoundtripBool(t *testing.T) {
	t.Parallel()

	f := func(value bool) bool {
		marshalled := marshal(value)<commit_msg>store(marshal_test): skip long tests in short mode<commit_after>package store

import (
	"testing"
	"testing/quick"
)

func TestRoundTripString(t *testing.T) {
	t.Parallel()
	if testing.Short() {
		t.Skip("skipping round trip tests in short mode")
	}

	f := func(value string) bool {
		marshalled := marshal(value)
		unmarshalled, err := unmarshal(marshalled, "string")
		newValue, ok := unmarshalled.(string)

		return err == nil && ok && newValue == value
	}

	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}

func TestRoundtripInteger(t *testing.T) {
	t.Parallel()
	if testing.Short() {
		t.Skip("skipping round trip tests in short mode")
	}

	f := func(value int) bool {
		marshalled := marshal(value)
		unmarshalled, err := unmarshal(marshalled, "integer")
		newValue, ok := unmarshalled.(int)

		return err == nil && ok && newValue == value
	}

	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}

func TestRoundtripFloat(t *testing.T) {
	t.Parallel()
	if testing.Short() {
		t.Skip("skipping round trip tests in short mode")
	}

	f := func(value float64) bool {
		marshalled := marshal(value)
		unmarshalled, err := unmarshal(marshalled, "float")
		newValue, ok := unmarshalled.(float64)

		return err == nil && ok && newValue == value
	}

	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}

func TestRoundtripBool(t *testing.T) {
	t.Parallel()
	if testing.Short() {
		t.Skip("skipping round trip tests in short mode")
	}

	f := func(value bool) bool {
		marshalled := marshal(value)
{'fraction_non_alphanumeric': 0.15692760014700477, 'fraction_numerical': 0.002940095553105476, 'mean_word_length': 3.8694096601073347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7111450', 'n_tokens_mistral': 1069, 'n_tokens_neox': 996, 'n_words': 251}