<commit_before>package bitfield

import "testing"

func TestNewBitField(t *testing.T) {
	var v BitField
	var buf = []byte{0x0f}

	v = NewBitField(buf, 8)
	if v.Hex() != "0f" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	v = NewBitField(buf, 7)
	if v.Hex() != "0e" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	func() {
		defer func() {
			if r := recover(); r == nil {
				t.Error("expected panic but not found")
			}
		}()
		NewBitField(buf, 9)
	}()

	v = NewBitField(nil, 10)
	if v.Hex() != "0000" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	v.Set(0)
	if v.Hex() != "8000" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	v.Set(9)<commit_msg>fix bitfield test<commit_after>package bitfield

import "testing"

func TestNew(t *testing.T) {
	var v BitField
	var buf = []byte{0x0f}

	v = New(buf, 8)
	if v.Hex() != "0f" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	v = New(buf, 7)
	if v.Hex() != "0e" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	func() {
		defer func() {
			if r := recover(); r == nil {
				t.Error("expected panic but not found")
			}
		}()
		New(buf, 9)
	}()

	v = New(nil, 10)
	if v.Hex() != "0000" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	v.Set(0)
	if v.Hex() != "8000" {
		t.Errorf("invalid value: %s", v.Hex())
	}

	v.Set(9)
{'fraction_non_alphanumeric': 0.22432859399684044, 'fraction_numerical': 0.030015797788309637, 'mean_word_length': 3.022222222222222, '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': '6520522', 'n_tokens_mistral': 624, 'n_tokens_neox': 560, 'n_words': 135}