<commit_before>package indigo_test

import (
	"fmt"
	"math"
	"math/rand"
	"reflect"
	"sort"
	"sync"
	"testing"
	"time"

	"github.com/osamingo/base58"
	"github.com/osamingo/indigo"
)

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

	g := indigo.New(
		base58.MustNewEncoder(base58.StandardSource),
		indigo.StartTime(time.Unix(1257894000, 0)),
		indigo.MachineID(func() (uint16, error) { return math.MaxUint16, nil }),
		indigo.CheckMachineID(nil),
	)
	if g == nil {
		t.Error("should not be nil")
	}
}

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

	g := indigo.New(
		nil,
		indigo.StartTime(time.Unix(1257894000, 0)),
		indigo.MachineID(func() (uint16, error) { return math.MaxUint16, nil }),
		indigo.CheckMachineID(nil),
	)

	id1, err := g.NextID()
	if err != nil {
		t.Error("should be nil")
	}

	if id1 == "" {
		t.Error("should not be empty")
	}

	id2, err := g.NextID()
	if err != nil {
		t.Error("should be nil")
	}

	if id2 == "" {
		t.Error("should not be empty")
	}

	if id1 == id2 {
		t.Error("should not be equal")
	}
}

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

	g := indigo.New(
		nil,
		indigo.StartTime(time.Unix(1257894000, 0)),
		indigo.MachineID(func() (uint16, error) { return math.MaxUint16, nil }),<commit_msg>Add test case<commit_after>package indigo_test

import (
	"fmt"
	"math"
	"math/rand"
	"reflect"
	"sort"
	"sync"
	"testing"
	"time"

	"github.com/osamingo/base58"
	"github.com/osamingo/indigo"
)

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

	g := indigo.New(
		base58.MustNewEncoder(base58.StandardSource),
		indigo.StartTime(time.Unix(1257894000, 0)),
		indigo.MachineID(func() (uint16, error) { return math.MaxUint16, nil }),
		indigo.CheckMachineID(nil),
	)
	if g == nil {
		t.Error("should not be nil")
	}
}

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

	g := indigo.New(
		nil,
		indigo.StartTime(time.Unix(1257894000, 0)),
		indigo.MachineID(func() (uint16, error) { return math.MaxUint16, nil }),
		indigo.CheckMachineID(nil),
	)

	id1, err := g.NextID()
	if err != nil {
		t.Error("should be nil")
	}

	if id1 == "" {
		t.Error("should not be empty")
	}

	id2, err := g.NextID()
	if err != nil {
		t.Error("should be nil")
	}

	if id2 == "" {
		t.Error("should not be empty")
	}

	if id1 == id2 {
		t.Error("should not be equal")
	}

	g = indigo.New(
		nil,
		indigo.StartTime(time.Unix(math.MinInt64, math.MinInt64)),
		indigo.MachineID(func() (uint16, error) { return math.MaxUint16, nil }),
	)

	if _, err := g.NextID(); err == nil {
		t.Error("should not be nil")
	}
}

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

	g := indigo.New(
		nil,
		indigo.StartTime(time.Unix(1257894000, 0)),
		indigo.MachineID(func() (uint16, error) { return math.MaxUint16, nil }),
{'fraction_non_alphanumeric': 0.17561683599419448, 'fraction_numerical': 0.04426705370101597, 'mean_word_length': 3.761658031088083, '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': '4175369', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1161, 'n_words': 230}