Commit c6233a94 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

removed manual test binary (this 'test' belongs in a to-be made data_spec_unittests file)


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@517 e5f2f494-b856-4b98-b285-d166d9295462
parent b8b4032f
AM_CPPFLAGS = -I$(top_srcdir)/src/lib/cc/cpp -I$(top_srcdir)/ext -Wall -Werror
bin_PROGRAMS = test
test_SOURCES = test.cc
test_LDADD = libcc.a
lib_LIBRARIES = libcc.a
libcc_a_SOURCES = data.cc data.h data_def.h data_def.cc session.cc session.h
......
#include "data.h"
#include "data_def.h"
#include <fstream>
using namespace std;
using namespace isc::data;
int
main(int argc, char **argv) {
std::ifstream file;
std::stringstream ss;
DataDefinition def;
ElementPtr data;
file.open("parkinglot.spec");
if (!file) {
cout << "error opening parkinglot.spec" << endl;
return 1;
}
try {
def = DataDefinition(file);
cout << "Definition: " << endl;
cout << def.getDefinition() << endl;
} catch (ParseError pe) {
cout << "Error parsing definition file: " << pe.what() << endl;
return 1;
} catch (DataDefinitionError dde) {
cout << "Error reading definition file: " << dde.what() << endl;
return 1;
}
file.close();
file.open("parkinglot.data");
if (!file) {
cout << "error opening parkinglot.data" << endl;
return 1;
}
try {
data = Element::createFromString(file);
cout << "Data: " << endl;
cout << data << endl;
} catch (ParseError pe) {
cout << "Error parsing data file: " << pe.what() << endl;
return 1;
}
if (def.validate(data)) {
cout << "Data validated" << endl;
cout << data << endl;
} else {
cout << "Error in data validation" << endl;
}
file.close();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment