yaml-cpp/yaml-reader/main.cpp

42 lines
746 B
C++
Raw Normal View History

#include "yaml.h"
#include "tests.h"
2008-06-30 10:51:22 +04:00
#include <fstream>
#include <iostream>
2008-06-26 02:45:08 +04:00
2008-09-04 02:19:27 +04:00
#ifdef _MSC_VER
#ifdef _DEBUG
#pragma comment(lib, "yamlcppd.lib")
#else
#pragma comment(lib, "yamlcpp.lib")
2008-09-04 02:19:27 +04:00
#endif // _DEBUG
#endif // _MSC_VER
void run()
2008-07-02 09:00:32 +04:00
{
std::ifstream fin("tests/test.yaml");
try {
2008-09-04 02:17:17 +04:00
YAML::Parser parser(fin);
parser.PrintTokens(std::cout);
} catch(YAML::Exception&) {
std::cout << "Error parsing the yaml!\n";
2008-07-02 09:00:32 +04:00
}
}
int main(int argc, char **argv)
2008-09-04 02:17:17 +04:00
{
bool verbose = false;
for(int i=1;i<argc;i++) {
if(strcmp(argv[i], "-v") == 0)
verbose = true;
}
#ifdef WINDOWS
2008-09-04 02:17:17 +04:00
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);
#endif // WINDOWS
Test::RunAll(verbose);
run();
2008-06-26 02:45:08 +04:00
return 0;
}