MCPcopy Create free account
hub / github.com/ddnet/ddnet / CTestInfo

Method CTestInfo

src/test/test.cpp:16–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include <algorithm>
15
16CTestInfo::CTestInfo()
17{
18 const ::testing::TestInfo *pTestInfo =
19 ::testing::UnitTest::GetInstance()->current_test_info();
20
21 // Typed tests have test names like "TestName/0" and "TestName/1", which would result in invalid filenames.
22 // Replace the string after the first slash with the name of the typed test and use hyphen instead of slash.
23 char aTestCaseName[128];
24 str_copy(aTestCaseName, pTestInfo->test_case_name());
25 for(int i = 0; i < str_length(aTestCaseName); i++)
26 {
27 if(aTestCaseName[i] == '/')
28 {
29 aTestCaseName[i] = '-';
30 aTestCaseName[i + 1] = '\0';
31 str_append(aTestCaseName, pTestInfo->type_param());
32 break;
33 }
34 }
35 str_format(m_aFilenamePrefix, sizeof(m_aFilenamePrefix), "%s.%s-%d",
36 aTestCaseName, pTestInfo->name(), process_id());
37 Filename(m_aFilename, sizeof(m_aFilename), ".tmp");
38}
39
40void CTestInfo::Filename(char *pBuffer, size_t BufferLength, const char *pSuffix)
41{

Callers

nothing calls this directly

Calls 5

str_lengthFunction · 0.85
str_formatFunction · 0.85
process_idFunction · 0.85
str_copyFunction · 0.50
str_appendFunction · 0.50

Tested by

no test coverage detected