<commit_before>package client

import (
	"reflect"
	"testing"
)

func TestCutNewLines(t *testing.T) {
	tests := []struct{ in, out string }{
		{"", ""},
		{"foo bar", "foo bar"},
		{"foo bar\rbaz", "foo bar"},
		{"foo bar\nbaz", "foo bar"},
		{"blorp\r\n\r\nbloop", "blorp"},
		{"\n\rblaap", ""},
		{"\r\n", ""},
		{"boo\\r\\n\\n\r", "boo\\r\\n\\n"},
	}
	for i, test := range tests {
		out := cutNewLines(test.in)
		if test.out != out {
			t.Errorf("test %d: expected %q, got %q", i, test.out, out)
		}
	}
}

func TestIndexFragment(t *testing.T) {
	tests := []struct {
		in  string
		out int
	}{
		{"", -1},
		{"foobarbaz", -1},
		{"foo bar baz", 8},
		{"foo. bar baz", 5},
		{"foo: bar baz", 5},
		{"foo; bar baz", 5},
		{"foo, bar baz", 5},
		{"foo! bar baz", 5},
		{"foo? bar baz", 5},
		{"foo\" bar baz", 5},
		{"foo' bar baz", 5},
		{"foo. bar. baz beep", 10},
		{"foo. bar, baz beep", 10},
	}
	for i, test := range tests {
		out := indexFragment(test.in)
		if test.out != out {
			t.Errorf("test %d: expected %d, got %d", i, test.out, out)
		}
	}
}

func TestSplitMessage(t *testing.T) {
	tests := []struct {
		in  string
		sp  int
		out []string
	}{
		{"", 0, []string{""}},
		{"foo", 0, []string{"foo"}},
		{"foo bar baz beep", 0, []string{"foo bar ...", "baz beep"}},
		{"foo bar baz beep", 15, []string{"foo bar baz ...", "beep"}},
		{"foo. bar baz, beep.", 0, []string{"foo. ...", "bar baz, ...", "beep."}},
		{"foo bar, baz beep", 15, []string{"foo bar, ...", "baz beep"}},
		{"0123456789012345", 0, []string{"0123456789...", "012345"}},
		{"0123456789012345", 15, []string{"012345678901...", "2345"}},
		{"0123456789012345", 16, []string{"0123456789012345"}},
	}<commit_msg>Bad fluffle not running tests after changes.<commit_after>package client

import (
	"reflect"
	"testing"
)

func TestCutNewLines(t *testing.T) {
	tests := []struct{ in, out string }{
		{"", ""},
		{"foo bar", "foo bar"},
		{"foo bar\rbaz", "foo bar"},
		{"foo bar\nbaz", "foo bar"},
		{"blorp\r\n\r\nbloop", "blorp"},
		{"\n\rblaap", ""},
		{"\r\n", ""},
		{"boo\\r\\n\\n\r", "boo\\r\\n\\n"},
	}
	for i, test := range tests {
		out := cutNewLines(test.in)
		if test.out != out {
			t.Errorf("test %d: expected %q, got %q", i, test.out, out)
		}
	}
}

func TestIndexFragment(t *testing.T) {
	tests := []struct {
		in  string
		out int
	}{
		{"", -1},
		{"foobarbaz", -1},
		{"foo bar baz", 8},
		{"foo. bar baz", 5},
		{"foo: bar baz", 5},
		{"foo; bar baz", 5},
		{"foo, bar baz", 5},
		{"foo! bar baz", 5},
		{"foo? bar baz", 5},
		{"foo\" bar baz", 5},
		{"foo' bar baz", 5},
		{"foo. bar. baz beep", 10},
		{"foo. bar, baz beep", 10},
	}
	for i, test := range tests {
		out := indexFragment(test.in)
		if test.out != out {
			t.Errorf("test %d: expected %d, got %d", i, test.out, out)
		}
	}
}

func TestSplitMessage(t *testing.T) {
	tests := []struct {
		in  string
		sp  int
		out []string
	}{
		{"", 0, []string{""}},
		{"foo", 0, []string{"foo"}},
		{"foo bar baz beep", 0, []string{"foo bar baz beep"}},
		{"foo bar baz beep", 15, []string{"foo bar baz ...", "beep"}},
		{"foo bar, baz beep", 15, []string{"foo bar, ...", "baz beep"}},
		{"0123456789012345", 0, []string{"0123456789012345"}},
		{"0123456789012345", 15, []string{"012345678901...", "2345"}},
		{"0123456789012345", 16, []string{"0123456789012345"}},
	}
{'fraction_non_alphanumeric': 0.2638888888888889, 'fraction_numerical': 0.07457729468599034, 'mean_word_length': 3.188369152970923, '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': '4084476', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1406, 'n_words': 376}