MCPcopy Create free account
hub / github.com/bytedance/bolt / takeRoundTrip

Method takeRoundTrip

bolt/vector/tests/VectorSaverTest.cpp:133–144  ·  view source on GitHub ↗

Writes the passed vector to file and reads it back, returns the read vector.

Source from the content-addressed store, hash-verified

131 // Writes the passed vector to file and reads it back, returns the read
132 // vector.
133 VectorPtr takeRoundTrip(const VectorPtr& vector) {
134 auto path = exec::test::TempFilePath::create();
135
136 std::ofstream outputFile(path->path, std::ofstream::binary);
137 saveVector(*vector, outputFile);
138 outputFile.close();
139
140 std::ifstream inputFile(path->path, std::ifstream::binary);
141 auto copy = restoreVector(inputFile, pool());
142 inputFile.close();
143 return copy;
144 }
145
146 void testRoundTrip(const VectorPtr& vector) {
147 auto copy = takeRoundTrip(vector);

Callers

nothing calls this directly

Calls 5

saveVectorFunction · 0.85
restoreVectorFunction · 0.85
createFunction · 0.50
poolFunction · 0.50
closeMethod · 0.45

Tested by

no test coverage detected