Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <iostream>
00012 #include <fstream>
00013
00014 #include "perf/perf.h"
00015 #include "vgfx/vgfx.h"
00016
00017
00018
00019
00020
00021
00022
00023
00024 static void
00025 doTest
00026 (
00027 IN std::istream& stream
00028 )
00029 {
00030 ASSERT_THROW(stream.good(), "not good?");
00031
00032
00033 smart_ptr<vgfx::ObjectMap> omap = vgfx::ObjectMap::create();
00034 ASSERT_THROW(omap, "null");
00035 ASSERT_THROW(0 == omap->size(), "should be empty");
00036
00037
00038 for (int i = 0; i < 16; ++i) {
00039 std::string id;
00040 omap->newObjectID("test", id);
00041 DPRINTF("id[%02d] = '%s'", i, id.c_str());
00042 }
00043
00044
00045 std::string undo, diagnostic;
00046 ASSERT_THROW(vgfx::processRequest(omap, stream, true, undo, diagnostic),
00047 "Failed to process request? diagnostic: " << diagnostic);
00048 DPRINTF("Successfully executed request!");
00049 DPRINTF("Undo request:\n%s", undo.c_str());
00050
00051 DPRINTF("Size of object map now: %d", (int) omap->size());
00052 }
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 int
00063 main
00064 (
00065 IN int argc,
00066 IN const char * argv[]
00067 )
00068 {
00069 int retval = 0;
00070 ASSERT(2 == argc, "Usage: vgfx-test <vgfx_input_file>");
00071 const char * filename = argv[1];
00072 DPRINTF("Using vgfx input file: '%s'", filename);
00073
00074 try {
00075 perf::Timer timer("overall timer");
00076
00077
00078 std::ifstream stream(filename);
00079 ASSERT_THROW(stream.good(), "Problems opening file: " <<
00080 filename);
00081
00082
00083 doTest(stream);
00084
00085 } catch (std::exception& e) {
00086 DPRINTF("EXCEPTION: %s", e.what());
00087 retval = 1;
00088 }
00089
00090 perf::dumpTimingSummary(std::cerr);
00091
00092 return retval;
00093 }
00094