<commit_before>package main

import (
	"fmt"
	"time"

	"github.com/fabiofalci/sconsify/sconsify"
	"github.com/fabiofalci/sconsify/infrastructure"
	"github.com/fabiofalci/sconsify/ui"
	"github.com/fabiofalci/sconsify/spotify/mock"
	"os/exec"
	"bytes"
)

func main() {
	infrastructure.ProcessSconsifyrc()

	fmt.Println("Sconsify - your awesome Spotify music service in a text-mode interface.")
	events := sconsify.InitialiseEvents()

	go mock.Initialise(events)

	var output bytes.Buffer
	go generateKeys(&output)
	ui := ui.InitialiseConsoleUserInterface(events)
	sconsify.StartMainLoop(events, ui, false)
	println(output.String())
}

func generateKeys(output *bytes.Buffer) {
	time.Sleep(2 * time.Second)

	cmd("h")
	cmd("h")
	cmd("g")
	cmd("g")
	if !ui.CuiAssertSelectedPlaylist("<NAME>") {
		output.WriteString("Playlist <NAME> not found on position 1")
		cmd("q")
	}
	time.Sleep(2 * time.Second)

	cmd("j")
	if !ui.CuiAssertSelectedPlaylist("My folder") {
		output.WriteString("Playlist My folder not found on position 2")
		cmd("q")
	}
	time.Sleep(2 * time.Second)

	cmd("space")
	if !ui.CuiAssertSelectedPlaylist("[My folder]") {
		output.WriteString("Playlist [My folder] not found on position 2")
		cmd("q")
	}
	time.Sleep(2 * time.Second)

	cmd("space")
	if !ui.CuiAssertSelectedPlaylist("My folder") {
		output.WriteString("Playlist My folder not found on position 2")
		cmd("q")
	}
	time.Sleep(2 * time.Second)

	cmd("q")
}

func cmd(key string) {
	exec.Command("xdotool", "key", key).Run()
}<commit_msg>Make test sleep a function<commit_after>package main

import (
	"fmt"
	"time"

	"github.com/fabiofalci/sconsify/sconsify"
	"github.com/fabiofalci/sconsify/infrastructure"
	"github.com/fabiofalci/sconsify/ui"
	"github.com/fabiofalci/sconsify/spotify/mock"
	"os/exec"
	"bytes"
)

func main() {
	infrastructure.ProcessSconsifyrc()

	fmt.Println("Sconsify - your awesome Spotify music service in a text-mode interface.")
	events := sconsify.InitialiseEvents()

	go mock.Initialise(events)

	var output bytes.Buffer
	go generateKeys(&output)
	ui := ui.InitialiseConsoleUserInterface(events)
	sconsify.StartMainLoop(events, ui, false)
	println(output.String())
}

func generateKeys(output *bytes.Buffer) {
	sleep()

	cmd("h")
	cmd("h")
	cmd("g")
	cmd("g")
	if !ui.CuiAssertSelectedPlaylist("<NAME>") {
		output.WriteString("Playlist <NAME> not found on position 1")
		cmd("q")
	}
	sleep()

	cmd("j")
	if !ui.CuiAssertSelectedPlaylist("My folder") {
		output.WriteString("Playlist My folder not found on position 2")
		cmd("q")
	}
	sleep()

	cmd("space")
	if !ui.CuiAssertSelectedPlaylist("[My folder]") {
		output.WriteString("Playlist [My folder] not found on position 2")
		cmd("q")
	}
	sleep()

	cmd("space")
	if !ui.CuiAssertSelectedPlaylist("My folder") {
		output.WriteString("Playlist My folder not found on position 2")
		cmd("q")
	}
	sleep()



	cmd("q")
}


func sleep() {
	time.Sleep(1 * time.Second)
}

func cmd(key string) {
	exec.Command("xdotool", "key", key).Run()
}
{'fraction_non_alphanumeric': 0.1559049849447976, 'fraction_numerical': 0.00468384074941452, 'mean_word_length': 4.920792079207921, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1267886', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1107, 'n_words': 227}