MCPcopy Create free account
hub / github.com/astercloud/aster / TestLineageGraph_RemoveMemory

Function TestLineageGraph_RemoveMemory

pkg/memory/lineage_test.go:212–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

210}
211
212func TestLineageGraph_RemoveMemory(t *testing.T) {
213 lg := NewLineageGraph()
214
215 // Create parent-child relationship
216 lg.TrackMemory("parent", &LineageMetadata{
217 ID: "parent",
218 CreatedAt: time.Now().Unix(),
219 })
220
221 lg.TrackMemory("child", &LineageMetadata{
222 ID: "child",
223 DerivedFromIDs: []string{"parent"},
224 CreatedAt: time.Now().Unix(),
225 })
226
227 // Remove child
228 lg.RemoveMemory("child")
229
230 // Child should be gone
231 if lg.memoryMetadata["child"] != nil {
232 t.Error("Child memory should be removed from metadata")
233 }
234
235 // Parent should no longer have child in its children list
236 if len(lg.parentToChildren["parent"]) != 0 {
237 t.Error("Parent should have no children after removal")
238 }
239}
240
241func TestLineageManager_TrackMemoryCreation(t *testing.T) {
242 lm := NewLineageManager()

Callers

nothing calls this directly

Calls 4

TrackMemoryMethod · 0.95
RemoveMemoryMethod · 0.95
NewLineageGraphFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected