<commit_before>package tap

import "fmt"
import "testing/quick"

type T struct {
	nextTestNumber int
}

// New creates a new Tap value
func New() *T {
	return &T{
		nextTestNumber: 1,
	}
}

// Header displays a TAP header including version number and expected
// number of tests to run.
func (t *T) Header(testCount int) {
	fmt.Printf("TAP version 13\n")
	fmt.Printf("1..%d\n", testCount)
}

// Ok generates TAP output indicating whether a test passed or failed.
func (t *T) Ok(test bool, description string) {
	// did the test pass or not?
	ok := "ok"
	if !test {
		ok = "not ok"
	}

	fmt.Printf("%s %d - %s\n", ok, t.nextTestNumber, description)
	t.nextTestNumber++
}

// Check runs randomized tests against a function just as "testing/quick.Check"
// does.  Success or failure generate appropriate TAP output.
func (t *T) Check(function interface {}, description string) {
    err := quick.Check(function, nil)
    if err == nil {
        t.Ok(true, description)
        return
    }

    fmt.Printf("# %s\n", err)
    t.Ok(false, description)
}
<commit_msg>go fmt<commit_after>package tap

import "fmt"
import "testing/quick"

type T struct {
	nextTestNumber int
}

// New creates a new Tap value
func New() *T {
	return &T{
		nextTestNumber: 1,
	}
}

// Header displays a TAP header including version number and expected
// number of tests to run.
func (t *T) Header(testCount int) {
	fmt.Printf("TAP version 13\n")
	fmt.Printf("1..%d\n", testCount)
}

// Ok generates TAP output indicating whether a test passed or failed.
func (t *T) Ok(test bool, description string) {
	// did the test pass or not?
	ok := "ok"
	if !test {
		ok = "not ok"
	}

	fmt.Printf("%s %d - %s\n", ok, t.nextTestNumber, description)
	t.nextTestNumber++
}

// Check runs randomized tests against a function just as "testing/quick.Check"
// does.  Success or failure generate appropriate TAP output.
func (t *T) Check(function interface{}, description string) {
	err := quick.Check(function, nil)
	if err == nil {
		t.Ok(true, description)
		return
	}

	fmt.Printf("# %s\n", err)
	t.Ok(false, description)
}

{'fraction_non_alphanumeric': 0.13224724484906564, 'fraction_numerical': 0.003833253473885961, 'mean_word_length': 3.3865546218487395, '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': '1800661', 'n_tokens_mistral': 722, 'n_tokens_neox': 709, 'n_words': 253}