<commit_before>// Copyright 2012 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package rssgo

import (
	"encoding/xml"
	"testing"
	"time"
)

func TestComposeRssDate(t *testing.T) {

	then := time.Date(1974, time.July, 23, 9, 10, 11, 12, time.UTC)
	expected := "23 Jul 1974 09:10 UTC"
	actual := ComposeRssDate(then)
	if expected != actual {
		t.Fatalf("ComposeRssDate returned incorrect date/time string expected: %v got: %v\n",
			expected, actual)
	}
}

func TestParseRssDate(t *testing.T) {

	testString := func(str string, expected time.Time) {
		actual, err := ParseRssDate(str)
		if err != nil {
			t.Fatalf("Unexpected error (%v) when parsing %v\n", err, str)
		}
		if actual != expected {
			t.Fatalf("Unexpected time.Time when parsing %v. Expected: %v got: %v\n",
				str, expected, actual)
		}
	}

	expected := time.Date(1974, time.July, 23, 9, 10, 0, 0, time.UTC)
	testString("23 Jul 74 09:10 UTC", expected)
	testString("23 Jul 1974 09:10 UTC", expected)
	testString("Wed, 23 Jul 74 09:10 UTC", expected)
	testString("Wed, 23 Jul 1974 09:10 UTC", expected)

	expected = time.Date(1974, time.July, 23, 9, 10, 30, 0, time.UTC)
	testString("Wed, 23 Jul 1974 09:10:30 UTC", expected)

	str := "Wed, 23 Jul 1974 09:10:30 +0700"
	actual, err := ParseRssDate(str)
	if err != nil {
		t.Fatalf("Unexpected error (%v) when parsing %v\n", err, str)
	}
	// For numeric location just copy it
	expected = time.Date(1974, time.July, 23, 9, 10, 30, 0, actual.Location())
	if actual != expected {
		t.Fatalf("Unexpected time.Time when parsing %v. Expected: %#v got: %#v\n",<commit_msg>Use Tuesday for date testing since Wed was unluckily invalid<commit_after>// Copyright 2012 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package rssgo

import (
	"encoding/xml"
	"testing"
	"time"
)

func TestComposeRssDate(t *testing.T) {

	then := time.Date(1974, time.July, 23, 9, 10, 11, 12, time.UTC)
	expected := "23 Jul 1974 09:10 UTC"
	actual := ComposeRssDate(then)
	if expected != actual {
		t.Fatalf("ComposeRssDate returned incorrect date/time string expected: %v got: %v\n",
			expected, actual)
	}
}

func TestParseRssDate(t *testing.T) {

	testString := func(str string, expected time.Time) {
		actual, err := ParseRssDate(str)
		if err != nil {
			t.Fatalf("Unexpected error (%v) when parsing %v\n", err, str)
		}
		if actual != expected {
			t.Fatalf("Unexpected time.Time when parsing %v. Expected: %v got: %v\n",
				str, expected, actual)
		}
	}

	expected := time.Date(1974, time.July, 23, 9, 10, 0, 0, time.UTC)
	testString("23 Jul 74 09:10 UTC", expected)
	testString("23 Jul 1974 09:10 UTC", expected)
	testString("Tue, 23 Jul 74 09:10 UTC", expected)
	testString("Tue, 23 Jul 1974 09:10 UTC", expected)

	expected = time.Date(1974, time.July, 23, 9, 10, 30, 0, time.UTC)
	testString("Tue, 23 Jul 1974 09:10:30 UTC", expected)

	str := "Tue, 23 Jul 1974 09:10:30 +0700"
	actual, err := ParseRssDate(str)
	if err != nil {
		t.Fatalf("Unexpected error (%v) when parsing %v\n", err, str)
	}
	// For numeric location just copy it
	expected = time.Date(1974, time.July, 23, 9, 10, 30, 0, actual.Location())
	if actual != expected {
		t.Fatalf("Unexpected time.Time when parsing %v. Expected: %#v got: %#v\n",
{'fraction_non_alphanumeric': 0.14720662134200413, 'fraction_numerical': 0.0744900975465563, 'mean_word_length': 3.9043478260869566, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '7078220', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1201, 'n_words': 412}