<commit_before>package server

import (
	"../hashtree"
	"../network"
	"fmt"
	"net"
	"testing"
)

func TestServerDataProvider(t *testing.T) {

	set1 := Setting{network.ServerHello{}, ".testServer1", "simple", 30001, "127.0.0.1"}
	set2 := Setting{network.ServerHello{}, ".testServer1", "simple", 30002, "127.0.0.1"}
	s1 := NewServer(set1)
	s2 := NewServer(set2)

	block := hashtree.Bytes(hashtree.FILE_BLOCK_SIZE)

	fileSizes := []hashtree.Bytes{0, 1, block - 1, block, block + 1, block * 2, block * 3, block * 4, block * 5}

	conn := s2.conn
	toAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%v:%v", set1.IP, set1.Port))
	if err != nil {
		panic(err)
	}

	for _, size := range fileSizes {
		id := s1.ImportFromReader(&testFile{length: size})

		p := &network.Packet{}

		p.FillHashRequest(id, 0, 0, hashtree.FileNodesDefault(size))

		conn.Send(p, toAddr)

		//todo, check returned

	}

}
<commit_msg>changed test port, it was in use<commit_after>package server

import (
	"../hashtree"
	"../network"
	"fmt"
	"net"
	"testing"
)

func TestServerDataProvider(t *testing.T) {

	set1 := Setting{network.ServerHello{}, ".testServer1", "simple", 30011, "127.0.0.1"}
	set2 := Setting{network.ServerHello{}, ".testServer1", "simple", 30012, "127.0.0.1"}
	s1 := NewServer(set1)
	s2 := NewServer(set2)

	block := hashtree.Bytes(hashtree.FILE_BLOCK_SIZE)

	fileSizes := []hashtree.Bytes{0, 1, block - 1, block, block + 1, block * 2, block * 3, block * 4, block * 5}

	conn := s2.conn
	toAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%v:%v", set1.IP, set1.Port))
	if err != nil {
		panic(err)
	}

	for _, size := range fileSizes {
		id := s1.ImportFromReader(&testFile{length: size})

		p := &network.Packet{}

		p.FillHashRequest(id, 0, 0, hashtree.FileNodesDefault(size))

		conn.Send(p, toAddr)

		//todo, check returned

	}

}

{'fraction_non_alphanumeric': 0.1864406779661017, 'fraction_numerical': 0.04811372334609076, 'mean_word_length': 4.069252077562327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '2941960', 'n_tokens_mistral': 790, 'n_tokens_neox': 717, 'n_words': 156}