<commit_before>package via

import (
	"github.com/mrosset/util/file"
	"os"
	"testing"
)

func TestBatchAdd(t *testing.T) {
	var (
		d      = NewBatch(testConfig)
		expect = "hello-2.9"
	)
	d.Add(testPlan)
	if len(d.Plans()) != 1 {
		t.Errorf("expected 'one' plan got '%d'", len(d.Plans()))
	}
	got := d.Plans()[0].NameVersion()
	if expect != got {
		t.Errorf("expect '%s' got '%s'", expect, got)
	}
}

func TestBatchWalk(t *testing.T) {
	var (
		p, _   = NewPlan(config, "ccache")
		got    = NewBatch(testConfig)
		expect = 1
	)
	got.Walk(p)
	if len(got.Plans()) != expect {
		t.Errorf("expect %d depends got %d", expect, len(got.Plans()))
	}
}

func testBatchInstall(t *testing.T) {
	var (
		p, _   = NewPlan(config, "ccache")
		got    = NewBatch(testConfig)
		expect = join(testConfig.Repo, "repo", p.PackageFile())
	)
	defer os.RemoveAll(testConfig.Repo)
	defer os.RemoveAll(testConfig.Root)
	defer os.RemoveAll(testConfig.DB.Installed(testConfig))
	got.Walk(p)
	errors := got.Install()
	if len(errors) != 0 {
		t.Error(errors)
	}
	if !file.Exists(expect) {
		t.Errorf("expect: %s got: %v", expect, false)
	}
}<commit_msg>tests: batch tests use got/expect format<commit_after>package via

import (
	"github.com/mrosset/util/file"
	"os"
	"testing"
)

func TestBatchAdd(t *testing.T) {
	var (
		d      = NewBatch(testConfig)
		expect = "hello-2.9"
	)
	d.Add(testPlan)
	if len(d.Plans()) != 1 {
		t.Errorf("expected 'one' plan got '%d'", len(d.Plans()))
	}
	got := d.Plans()[0].NameVersion()
	if expect != got {
		t.Errorf("expect '%s' got '%s'", expect, got)
	}
}

func TestBatchWalk(t *testing.T) {
	var (
		p, _   = NewPlan(config, "ccache")
		batch  = NewBatch(testConfig)
		expect = 1
	)
	batch.Walk(p)
	got := len(batch.Plans())
	if got != expect {
		t.Errorf("expect %d depends got %d", expect, got)
	}
}

func fixmeTestBatchInstall(t *testing.T) {
	var (
		p, _   = NewPlan(config, "ccache")
		got    = NewBatch(testConfig)
		expect = join(testConfig.Repo, "repo", p.PackageFile())
	)
	defer os.RemoveAll(testConfig.Repo)
	defer os.RemoveAll(testConfig.Root)
	defer os.RemoveAll(testConfig.DB.Installed(testConfig))
	got.Walk(p)
	errors := got.Install()
	if len(errors) != 0 {
		t.Error(errors)
	}
	if !file.Exists(expect) {
		t.Errorf("expect: %s got: %v", expect, false)
	}
}
{'fraction_non_alphanumeric': 0.1824945295404814, 'fraction_numerical': 0.00525164113785558, 'mean_word_length': 3.7625, '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': '7345514', 'n_tokens_mistral': 965, 'n_tokens_neox': 939, 'n_words': 189}