add tdm test for memory profiling

This commit is contained in:
Mario Fink 2021-05-03 19:01:06 +02:00
parent c4f2a5ff5d
commit 9ebac41973
2 changed files with 42 additions and 1 deletions

View File

@ -30,6 +30,14 @@ INST := /usr/local/bin
OST := $(shell uname)
CWD := $(shell pwd)
# --------------------------------------------------------------------------- #
tdmtest : tdmtest.o
$(CC) $(OPT) $^ -o $@
tdmtest.o : src/test.cpp lib/$(SRC).hpp $(HPP)
$(CC) -c $(OPT) $(LIB) -I lib/ $< -o $@
# --------------------------------------------------------------------------- #
# CLI tool
@ -60,7 +68,7 @@ $(SRC).o : lib/$(SRC).cpp lib/$(SRC).hpp $(HPP)
$(CC) -c $(OPT) $(LIB) $< -o $@
cpp-clean :
rm -f $(EXE) *.o src/main.cpp.cpp
rm -f $(EXE) *.o src/main.cpp.cpp tdmtest
# --------------------------------------------------------------------------- #
# check process

33
src/test.cpp Normal file
View File

@ -0,0 +1,33 @@
// ------------------------------------------------------------------------- //
#include "tdm_termite.hpp"
#include <filesystem>
#include <regex>
#include <thread>
#include <chrono>
// ------------------------------------------------------------------------- //
int main(int argc, char* argv[])
{
std::string tdmfile(argv[1]);
std::string tdxfile(argv[2]);
std::cout<<tdmfile<<"\n"<<tdxfile<<"\n";
pugi::xml_document xml_doc;
pugi::xml_parse_result xml_result;
// load XML document from stream
std::ifstream fin(tdmfile.c_str());
xml_result = xml_doc.load(fin);
fin.close();
std::cout<<"\nloading "<<tdmfile<<": "<<xml_result.description()<<"\n";
std::cout<<"encoding: "<<(pugi::xml_encoding)xml_result.encoding<<"\n\n";
std::this_thread::sleep_for(std::chrono::milliseconds(4000));
return 0;
}