<commit_before>package ntp

import (
	boshdir "bosh/settings/directories"
	fakefs "bosh/system/fakes"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestGetOffsetReturnsValidOffset(t *testing.T) {
	NTPData := `server 10.16.45.209, stratum 2, offset -0.081236, delay 0.04291
12 Oct 17:37:58 ntpdate[42757]: adjust time server 10.16.45.209 offset -0.081236 sec
`
	service := buildService(NTPData)

	expectedNTPOffset := NTPInfo{
		Timestamp: "12 Oct 17:37:58",
		Offset:    "-0.081236",
	}
	assert.Equal(t, service.GetInfo(), expectedNTPOffset)
}

func TestGetOffsetReturnsBadFileMessageWhenFileIsBad(t *testing.T) {
	NTPData := "sdfhjsdfjghsdf\n" +
		"dsfjhsdfhjsdfhjg\n" +
		"dsjkfsdfkjhsdfhjk\n"
	service := buildService(NTPData)

	expectedNTPOffset := NTPInfo{
		Message: "bad file contents",
	}
	assert.Equal(t, service.GetInfo(), expectedNTPOffset)
}<commit_msg>moved platform/ntp tests into their own package<commit_after>package ntp_test

import (
	. "bosh/platform/ntp"
	boshdir "bosh/settings/directories"
	fakefs "bosh/system/fakes"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestGetOffsetReturnsValidOffset(t *testing.T) {
	NTPData := `server 10.16.45.209, stratum 2, offset -0.081236, delay 0.04291
12 Oct 17:37:58 ntpdate[42757]: adjust time server 10.16.45.209 offset -0.081236 sec
`
	service := buildService(NTPData)

	expectedNTPOffset := NTPInfo{
		Timestamp: "12 Oct 17:37:58",
		Offset:    "-0.081236",
	}
	assert.Equal(t, service.GetInfo(), expectedNTPOffset)
}

func TestGetOffsetReturnsBadFileMessageWhenFileIsBad(t *testing.T) {
	NTPData := "sdfhjsdfjghsdf\n" +
		"dsfjhsdfhjsdfhjg\n" +
		"dsjkfsdfkjhsdfhjk\n"
	service := buildService(NTPData)

	expectedNTPOffset := NTPInfo{
		Message: "bad file contents",
	}
	assert.Equal(t, service.GetInfo(), expectedNTPOffset)
}
{'fraction_non_alphanumeric': 0.13230429988974643, 'fraction_numerical': 0.07386990077177508, 'mean_word_length': 5.131756756756757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '4995904', 'n_tokens_mistral': 823, 'n_tokens_neox': 729, 'n_words': 133}