<commit_before>package subchal

import (
    "testing"

    "time"
    "io/ioutil"
    "strings"
    "database/sql"
    _ "github.com/mattn/go-sqlite3"
)

func CountFileLines(path string) (int, error) {
    contentsBytes, err := ioutil.ReadFile(path)
    contents := string(contentsBytes)
    if err != nil {
        return 0, err
    }
    contents = strings.TrimRight(contents, "\n")
    return strings.Count(contents, "\n") + 1, nil
}

func confidentParseTime(timeStr string) time.Time {
    t, _ := ParseTime(timeStr)
    return t
}

func Test_TimeToTransfer(t *testing.T) {
    t.Parallel()
    SetTestLogger(t)

    db, err := sql.Open("sqlite3", "../test-data/subchal.sqlite")
    if err != nil {
        t.Log("Error opening SQLite database:", err)
        t.FailNow()
    }

    m, err := TimeToTransfer(db, "WFELL_S", "WFELL_S", "WOLF", confidentParseTime("09:40:00"))
    if err != nil {
        t.Log("Error calculating transfer time:", err)
        t.FailNow()
    }
    if m != 30 * 60 + 90 {
        t.Log("Got incorrect transfer time:", m)
        t.FailNow()
    }

    m, err = TimeToTransfer(db, "TWINS_N", "TWINS_E", "TROUT", confidentParseTime("15:12:00"))
    if err != nil {
        t.Log("Error calculating transfer time:", err)
        t.FailNow()
    }
    if m != 21 * 1800 + 90 {
        t.Log("Got incorrect transfer time:", m)
        t.FailNow()
    }
}

<commit_msg>Added another TimeToTransfer() test<commit_after>package subchal

import (
    "testing"

    "time"
    "io/ioutil"
    "strings"
    "database/sql"
    _ "github.com/mattn/go-sqlite3"
)

func CountFileLines(path string) (int, error) {
    contentsBytes, err := ioutil.ReadFile(path)
    contents := string(contentsBytes)
    if err != nil {
        return 0, err
    }
    contents = strings.TrimRight(contents, "\n")
    return strings.Count(contents, "\n") + 1, nil
}

func confidentParseTime(timeStr string) time.Time {
    t, _ := ParseTime(timeStr)
    return t
}

func Test_TimeToTransfer(t *testing.T) {
    t.Parallel()
    SetTestLogger(t)

    db, err := sql.Open("sqlite3", "../test-data/subchal.sqlite")
    if err != nil {
        t.Log("Error opening SQLite database:", err)
        t.FailNow()
    }

    // Test a normal transfer
    m, err := TimeToTransfer(db, "WFELL_S", "WFELL_S", "WOLF", confidentParseTime("09:40:00"))
    if err != nil {
        t.Log("Error calculating transfer time:", err)
        t.FailNow()
    }
    if m != 30 * 60 + 90 {
        t.Log("Got incorrect transfer time:", m)
        t.FailNow()
    }

    // Test a transfer that cycles through midnight
    m, err = TimeToTransfer(db, "TWINS_N", "TWINS_E", "TROUT", confidentParseTime("15:12:00"))
    if err != nil {
        t.Log("Error calculating transfer time:", err)
        t.FailNow()
    }
    if m != 21 * 1800 + 90 {
        t.Log("Got incorrect transfer time:", m)
        t.FailNow()
    }

    // Test a transfer that doesn't exist
    m, err = TimeToTransfer(db, "EYRIE_W", "DFORT_N", "WOLF", confidentParseTime("12:25:00"))
    if err == nil {
        t.Log("Didn't get an error from TimeToTransfer when we should've")
        t.FailNow()
    }

}


{'fraction_non_alphanumeric': 0.14973092750870529, 'fraction_numerical': 0.020892687559354226, 'mean_word_length': 2.5426008968609866, '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': '4070969', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1083, 'n_words': 266}