Skip to content

Commit a403e04

Browse files
committed
Add compatibility tests for graph tracing methods
1 parent 031f25d commit a403e04

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Tests/OpenAttributeGraphCompatibilityTests/Graph/GraphTracingCompatibilityTests.swift

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,46 @@ struct GraphTracingCompatibilityTests {
99
func tracing() {
1010
let graph = Graph()
1111
Graph.startTracing(graph, options: [])
12+
Graph.syncTracing(graph)
1213
Graph.stopTracing(graph)
1314
}
15+
16+
@Test
17+
func tracePath() {
18+
let graph = Graph()
19+
let tracePath = Graph.tracePath(graph)
20+
#expect(tracePath == nil)
21+
}
22+
23+
@Test(.disabled(if: !compatibilityTestEnabled, "Not implemented on OAG"))
24+
func setTrace() {
25+
let graph = Graph()
26+
#expect(graph.isTracingActive == false)
27+
28+
var trace = AGTrace()
29+
withUnsafeMutablePointer(to: &trace) { tracePointer in
30+
graph.setTrace(tracePointer, context: nil)
31+
}
32+
#expect(graph.isTracingActive == true)
33+
34+
graph.resetTrace()
35+
#expect(graph.isTracingActive == false)
36+
}
37+
38+
@Test(.disabled(if: !compatibilityTestEnabled, "Not implemented on OAG"))
39+
func traceEventRegistration() {
40+
let eventID = "TEST_EVENT".withCString { namePtr in
41+
"TEST_SUBSYSTEM".withCString { subsystemPtr in
42+
Graph.registerNamedTraceEvent(name: namePtr, subsystem: subsystemPtr)
43+
}
44+
}
45+
46+
let name = Graph.traceEventName(for: eventID)
47+
#expect(name.map { String(cString: $0) } == "TEST_EVENT")
48+
49+
let subsystem = Graph.traceEventSubsystem(for: eventID)
50+
#expect(subsystem.map { String(cString: $0) } == "TEST_SUBSYSTEM")
51+
}
1452

1553
@Test
1654
func tracingAll() {

0 commit comments

Comments
 (0)