<commit_before>package plist

import (
	"testing"
	"testing/quick"
)

func TestCFData(t *testing.T) {
	f := func(data []byte) []byte { return data }
	g := func(data []byte) []byte {
		cfData := convertBytesToCFData(data)
		if cfData == nil {
			t.Fatal("CFDataRef is NULL")
		}
		defer cfRelease(cfTypeRef(cfData))
		return convertCFDataToBytes(cfData)
	}
	if err := quick.CheckEqual(f, g, nil); err != nil {
		t.Error(err)
	}
}

func TestCFString(t *testing.T) {
	// because the generator for string produces invalid strings,
	// lets generate []runes instead and convert those to strings in the function
	f := func(runes []rune) string { return string(runes) }
	g := func(runes []rune) string {
		cfStr := convertStringToCFString(string(runes))
		if cfStr == nil {
			t.Fatal("CFStringRef is NULL (%#v)", runes)
		}
		defer cfRelease(cfTypeRef(cfStr))
		return convertCFStringToString(cfStr)
	}
	if err := quick.CheckEqual(f, g, nil); err != nil {
		t.Error(err)
	}
}<commit_msg>Add tests for CFNumber<commit_after>package plist

import (
	"testing"
	"testing/quick"
)

func TestCFData(t *testing.T) {
	f := func(data []byte) []byte { return data }
	g := func(data []byte) []byte {
		cfData := convertBytesToCFData(data)
		if cfData == nil {
			t.Fatal("CFDataRef is NULL (%#v)", data)
		}
		defer cfRelease(cfTypeRef(cfData))
		return convertCFDataToBytes(cfData)
	}
	if err := quick.CheckEqual(f, g, nil); err != nil {
		t.Error(err)
	}
}

func TestCFString(t *testing.T) {
	// because the generator for string produces invalid strings,
	// lets generate []runes instead and convert those to strings in the function
	f := func(runes []rune) string { return string(runes) }
	g := func(runes []rune) string {
		cfStr := convertStringToCFString(string(runes))
		if cfStr == nil {
			t.Fatal("CFStringRef is NULL (%#v)", runes)
		}
		defer cfRelease(cfTypeRef(cfStr))
		return convertCFStringToString(cfStr)
	}
	if err := quick.CheckEqual(f, g, nil); err != nil {
		t.Error(err)
	}
}

func TestCFNumber_Int64(t *testing.T) {
	f := func(i int64) int64 { return i }
	g := func(i int64) int64 {
		cfNum := convertInt64ToCFNumber(i)
		if cfNum == nil {
			t.Fatal("CFNumberRef is NULL (%#v)", i)
		}
		defer cfRelease(cfTypeRef(cfNum))
		return convertCFNumberToInt64(cfNum)
	}
	if err := quick.CheckEqual(f, g, nil); err != nil {
		t.Error(err)
	}
}

func TestCFNumber_UInt32(t *testing.T) {
	f := func(i uint32) uint32 { return i }
	g := func(i uint32) uint32 {
		cfNum := convertUInt32ToCFNumber(i)
		if cfNum == nil {
			t.Fatal("CFNumberRef is NULL (%#v)", i)
		}
		defer cfRelease(cfTypeRef(cfNum))
		return convertCFNumberToUInt32(cfNum)
	}
	if err := quick.CheckEqual(f, g, nil); err != nil {
		t.Error(err)
	}
}

func TestCFNumber_Float64(t *testing.T) {
	f := func(f float64) float64 { return f }
	g := func(f float64) float64 {
		cfNum := convertFloat64ToCFNumber(f)
		if cfNum == nil {
			t.Fatal("CFNumberRef is NULL (%#v)", f)
		}
		defer cfRelease(cfTypeRef(cfNum))
		return convertCFNumberToFloat64(cfNum)
	}
	if err := quick.CheckEqual(f, g, nil); err != nil {
		t.Error(err)
	}
}
{'fraction_non_alphanumeric': 0.14872292272874232, 'fraction_numerical': 0.013579049466537343, 'mean_word_length': 4.072131147540984, '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': '603598', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1162, 'n_words': 296}