MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / buildCycleMapper

Function buildCycleMapper

internal/mapper/mapper.path_test.go:22–30  ·  view source on GitHub ↗

buildCycleMapper creates a graph with a cycle: 1 <-> 2 -> 3

()

Source from the content-addressed store, hash-verified

20
21// buildCycleMapper creates a graph with a cycle: 1 <-> 2 -> 3
22func buildCycleMapper() *mapper {
23 m := NewMapper(1)
24 m.crawledRooms = map[int]*mapNode{
25 1: {RoomId: 1, Pos: positionDelta{x: 0, y: 0, z: 0}, Exits: map[string]nodeExit{"to2": {RoomId: 2}}},
26 2: {RoomId: 2, Pos: positionDelta{x: 1, y: 0, z: 0}, Exits: map[string]nodeExit{"to1": {RoomId: 1}, "to3": {RoomId: 3}}},
27 3: {RoomId: 3, Pos: positionDelta{x: 2, y: 0, z: 0}, Exits: map[string]nodeExit{}},
28 }
29 return m
30}
31
32func Test_findPath_DestMatch(t *testing.T) {
33 m := buildTestMapper()

Callers 1

Test_findPath_CycleFunction · 0.85

Calls 1

NewMapperFunction · 0.85

Tested by

no test coverage detected