<commit_before>package hypercat

import (
	"encoding/json"
	"testing"
)

func TestRel(t *testing.T) {
	rel := Rel{Rel: "relation", Val: "value"}

	bytes, err := json.Marshal(rel)

	if err != nil {
		t.Errorf("Error marshalling Rel: %v", err)
	}

	expected := `{"rel":"relation","val":"value"}`

	if string(bytes) != expected {
		t.Errorf("Rel marshalling error, expected '%v', got '%v'", expected, string(bytes))
	}
}

func TestRelConstructor(t *testing.T) {
	rel := NewRel("relation", "value")

	bytes, err := json.Marshal(rel)

	if err != nil {
		t.Errorf("Error marshalling Rel: %v", err)
	}

	expected := `{"rel":"relation","val":"value"}`

	if string(bytes) != expected {
		t.Errorf("Rel marshalling error, expected '%v', got '%v'", expected, string(bytes))
	}
}

func TestRelUnmarshalling(t *testing.T) {
	str := `{"rel":"relation","val":"value"}`

	rel := Rel{}
	json.Unmarshal([]byte(str), &rel)

	if rel.Rel != "relation" {
		t.Errorf("Rel unmarshalling error, expected '%v', got '%v'", "relation", rel.Rel)
	}

	if rel.Val != "value" {
		t.Errorf("Rel unmarshalling error, expected '%v', got '%v'", "value", rel.Val)
	}
}

func TestMetadataMarshalling(t *testing.T) {
	metadata := Metadata{Rel{"relation", "value"}}

	bytes, err := json.Marshal(metadata)

	if err != nil {
		t.Errorf("Error marshalling Metadata: %v", err)
	}

	expected := `[{"rel":"relation","val":"value"}]`

	if string(bytes) != expected {
		t.Errorf("Metadata marshalling error, expected '%v', got '%v'", expected, string(bytes))
	}<commit_msg>Modify metadata test to contain more than one Rel<commit_after>package hypercat

import (
	"encoding/json"
	"testing"
)

func TestRel(t *testing.T) {
	rel := Rel{Rel: "relation", Val: "value"}

	bytes, err := json.Marshal(rel)

	if err != nil {
		t.Errorf("Error marshalling Rel: %v", err)
	}

	expected := `{"rel":"relation","val":"value"}`

	if string(bytes) != expected {
		t.Errorf("Rel marshalling error, expected '%v', got '%v'", expected, string(bytes))
	}
}

func TestRelConstructor(t *testing.T) {
	rel := NewRel("relation", "value")

	bytes, err := json.Marshal(rel)

	if err != nil {
		t.Errorf("Error marshalling Rel: %v", err)
	}

	expected := `{"rel":"relation","val":"value"}`

	if string(bytes) != expected {
		t.Errorf("Rel marshalling error, expected '%v', got '%v'", expected, string(bytes))
	}
}

func TestRelUnmarshalling(t *testing.T) {
	str := `{"rel":"relation","val":"value"}`

	rel := Rel{}
	json.Unmarshal([]byte(str), &rel)

	if rel.Rel != "relation" {
		t.Errorf("Rel unmarshalling error, expected '%v', got '%v'", "relation", rel.Rel)
	}

	if rel.Val != "value" {
		t.Errorf("Rel unmarshalling error, expected '%v', got '%v'", "value", rel.Val)
	}
}

func TestMetadataMarshalling(t *testing.T) {
	metadata := Metadata{
		Rel{"relation", "value"},
		Rel{"relation", "value"},
	}

	bytes, err := json.Marshal(metadata)

	if err != nil {
		t.Errorf("Error marshalling Metadata: %v", err)
	}

	expected := `[{"rel":"relation","val":"value"},{"rel":"relation","val":"value"}]`

	if string(bytes) != expected {
		t.Errorf("Metadata marshalling error, expected '%v', got '%v'", expected, string(bytes))
	}
{'fraction_non_alphanumeric': 0.21027592768791628, 'fraction_numerical': 0.0, 'mean_word_length': 4.797794117647059, 'pattern_counts': {'":': 18, '<': 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': '7510047', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1100, 'n_words': 277}