<commit_before>package url

import (
	"testing"
)

func TestAccessorsNil(t *testing.T) {
	var url *URL
	if url.GetProtocol() != Protocol_Local {
		t.Error("protocol accessor value mismatch for nil message")
	}
	if url.GetUsername() != "" {
		t.Error("username accessor value mismatch for nil message")
	}
	if url.GetHostname() != "" {
		t.Error("hostname accessor value mismatch for nil message")
	}
	if url.GetPort() != 0 {
		t.Error("port accessor value mismatch for nil message")
	}
	if url.GetPath() != "" {
		t.Error("path accessor value mismatch for nil message")
	}
}

func TestAccessors(t *testing.T) {
	url := &URL{
		Protocol: Protocol_SSH,
		Username: "user",
		Hostname: "host",
		Port:     23,
		Path:     "/test/path",
	}
	if url.GetProtocol() != url.Protocol {
		t.Error("protocol accessor value mismatch")
	}
	if url.GetUsername() != url.Username {
		t.Error("username accessor value mismatch")
	}
	if url.GetHostname() != url.Hostname {
		t.Error("hostname accessor value mismatch")
	}
	if url.GetPort() != url.Port {
		t.Error("port accessor value mismatch")
	}
	if url.GetPath() != url.Path {
		t.Error("path accessor value mismatch")
	}
}

func TestReset(t *testing.T) {
	url := &URL{
		Protocol: Protocol_SSH,
		Username: "user",
		Hostname: "host",
		Port:     23,
		Path:     "/test/path",
	}
	url.Reset()
	if url.Protocol != Protocol_Local {
		t.Error("reset did not reset protocol")
	}
	if url.Username != "" {
		t.Error("reset did not reset username")
	}
	if url.Hostname != "" {
		t.Error("reset did not reset hostname")
	}
	if url.Port != 0 {
		t.Error("reset did not reset port")
	}
	if url.Path != "" {
		t.Error("reset did not reset path")
	}
}

// TestProtocolBuffersMethods tests miscellaneous generated methods that we
// don't actually invoke to (a) make sure they don't panic and (b) stop their
// existence from deflating test coverage.
func TestProtocolBuffersMethods(t *testing.T) {
	// Test Protocol methods.
	protocol := Protocol_Local
	_ = protocol.String()
	_, _ = protocol.EnumDescriptor()

	// Test URL methods.
	url := &URL{
		Protocol: Protocol_SSH,
		Username: "user",
		Hostname: "host",
		Port: 12345,
		Path: "/some/path",
	}
	_ = url.String()
	url.ProtoMessage()
	_, _ = url.Descriptor()
	encoded, err := url.Marshal()
	if err != nil {
		t.Error("unable to marshal URL:", err)
	}
	err = url.Unmarshal(encoded)
	if err != nil {
		t.Error("unable to unmarshal URL:", err)
	}


}
<commit_msg>Cleaned up code in URL tests.<commit_after>package url

import (
	"testing"
)

func TestAccessorsNil(t *testing.T) {
	var url *URL
	if url.GetProtocol() != Protocol_Local {
		t.Error("protocol accessor value mismatch for nil message")
	}
	if url.GetUsername() != "" {
		t.Error("username accessor value mismatch for nil message")
	}
	if url.GetHostname() != "" {
		t.Error("hostname accessor value mismatch for nil message")
	}
	if url.GetPort() != 0 {
		t.Error("port accessor value mismatch for nil message")
	}
	if url.GetPath() != "" {
		t.Error("path accessor value mismatch for nil message")
	}
}

func TestAccessors(t *testing.T) {
	url := &URL{
		Protocol: Protocol_SSH,
		Username: "user",
		Hostname: "host",
		Port:     23,
		Path:     "/test/path",
	}
	if url.GetProtocol() != url.Protocol {
		t.Error("protocol accessor value mismatch")
	}
	if url.GetUsername() != url.Username {
		t.Error("username accessor value mismatch")
	}
	if url.GetHostname() != url.Hostname {
		t.Error("hostname accessor value mismatch")
	}
	if url.GetPort() != url.Port {
		t.Error("port accessor value mismatch")
	}
	if url.GetPath() != url.Path {
		t.Error("path accessor value mismatch")
	}
}

func TestReset(t *testing.T) {
	url := &URL{
		Protocol: Protocol_SSH,
		Username: "user",
		Hostname: "host",
		Port:     23,
		Path:     "/test/path",
	}
	url.Reset()
	if url.Protocol != Protocol_Local {
		t.Error("reset did not reset protocol")
	}
	if url.Username != "" {
		t.Error("reset did not reset username")
	}
	if url.Hostname != "" {
		t.Error("reset did not reset hostname")
	}
	if url.Port != 0 {
		t.Error("reset did not reset port")
	}
	if url.Path != "" {
		t.Error("reset did not reset path")
	}
}

// TestProtocolBuffersMethods tests miscellaneous generated methods that we
// don't actually invoke to (a) make sure they don't panic and (b) stop their
// existence from deflating test coverage.
func TestProtocolBuffersMethods(t *testing.T) {
	// Test Protocol methods.
	protocol := Protocol_Local
	_ = protocol.String()
	_, _ = protocol.EnumDescriptor()

	// Test URL methods.
	url := &URL{
		Protocol: Protocol_SSH,
		Username: "user",
		Hostname: "host",
		Port: 12345,
		Path: "/some/path",
	}
	_ = url.String()
	url.ProtoMessage()
	_, _ = url.Descriptor()
	encoded, err := url.Marshal()
	if err != nil {
		t.Error("unable to marshal URL:", err)
	}
	if err = url.Unmarshal(encoded); err != nil {
		t.Error("unable to unmarshal URL:", err)
	}
}

{'fraction_non_alphanumeric': 0.14950980392156862, 'fraction_numerical': 0.004493464052287581, 'mean_word_length': 3.5595903165735567, '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': '1252554', 'n_tokens_mistral': 1809, 'n_tokens_neox': 1699, 'n_words': 475}