<commit_before>package memkv

import (
	"path/filepath"
	"reflect"
	"testing"
)

var getTests = []struct {
	Key   string
	Value string
}{
	{"/myapp/database/username", "admin"},
	{"/myapp/database/password", "<PASSWORD>"},
}

func TestGet(t *testing.T) {
	for _, tt := range getTests {
		s := New()
		s.Set(tt.Key, tt.Value)
		got, ok := s.Get(tt.Key)
		if !ok {
			t.Errorf("missing key")
		}
		want := Node{tt.Key, tt.Value}
		if got != want {
			t.Errorf("wanted %v, got %v", want, got)
		}
	}
}

type missingKeyResult struct {
	node Node
	ok   bool
}

func TestMissingKey(t *testing.T) {
	s := New()
	want := missingKeyResult{Node{}, false}
	node, ok := s.Get("/missing/key")
	got := missingKeyResult{node, ok}
	if !reflect.DeepEqual(got, want) {
		t.Errorf("wanted %v, got %v", want, got)
	}
}

type globResult struct {
	nodes []Node
}

var globTests = []struct {
	input   map[string]string
	pattern string
	want    []Node
	err     error
}{
	{
		map[string]string{
			"/myapp/database/password": "<PASSWORD>",
			"/myapp/database/username": "admin",
		},
		"/myapp/*/*",
		[]Node{
			Node{"/myapp/database/password", "<PASSWORD>"},
			Node{"/myapp/database/username", "admin"},
		},
		nil,
	},
	{<commit_msg>improve test coverage<commit_after>package memkv

import (
	"path/filepath"
	"reflect"
	"testing"
)

var getTests = []struct {
	key   string
	value string
	ok    bool
	want  Node
}{
	{
		"/myapp/database/username",
		"admin",
		true,
		Node{"/myapp/database/username", "admin"},
	},
	{
		"/myapp/database/password",
		"<PASSWORD>",
		true,
		Node{"/myapp/database/password", "<PASSWORD>"},
	},
	{
		"/missing",
		"",
		false,
		Node{},
	},
}

func TestGet(t *testing.T) {
	for _, tt := range getTests {
		s := New()
		if tt.ok {
			s.Set(tt.key, tt.value)
		}
		got, ok := s.Get(tt.key)
		if ok != tt.ok {
			t.Errorf("wanted %v, got %v", tt.ok, got)
		}
		if got != tt.want {
			t.Errorf("wanted %v, got %v", tt.want, got)
		}
	}
}

type globResult struct {
	nodes []Node
}

var globTests = []struct {
	input   map[string]string
	pattern string
	want    []Node
	err     error
}{
	{
		map[string]string{
			"/myapp/database/password": "<PASSWORD>",
			"/myapp/database/username": "admin",
		},
		"/myapp/*/*",
		[]Node{
			Node{"/myapp/database/password", "<PASSWORD>"},
			Node{"/myapp/database/username", "admin"},
		},
		nil,
	},
	{
{'fraction_non_alphanumeric': 0.19633730834752983, 'fraction_numerical': 0.0, 'mean_word_length': 3.15017667844523, 'pattern_counts': {'":': 4, '<': 10, '<?xml version=': 0, '>': 10, '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': '2586496', 'n_tokens_mistral': 1016, 'n_tokens_neox': 931, 'n_words': 199}