代碼寫完了之后,我打開MSDN找里面的幾十條XPath Example進(jìn)行測(cè)試,發(fā)現(xiàn)了一些Bug,然后修正。現(xiàn)在MSDN所列舉的所有例子都通過了,接下來只有自己寫Example進(jìn)行測(cè)試了。因?yàn)镸SDN的例子并沒有覆蓋所有等價(jià)類。
下面是運(yùn)行結(jié)果和測(cè)試程序的代碼:

#include "..\..\..\..\Library\Platform\VL_Console.h"
#include "..\..\..\..\Library\Data\VL_System.h"
#include "..\..\..\..\Library\Data\VL_Stream.h"
#include "..\..\..\..\Library\XML\VL_XML.h"
using namespace vl;
using namespace vl::platform;
using namespace vl::system;
using namespace vl::stream;
using namespace vl::xml;
void vlmain(VL_Console& Con)
{
Con.SetPauseOnExit(false);
Con.SetTestMemoryLeaks(true);
Con.SetTitle(L"Vczh XML");
while(true)
{
VUnicodeString XPathExpression;
Con.Write(L"輸入XPath:");
Con.Read(XPathExpression);
if(XPathExpression==L"")
{
break;
}
else
{
try
{
VL_XPath XPath(XPathExpression);
Con.Write(XPath.ToString());
}
catch(VL_XPathError& e)
{
Con.Write(L"錯(cuò)誤:"+e.Message+L"\r\n");
Con.Write(L"位置:"+XPathExpression.Left(e.Start)+L"\r\n");
}
}
Con.Write(L"--------------------------------------------------------------------------------");
}
}
等考完《軟件測(cè)試方法和技術(shù)》之后把查詢功能寫完。