<commit_before>package metainfo

import (
	"encoding/hex"
	"os"
	"testing"
)

func TestTorrent(t *testing.T) {
	f, err := os.Open("testdata/ubuntu-14.04.1-server-amd64.iso.torrent")
	if err != nil {
		t.Fatal(err)
	}

	tor, err := New(f)
	if err != nil {
		t.Fatal(err)
	}

	if tor.Info.Name != "ubuntu-14.04.1-server-amd64.iso" {
		t.Errorf("invalid name: %q", tor.Info.Name)
	}

	if tor.Info.Length != 599785472 {
		t.Errorf("invalid length: %d", tor.Info.Length)
	}

	if hex.EncodeToString(tor.Info.Hash[:]) != "2d066c94480adcf52bfd1185a75eb4ddc1777673" {
		t.Errorf("invalid info hash: %q must be '2d066c94480adcf52bfd1185a75eb4ddc1777673'", tor.Info.Hash)
	}
}<commit_msg>add tracker test to metainfo<commit_after>package metainfo

import (
	"encoding/hex"
	"os"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestTorrent(t *testing.T) {
	f, err := os.Open("testdata/ubuntu-14.04.1-server-amd64.iso.torrent")
	if err != nil {
		t.Fatal(err)
	}

	tor, err := New(f)
	if err != nil {
		t.Fatal(err)
	}

	assert.Equal(t, "ubuntu-14.04.1-server-amd64.iso", tor.Info.Name)
	assert.Equal(t, int64(599785472), tor.Info.Length)
	assert.Equal(t, "2d066c94480adcf52bfd1185a75eb4ddc1777673", hex.EncodeToString(tor.Info.Hash[:]))
	assert.Equal(t, []string{"http://torrent.ubuntu.com:6969/announce", "http://ipv6.torrent.ubuntu.com:6969/announce"}, tor.AnnounceList)
}
{'fraction_non_alphanumeric': 0.18002915451895043, 'fraction_numerical': 0.09620991253644315, 'mean_word_length': 4.36328125, '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': '5696498', 'n_tokens_mistral': 693, 'n_tokens_neox': 599, 'n_words': 89}