<commit_before>package gomon

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Util", func() {

	Describe("calculateStats", func() {
		var slice []float64

		Context("called with a slice of all zeros", func() {
			slice = []float64{0.0}
			It("should return the appropriate stats", func() {
				allZero, min, max, sum := calculateStats(slice)
				Expect(allZero).To(BeTrue())
				Expect(min).To(BeZero())
				Expect(max).To(BeZero())
				Expect(sum).To(BeZero())
			})
		})

		Context("with an empty slice", func() {
			It("should panic", func() {
				slice = []float64{}
				Expect(func() { calculateStats(slice) }).To(Panic())
			})
		})

	})

	Describe("deltaSinceLastCall", func() {
		var emitter func() float64
		emitter = Fib()

		Context("with a function that changes", func() {
			It("reflects the changes in successive calls", func() {
				delta := DeltaSinceLastCall(emitter)
				Expect(delta()).To(Equal(0.0))
				Expect(delta()).To(Equal(1.0))
				Expect(delta()).To(Equal(1.0))
				Expect(delta()).To(Equal(2.0))
			})
		})

		Context("with a function that does not change", func() {
			It("always shows zero delta", func() {
				delta := DeltaSinceLastCall(func() float64 { return 1.0 })
				Expect(delta()).To(Equal(0.0))
				Expect(delta()).To(Equal(0.0))
				Expect(delta()).To(Equal(0.0))
			})
		})

	})

})

// When called successively, returns the next term in the Fibonacci sequence.
func Fib() (generatorFunc func() float64) {
	a, b := 0.0, 1.0
	generatorFunc = func() float64 {
		a, b = b, a+b
		return a
	}
	return
}<commit_msg>test updates<commit_after>package gomon

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Util", func() {

	Describe("calculateStats", func() {
		var slice []float64

		Context("called with a slice of all zeros", func() {
			slice = []float64{0.0}
			It("should return the appropriate stats", func() {
				allZero, min, max, sum := calculateStats(slice)
				Expect(allZero).To(BeTrue())
				Expect(min).To(BeZero())
				Expect(max).To(BeZero())
				Expect(sum).To(BeZero())
			})
		})

		Context("with an empty slice", func() {
			It("should panic", func() {
				slice = []float64{}
				Expect(func() { calculateStats(slice) }).To(Panic())
			})
		})

	})

	Describe("deltaSinceLastCall", func() {
		var (
			emitter func() float64
			subject func() float64
		)

		Context("with a function that changes", func() {
			It("reflects the changes in successive calls", func() {
				emitter = Fib()
				subject = DeltaSinceLastCall(emitter)
				Expect(subject()).To(Equal(0.0))
				Expect(subject()).To(Equal(1.0))
				Expect(subject()).To(Equal(1.0))
				Expect(subject()).To(Equal(2.0))
			})
		})

		Context("with a function that does not change", func() {
			It("always shows zero delta", func() {
				emitter = func() float64 { return 1.0 }
				subject = DeltaSinceLastCall(emitter)
				Expect(subject()).To(Equal(0.0))
				Expect(subject()).To(Equal(0.0))
				Expect(subject()).To(Equal(0.0))
			})
		})

	})

})

// When called successively, returns the next term in the Fibonacci sequence.
func Fib() (generatorFunc func() float64) {
	a, b := 0.0, 1.0
	generatorFunc = func() float64 {
		a, b = b, a+b
		return a
	}
	return
}
{'fraction_non_alphanumeric': 0.1810079901659496, 'fraction_numerical': 0.022741241548862937, 'mean_word_length': 3.5460893854748603, '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': '2701222', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1113, 'n_words': 264}