<commit_before>package main

import (
	"image"
	"image/color"
	"testing"
	"time"
)

func TestGrad(t *testing.T) {
	numColours := 256
	w := 440
	h := 220

	cg := ColourGrad([]GradStop{
		{0.0, color.RGBA{0, 0, 255, 255}},
		{0.5, color.RGBA{0, 255, 0, 255}},
		{1.0, color.RGBA{255, 0, 0, 255}},
	})
	tempPal := cg.makePal(0.0, 1.0, numColours)
	m := image.NewPaletted(image.Rect(0, 0, w, h), tempPal)

	// Setup Data
	for y := 0; y < h; y += 1 {
		var colIDX uint8 = uint8(numColours * y / h)
		for x := 0; x < w; x += 1 {
			m.SetColorIndex(x, y, colIDX)
		}
	}

	saveGIFToFolder("_testPal.gif", m, numColours)
}

func TestHourReport(t *testing.T) {
	co := camObject{
		name:        "_test",
		folder:      CAPTURE_FOLDER,
		imgCur:      0,
		filesToLoop: MAX_IMAGE_PER_CAM,
		imgBuffer:   make([]image.Image, MAX_IMAGE_PER_CAM, MAX_IMAGE_PER_CAM),
		data:        []computeData{},
	}

	camImageChan := make(chan image.Image)
	timeStart := time.Now().Add(-time.Hour * 2)

	for t := timeStart; t < time.Now(); t = t.Add(time.Second * 0.5) {
		data = append(data, computeData{stamp: t, lum: 0, frameDuration: 500})
	}

	m := makeLumTimeline([]*camObject{&co})
	saveGIFToFolder("_testReport.gif", m, 256)
}<commit_msg>Added Reports<commit_after>package main

import (
	"image"
	"image/color"
	"math/rand"
	"testing"
	"time"
)

func TestGrad(t *testing.T) {
	numColours := 256
	w := 440
	h := 220

	cg := ColourGrad([]GradStop{
		{0.0, color.RGBA{0, 0, 255, 255}},
		{0.5, color.RGBA{0, 255, 0, 255}},
		{1.0, color.RGBA{255, 0, 0, 255}},
	})
	tempPal := cg.makePal(0.0, 1.0, numColours)
	m := image.NewPaletted(image.Rect(0, 0, w, h), tempPal)

	// Setup Data
	for y := 0; y < h; y += 1 {
		var colIDX uint8 = uint8(numColours * y / h)
		for x := 0; x < w; x += 1 {
			m.SetColorIndex(x, y, colIDX)
		}
	}

	saveGIFToFolder("_testPal.gif", m, numColours)
}

func TestLumTimeline(t *testing.T) {
	co := []*camObject{{
		name:        "_testReportRand",
		folder:      CAPTURE_FOLDER,
		imgCur:      0,
		filesToLoop: MAX_IMAGE_PER_CAM,
		data:        []computeData{},
	},
		{
			name:        "_testReportScale",
			folder:      CAPTURE_FOLDER,
			imgCur:      0,
			filesToLoop: MAX_IMAGE_PER_CAM,
			data:        []computeData{},
		},
	}

	timeStart := time.Now().Add(-time.Hour * 2)
	timeDFactor := 0.45 + rand.Float32()*0.15
	var timCount uint8 = 0

	for t := timeStart; time.Now().After(t); t = t.Add(time.Duration(float32(time.Second) * timeDFactor)) {
		co[0].data = append(co[0].data, computeData{
			stamp:         t,
			lum:           uint8(rand.Intn(0xFF)),
			frameDuration: 450 + time.Duration(rand.Intn(100)),
		})

		co[1].data = append(co[1].data, computeData{
			stamp:         t,
			lum:           timCount,
			frameDuration: 450 + time.Duration(rand.Intn(100)),
		})

		timCount += 1
		timeDFactor = 0.45 + rand.Float32()*0.15
	}

	m := makeLumTimeline(co)
	saveGIFToFolder("_testTimeline.gif", m, 256)
}

func TestHourReport(t *testing.T) {
	co := []*camObject{{
		name:        "_testReportRand",
		folder:      CAPTURE_FOLDER,
		imgCur:      0,
		filesToLoop: MAX_IMAGE_PER_CAM,
		data:        []computeData{},
	},
		{
			name:        "_testReportScale",
			folder:      CAPTURE_FOLDER,
			imgCur:      0,
			filesToLoop: MAX_IMAGE_PER_CAM,
			data:        []computeData{},
		},
	}

	timeStart := time.Now().Add(-time.Hour * 2)
	timeDFactor := 0.45 + rand.Float32()*0.15
	var timCount uint8 = 0

	for t := timeStart; time.Now().After(t); t = t.Add(time.Duration(float32(time.Second) * timeDFactor)) {
		co[0].data = append(co[0].data, computeData{
			stamp:         t,
			lum:           uint8(rand.Intn(0xFF)),
			frameDuration: 450 + time.Duration(rand.Intn(100)),
		})

		co[1].data = append(co[1].data, computeData{
			stamp:         t,
			lum:           timCount,
			frameDuration: 450 + time.Duration(rand.Intn(100)),
		})

		timCount += 1
		timeDFactor = 0.45 + rand.Float32()*0.15
	}

	saveGIFToFolder("_testReport0.gif", makeLumHourlyImg(co[0]), 256)
	saveGIFToFolder("_testReport1.gif", makeLumHourlyImg(co[1]), 256)
}
{'fraction_non_alphanumeric': 0.17367639782285996, 'fraction_numerical': 0.05195447798119743, 'mean_word_length': 3.063316582914573, 'pattern_counts': {'":': 0, '<': 8, '<?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': '5951141', 'n_tokens_mistral': 1926, 'n_tokens_neox': 1667, 'n_words': 335}