Implemented a Tag struct taking as little memory as possible.

Removed endMark from Node to keep it in 32 bytes on 64bit.
This will result in slightly worse debugging messages, but we
still have the start position of a node.

Tag is needed for better compliance with the spec and emitting
support for multiple tags with the same D data type.
This commit is contained in:
Ferdinand Majerech 2011-08-20 22:15:20 +02:00
parent 932c125eeb
commit 7192503fe6
6 changed files with 180 additions and 83 deletions

View file

@ -45,10 +45,21 @@ void testLoader(bool verbose, string dataFilename, string canonicalFilename)
auto data = loadAll(dataFilename);
auto canonical = loadAll(canonicalFilename);
assert(data.length == canonical.length);
assert(data.length == canonical.length, "Unequal node count");
foreach(n; 0 .. data.length)
{
assert(data[n] == canonical[n]);
if(data[n] != canonical[n])
{
if(verbose)
{
writeln("Normal value:");
writeln(data[n].debugString);
writeln("\n");
writeln("Canonical value:");
writeln(canonical[n].debugString);
}
assert(false);
}
}
}

View file

@ -11,6 +11,7 @@ import std.datetime;
import std.exception;
import std.path;
import dyaml.tag;
import dyaml.testcommon;
@ -383,7 +384,7 @@ void testConstructor(bool verbose, string dataFilename, string codeDummy)
size_t i = 0;
foreach(node; loader)
{
if(node != expected[base][i])
if(!node.valueEquals(expected[base][i]))
{
if(verbose)
{