Initial
This commit is contained in:
parent
d4c558a59a
commit
db05d963be
74 changed files with 4473 additions and 3231 deletions
67
Utils/tests/Tests.cpp
Normal file
67
Utils/tests/Tests.cpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
|
||||
#include "Utils.hpp"
|
||||
#include "Debugging.hpp"
|
||||
#include "Testing.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
using namespace tp;
|
||||
|
||||
void printSnapshot(const tp::CallStackCapture::CallStack* snapshot) {
|
||||
printf("CallStack: \n");
|
||||
for (auto frame : *snapshot) {
|
||||
auto symbols = gCSCapture->getSymbols(frame.getFrame());
|
||||
printf(" %s ----- %s:%llu\n", symbols->getFunc(), symbols->getFile(), symbols->getLine());
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void common() {
|
||||
gCSCapture->getSnapshot();
|
||||
}
|
||||
|
||||
void first() {
|
||||
common();
|
||||
common();
|
||||
common();
|
||||
}
|
||||
|
||||
void second() {
|
||||
common();
|
||||
common();
|
||||
common();
|
||||
common();
|
||||
}
|
||||
|
||||
void third() {
|
||||
common();
|
||||
common();
|
||||
}
|
||||
|
||||
void root() {
|
||||
first();
|
||||
second();
|
||||
third();
|
||||
}
|
||||
|
||||
TEST_DEF(Debugging) {
|
||||
root();
|
||||
|
||||
for (auto cs : *gCSCapture) {
|
||||
printSnapshot(cs.getCallStack());
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
tp::ModuleManifest* deps[] = { &tp::gModuleUtils, nullptr };
|
||||
tp::ModuleManifest testModule("UtilsTest", nullptr, nullptr, deps);
|
||||
|
||||
if (!testModule.initialize()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
testDebugging();
|
||||
|
||||
testModule.deinitialize();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue