MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / TestComputeStringHash

Function TestComputeStringHash

internal/plugins/template/hash_test.go:60–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestComputeStringHash(t *testing.T) {
61 tests := []struct {
62 name string
63 input string
64 want string
65 }{
66 {
67 name: "empty string",
68 input: "",
69 want: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
70 },
71 {
72 name: "simple string",
73 input: "test",
74 want: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
75 },
76 {
77 name: "longer string with spaces",
78 input: "this is a test string",
79 want: "f6774519d1c7a3389ef327e9c04766b999db8cdfb85d1346c471ee86d65885bc",
80 },
81 }
82
83 for _, tt := range tests {
84 t.Run(tt.name, func(t *testing.T) {
85 if got := ComputeStringHash(tt.input); got != tt.want {
86 t.Errorf("ComputeStringHash() = %v, want %v", got, tt.want)
87 }
88 })
89 }
90}
91
92// TestHashConsistency ensures both hash functions produce same results for same content
93func TestHashConsistency(t *testing.T) {

Callers

nothing calls this directly

Calls 1

ComputeStringHashFunction · 0.85

Tested by

no test coverage detected