SimpleXmlPreprocessorのテストを追加

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@573 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2012-01-19 02:30:31 +00:00
parent bf329ede53
commit 5d687eb4be
5 changed files with 78 additions and 1 deletions

View File

@ -14,7 +14,11 @@
*---------------------------------------------------------------------------*/
#include "SimpleXmlPreprocessor.h"
#if defined(__ARMCC_VERSION)
#include <nn.h>
#else
#include "test_common.h"
#endif
namespace ConsoleRestore
{

View File

@ -1 +1 @@
.SUBDIRS: RegionIdModifier XmlCreator
.SUBDIRS: $(glob D, *)

View File

@ -0,0 +1,29 @@
INCLUDES[] +=
./
../common
../../../ConsoleRestore
TARGET = testSimpleXmlPreprocessor
TEST_TARGET = SimpleXmlPreprocessor
SRC_FILES[] =
testSimpleXmlPreprocessor
SimpleXmlPreprocessor
# テスト独自のスタブを使用する場合に定義する
CXXFLAGS += -DPCTEST_USE_STUB
# テストディレクトリ外にあるので独自ルールでビルド
$(TEST_TARGET)$(EXT_OBJ): ../../../ConsoleRestore/$(TEST_TARGET).cpp
$(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $<
.DEFAULT: $(TEST_TARGET)$(EXT_OBJ) $(TARGET)$(EXE)
CXXProgram($(TARGET), $(SRC_FILES))
.PHONY: clean test
clean:
rm -rf *$(EXT_OBJ) *$(EXE)
test: $(TARGET)$(EXE)
$<

View File

@ -0,0 +1,21 @@
/*---------------------------------------------------------------------------*
Project: Horizon
File: stub.h
Copyright 2009-2011 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Rev$
*---------------------------------------------------------------------------*/
#ifndef STUB_H_
#define STUB_H_
#define NN_LOG(...) (void)0
#endif /* STUB_H_ */

View File

@ -0,0 +1,23 @@
#include <gtest/gtest.h>
#include <cstring>
#include "SimpleXmlPreprocessor.h"
using namespace ConsoleRestore;
namespace
{
const char testStr[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soapenv:Body><GetPreInstalledInfoResponse xmlns=\"urn:bgs.wsapi.broadon.com\"><GetPreInstalledInfoResponse><Version></Version><MessageId></MessageId><TimeStamp>1326939225587</TimeStamp><ErrorCode>0</ErrorCode><ListResultTotalSize>1</ListResultTotalSize><PreinstalledInfo><DeviceId>17179924184</DeviceId><SerialNo>EJA20305940</SerialNo><Region>JPN</Region><ManufactureDate>1324339327000</ManufactureDate><TitleIds>000400000FEEB400,000400000FEEB000</TitleIds></PreinstalledInfo></GetPreInstalledInfoResponse></GetPreInstalledInfoResponse></soapenv:Body></soapenv:Envelope>";
}
TEST(testSimpleXmlPreprocessor, Canonicalize)
{
SimpleXmlPreprocessor pp;
std::string str(testStr);
pp.Canonicalize(str);
std::cout << str << std::endl;
}