Files
ragflow/internal/ingestion/component/knowledge_compiler/common/id_test.go
Zhichang Yu 90f46b0b4d Go port: doc-level metadata extraction and knowledge compiler (#17536)
Ports doc-level auto-metadata extraction to Go and adds the
knowledge_compiler component with scheduler/routing. Fixes Extractor
metadata injection type assertion and enable_metadata default-on.
2026-07-29 21:06:48 +08:00

22 lines
652 B
Go

package common
import "testing"
// TestStableRowID_NULCollision locks that distinct part sequences can never
// share an id even when a part contains a NUL byte (length-prefixed encoding).
func TestStableRowID_NULCollision(t *testing.T) {
a := StableRowID("a\x00b")
b := StableRowID("a", "b")
if a == b {
t.Fatalf("StableRowID collided for [\"a\\x00b\"] and [\"a\",\"b\"]: %s", a)
}
// Determinism: same inputs always yield the same id.
if StableRowID("a", "b") != b {
t.Fatal("StableRowID is not deterministic")
}
// Order matters.
if StableRowID("a", "b") == StableRowID("b", "a") {
t.Fatal("StableRowID ignored part ordering")
}
}