<commit_before>package test

import (
	"testing"

	"github.com/nbusy/devastator"
)

func TestClientDisconnect(t *testing.T) {
	s := getServer(t)
	c := getClientConnWithClientCert(t)
	closeClientConn(t, c)
	stopServer(t, s)
}

func TestClientClose(t *testing.T) {
	s := getServer(t)
	c := getClientConnWithClientCert(t)
	writeMsg(t, c, devastator.ReqMsg{ID: "123", Method: "close"})
	// t.Fatal("Client method.close request was not handled properly")
	closeClientConn(t, c)
	stopServer(t, s)
}

func TestSendClose(t *testing.T) {
	// t.Fatal("Server method.close request was not handled properly")
}

func TestServerDisconnect(t *testing.T) {
	// t.Fatal("Server disconnect was not handled gracefully")
}

func TestServerClose(t *testing.T) {
	s := getServer(t)
	c := getClientConnWithClientCert(t)
	if err := s.Stop(); err != nil {
		t.Fatal("Failed to stop the server:", err)
	}
	if err := c.Close(); err != nil {
		t.Fatal("Failed to close the client connection:", err)
	}
	wg.Wait()

	// test what happens when there are outstanding connections and/or requests that are being handled
	// destroying queues and other stuff during Close() might cause existing request handles to malfunction
}

func TestStop(t *testing.T) {
	// todo: this should be a listener/queue test if we don't use any goroutines in the Server struct methods
	// t.Fatal("Failed to stop the server: not all the goroutines were terminated properly")
	// t.Fatal("Failed to stop the server: server did not wait for ongoing read/write operations")
}

func TestConnTimeout(t *testing.T) {
	// t.Fatal("Send timout did not occur")
	// t.Fatal("Wait timeout did not occur")
	// t.Fatal("Read timeout did not occur")
}
<commit_msg>use aaa style<commit_after>package test

import (
	"testing"

	"github.com/nbusy/devastator"
)

func TestClientDisconnect(t *testing.T) {
	s := getServer(t)
	c := getClientConnWithClientCert(t)
	closeClientConn(t, c)
	stopServer(t, s)
}

func TestClientClose(t *testing.T) {
	s := getServer(t)
	c := getClientConnWithClientCert(t)

	writeMsg(t, c, devastator.ReqMsg{ID: "123", Method: "close"})
	// t.Fatal("Client method.close request was not handled properly")

	closeClientConn(t, c)
	stopServer(t, s)
}

func TestSendClose(t *testing.T) {
	// t.Fatal("Server method.close request was not handled properly")
}

func TestServerDisconnect(t *testing.T) {
	// t.Fatal("Server disconnect was not handled gracefully")
}

func TestServerClose(t *testing.T) {
	s := getServer(t)
	c := getClientConnWithClientCert(t)

	// test what happens when there are outstanding connections and/or requests that are being handled
	// destroying queues and other stuff during Close() might cause existing request handles to malfunction

	closeClientConn(t, c)
	stopServer(t, s)
}

func TestStop(t *testing.T) {
	// todo: this should be a listener/queue test if we don't use any goroutines in the Server struct methods
	// t.Fatal("Failed to stop the server: not all the goroutines were terminated properly")
	// t.Fatal("Failed to stop the server: server did not wait for ongoing read/write operations")
}

func TestConnTimeout(t *testing.T) {
	// t.Fatal("Send timout did not occur")
	// t.Fatal("Wait timeout did not occur")
	// t.Fatal("Read timeout did not occur")
}

{'fraction_non_alphanumeric': 0.12215384615384615, 'fraction_numerical': 0.0018461538461538461, 'mean_word_length': 4.418333333333333, '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': '3266304', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1049, 'n_words': 346}