<commit_before>package ed2k

import (
	"bytes"
	"testing"
)

func TestSmallFile(t *testing.T) {
	test := bytes.NewReader(make([]byte, 600))
	validHash := "a5b489c18c5bdc1f711a8edff22c13ff"
	testHash, _ := Hash(test, false)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}

func TestSmallFileOld(t *testing.T) {
	test := bytes.NewReader(make([]byte, 600))
	validHash := "a5b489c18c5bdc1f711a8edff22c13ff"
	testHash, _ := Hash(test, true)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}

func TestEqualFile(t *testing.T) {
	test := bytes.NewReader(make([]byte, 9728000))
	validHash := "d7def262a127cd79096a108e7a9fc138"
	testHash, _ := Hash(test, false)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}

func TestEqualFileOld(t *testing.T) {
	test := bytes.NewReader(make([]byte, 9728000))
	validHash := "fc21d9af828f92a8df64beac3357425d"
	testHash, _ := Hash(test, true)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}

func TestMultipleFile(t *testing.T) {
	test := bytes.NewReader(make([]byte, 19456000))
	validHash := "194ee9e4fa79b2ee9f8829284c466051"
	testHash, _ := Hash(test, false)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}

func TestMultipleFileOld(t *testing.T) {
	test := bytes.NewReader(make([]byte, 19456000))
	validHash := "114b21c63a74b6ca922291a11177dd5c"
	testHash, _ := Hash(test, true)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}

func TestLargeFile(t *testing.T) {
	test := bytes.NewReader(make([]byte, 19457000))
	validHash := "345da2ffa0f63eae5638b908f187bfb1"
	testHash, _ := Hash(test, false)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}

func TestLargeFileOld(t *testing.T) {
	test := bytes.NewReader(make([]byte, 19457000))
	validHash := "345da2ffa0f63eae5638b908f187bfb1"
	testHash, _ := Hash(test, true)
	if testHash != validHash {
		t.Error("Expected ", validHash, " got ", testHash)
	}
}<commit_msg>Wrap repeated code in a function<commit_after>package ed2k

import (
	"bytes"
	"testing"
)

func HashWrapper(t *testing.T, size int, hash string, old bool) {
	test := bytes.NewReader(make([]byte, size))
	testHash, err := Hash(test, old)
	
	if err != nil {
		t.Error("Got error ", err)
	}
	
	if testHash != hash {
		t.Error("Expected ", hash, " got ", testHash)
	}
}

func TestSmallFile(t *testing.T) {
	HashWrapper(t, 600, "a5b489c18c5bdc1f711a8edff22c13ff", false)
}

func TestSmallFileOld(t *testing.T) {
	HashWrapper(t, 600, "a5b489c18c5bdc1f711a8edff22c13ff", true)
}

func TestEqualFile(t *testing.T) {
	HashWrapper(t, 9728000, "d7def262a127cd79096a108e7a9fc138", false)
}

func TestEqualFileOld(t *testing.T) {
	HashWrapper(t, 9728000, "fc21d9af828f92a8df64beac3357425d", true)
}

func TestMultipleFile(t *testing.T) {
	HashWrapper(t, 19456000, "194ee9e4fa79b2ee9f8829284c466051", false)
}

func TestMultipleFileOld(t *testing.T) {
	HashWrapper(t, 19456000, "114b21c63a74b6ca922291a11177dd5c", true)
}

func TestLargeFile(t *testing.T) {
	HashWrapper(t, 19457000, "345da2ffa0f63eae5638b908f187bfb1", false)
}

func TestLargeFileOld(t *testing.T) {
	HashWrapper(t, 19457000, "345da2ffa0f63eae5638b908f187bfb1", true)
}
{'fraction_non_alphanumeric': 0.14753605769230768, 'fraction_numerical': 0.1219951923076923, 'mean_word_length': 5.527450980392157, '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': '4465744', 'n_tokens_mistral': 1613, 'n_tokens_neox': 1368, 'n_words': 244}