Functions | |
| bool | xml_test () |
| void | print_gc_stats () |
| int | main (char[][] args) |
| int xmltest::main | ( | char | args[][] ) |
Definition at line 93 of file xmltest.d.
References print_gc_stats(), and xml_test().
{
writefln(); // insert an empty line after unit test output
print_gc_stats();
writefln();
int ret = xml_test()? 0: 1;
writefln();
print_gc_stats();
writefln();
std.gc.minimize();
print_gc_stats();
std.gc.genCollect();
print_gc_stats();
std.gc.fullCollect();
print_gc_stats();
return ret;
}

| void xmltest::print_gc_stats | ( | ) |
Definition at line 84 of file xmltest.d.
Referenced by main().
{
std.gc.GCStats stats;
std.gc.getStats(stats);
printf("poolsize = x%x, usedsize = x%x, freelistsize = x%x, freeblocks = %d, pageblocks = %d\n",
stats.poolsize, stats.usedsize, stats.freelistsize, stats.freeblocks, stats.pageblocks);
}

| bool xmltest::xml_test | ( | ) |
Definition at line 45 of file xmltest.d.
Referenced by main().
{
auto doc = new XMLDoc;
bool ret;
//ret = doc.read_file("poem.xml");
//ret = doc.read_file("machines.xml");
ret = doc.read_file("packets.xml");
if (!ret) {
fwritef(stderr, doc._errors.str());
return false;
}
doc.write_file("out.xml");
auto pos = new XMLPos(doc);
// if (pos.go("get_packets/packet"))
// if (pos.go("/get_packets/packet"))
// if (pos.go("/get_packets/packet[5]"))
if (pos.go("/get_packets/packet[@db_id=\"7628\"]"))
// if (pos.go("get_machines/machine[@wsid=\"client2\"]"))
{
writefln("db_id = " ~ pos.get("db_id"));
writefln("name = " ~ pos.get("name"));
writefln("short_name = ", pos.get("short_name"));
/*@@
writefln("db_id = %d", XMLInt(pos, "db_id"));
writefln("name = %s", XMLString(pos, "name").c_str());
writefln("short_name = %s", XMLString(pos, "short_name").c_str());
*/
pos.back();
}
return true;
}

1.7.2