MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

valdi/test/runtime/Tracer_tests.cpp:12–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10}
11
12TEST(Tracer, canRecordOperations) {
13 Tracer tracer;
14 auto start = std::chrono::steady_clock::now();
15
16 auto id = tracer.startRecording();
17
18 tracer.append("hello", start, appendMs(start, 50));
19 tracer.append("world", start, appendMs(start, 100));
20
21 auto result = tracer.stopRecording(id);
22
23 ASSERT_EQ(static_cast<size_t>(2), result.size());
24 ASSERT_EQ("hello", result[0].trace);
25 ASSERT_EQ("world", result[1].trace);
26 ASSERT_EQ(50.0, result[0].duration().milliseconds());
27 ASSERT_EQ(100.0, result[1].duration().milliseconds());
28}
29
30TEST(Tracer, returnsEmptyOnInvalidRecordId) {
31 Tracer tracer;

Callers

nothing calls this directly

Calls 10

appendMsFunction · 0.85
startRecordingMethod · 0.80
stopRecordingMethod · 0.80
durationMethod · 0.80
isRecordingMethod · 0.80
appendMethod · 0.65
nowFunction · 0.50
sizeMethod · 0.45
millisecondsMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected