2008-07-20 09:02:01 +04:00
|
|
|
#include "yaml.h"
|
2008-07-05 23:00:58 +04:00
|
|
|
#include "tests.h"
|
2008-06-30 10:51:22 +04:00
|
|
|
#include <fstream>
|
2008-07-01 03:57:58 +04:00
|
|
|
#include <iostream>
|
2008-06-26 02:45:08 +04:00
|
|
|
|
2008-09-04 02:19:27 +04:00
|
|
|
#ifdef _MSC_VER
|
2008-07-14 09:08:46 +04:00
|
|
|
#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
|
2008-07-14 09:08:46 +04:00
|
|
|
|
2008-07-20 09:02:01 +04:00
|
|
|
void run()
|
2008-07-02 09:00:32 +04:00
|
|
|
{
|
2008-08-07 07:30:56 +04:00
|
|
|
std::ifstream fin("tests/test.yaml");
|
2008-07-20 09:02:01 +04:00
|
|
|
|
|
|
|
try {
|
2008-09-04 02:17:17 +04:00
|
|
|
YAML::Parser parser(fin);
|
2008-08-07 07:30:56 +04:00
|
|
|
parser.PrintTokens(std::cout);
|
2008-07-20 09:02:01 +04:00
|
|
|
} catch(YAML::Exception&) {
|
|
|
|
std::cout << "Error parsing the yaml!\n";
|
2008-07-02 09:00:32 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-07 07:30:56 +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;
|
|
|
|
}
|
|
|
|
|
2008-08-07 07:30:56 +04:00
|
|
|
#ifdef WINDOWS
|
2008-09-04 02:17:17 +04:00
|
|
|
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);
|
2008-08-07 07:30:56 +04:00
|
|
|
#endif // WINDOWS
|
|
|
|
Test::RunAll(verbose);
|
2008-07-20 09:02:01 +04:00
|
|
|
run();
|
2008-07-02 05:22:39 +04:00
|
|
|
|
2008-06-26 02:45:08 +04:00
|
|
|
return 0;
|
2008-07-05 23:00:58 +04:00
|
|
|
}
|