package bulk

import "testing"

func TestShardUsesCountAndBytes(t *testing.T) {
	items := []int64{6, 6, 1, 20}
	shards, err := Shard(items, Limits{MaxItems: 2, MaxBytes: 10}, func(value int64) int64 { return value })
	if err != nil {
		t.Fatal(err)
	}
	if len(shards) != 3 || len(shards[0]) != 1 || len(shards[1]) != 2 || len(shards[2]) != 1 {
		t.Fatalf("shards = %#v", shards)
	}
}
