///////////////////////////////		private method		/////////////////////////////////
// C:/1/2/3/
// 012345678
BOOL CommonStrMethod::_CreatePath(CString strPath)
{
	if(::PathFileExists(strPath))
	{
		return TRUE;
	}
	else
	{
		int iIndex = strPath.ReverseFind('/');
		if(iIndex < 2)
		{
			return FALSE;
		}
		CString strParent = strPath.Left(iIndex);
		if(::PathFileExists(strParent))
		{
			return ::CreateDirectory(strPath, NULL);
		}
		else
		{
			if(CreatePath(strParent))
			{
				return CreatePath(strPath);
			}
			else
			{
				return FALSE;
			}
		}
	}
}
示例#2
0
文件: kodFile.cpp 项目: benjit89/ntp
TEST_F(kodFileTest, WriteFileWithMultipleEntries) {
	kod_db_file = estrdup(CreatePath("kod-output-multiple", OUTPUT_DIR).c_str());

	add_entry("example.com", "RATE");
	add_entry("192.0.2.1", "DENY");
	add_entry("192.0.2.5", "RSTR");

	/*
	 * Manipulate timestamps. This is a bit of a hack, ideally these
	 * tests should not care about the internal representation.
	 */
	kod_db[0]->timestamp = 0xabcd;
	kod_db[1]->timestamp = 0xabcd;
	kod_db[2]->timestamp = 0xabcd;

	write_kod_db();

	// Open file and compare sizes and content.
	ifstream actual(kod_db_file, ios::binary);
	ifstream expected(CreatePath("kod-expected-multiple", INPUT_DIR).c_str());
	ASSERT_TRUE(actual.good());
	ASSERT_TRUE(expected.good());
	
	ASSERT_EQ(GetFileSize(expected), GetFileSize(actual));

	CompareFileContent(expected, actual);
}
示例#3
0
bool MEmblemMgr::CreateCache()
{
	TCHAR szEmblemPath[MAX_PATH]="";
	TCHAR szPath[MAX_PATH]="";

	if(GetMyDocumentsPath(szPath)) {
		strcpy_safe(szEmblemPath, szPath);
		strcat_safe(szEmblemPath, GUNZ_FOLDER);
		CreatePath(szEmblemPath);

		strcat_safe(szEmblemPath, MPATH_EMBLEMFOLDER);
		CreatePath(szEmblemPath);

		strcat_safe(szEmblemPath, MPATH_EMBLEMFILE);
	} else {
		return false;
	}

	MXmlDocument	xmlDoc;

	xmlDoc.Create();
	bool bResult = xmlDoc.SaveToFile(szEmblemPath);
	xmlDoc.Destroy();

	return bResult;
}
示例#4
0
void ListToPath(const struct LinkedList* _List, struct Path* _Path) {
	struct LnkLst_Node* _Itr = _List->Front->Next;
	const struct PathNodeScore* _Node = NULL;
	int _Ct = 0;
	int _Dir = TILE_SIZE;

	_Path->Direction = TILE_SIZE;
	_Path->Tiles = 1;
	if(_Itr != NULL) {
		_Node = ((struct PathNodeScore*)_Itr->Data);
		_Dir = _Node->Direction;
	} else
		return;
	do {
		if(_Dir == _Node->Direction) {
			++_Ct;
		} else {
			_Path->Next = CreatePath(_Dir, _Ct);
			_Path = _Path->Next;
			_Ct = 1;
			_Dir = _Node->Direction;
		}
		_Itr = _Itr->Next;
		if(_Itr == NULL)
			break;
		_Node = ((struct PathNodeScore*)_Itr->Data);
	} while(1);
	if(_Ct > 0)
		_Path->Next = CreatePath(_Dir, _Ct);
}
示例#5
0
	bool DeleteFiles(const TString& directory, const TString& extension)
	{
		WIN32_FIND_DATA findData;
		bool result = true;
        TString searchPath = CreatePath(directory, TString(TEXT("*")) + extension);
        HANDLE hFind = FindFirstFile(searchPath.c_str(), &findData);
        if(hFind != INVALID_HANDLE_VALUE)
        {
            do
            {
                TString name = findData.cFileName;
                if(name != TEXT(".") && name != TEXT(".."))
                {
                    TString pathForDel = CreatePath(directory, name);
                    
                    if(!DeleteFile(pathForDel.c_str()))
                    {
                        result = false;
                        break;
                    }
                }
            } while(FindNextFile(hFind, &findData));
            FindClose(hFind);
        }
		return result;
	}
示例#6
0
bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName)
{
#ifdef _WIN_ALL
  // If we are in Windows, let's try Unicode path first. In Unix we do not
  // need it (Unix MakeDir will fails with Unicode only name).
  if (PathW!=NULL && *PathW!=0)
    return(CreatePath(PathW,SkipLastName));
#endif
  if (Path!=NULL && *Path!=0)
    return(CreatePath(Path,SkipLastName));
  return(false);
}
int main(){
	scanf("%d%d",&n,&m);
	AdjacentMatrix.Size = n;
	for(int i = 0; i < m; i++){
		int start,end;
		scanf("%d%d",&start,&end);
		CreatePath(start,end);
		CreatePath(end,start);
	}
	int ans = BFS(n);
	printf("%d\n",ans);
	return 0;
}
示例#8
0
TEST(utilities, DebugLfpOutputDecimalFormat) {
	const char *filename = CreatePath("debug-output-lfp-dec", OUTPUT_DIR);
	InitDebugTest(filename);

	l_fp test;
	test.l_ui = 6310; // 0x000018A6
	test.l_uf = 308502; // 0x00004B516

	l_fp network;
	HTONL_FP(&test, &network);

	l_fp_output_dec(&network, outputFile);

	FinishDebugTest(CreatePath("debug-input-lfp-dec", INPUT_DIR), filename);
}
示例#9
0
TEST(utilities, DebugLfpOutputBinaryFormat) {
	const char *filename = CreatePath("debug-output-lfp-bin", OUTPUT_DIR);
	InitDebugTest(filename);

	l_fp test;
	test.l_ui = 63;  // 00000000 00000000 00000000 00111111
	test.l_uf = 127; // 00000000 00000000 00000000 01111111

	l_fp network;
	HTONL_FP(&test, &network);

	l_fp_output_bin(&network, outputFile);

	FinishDebugTest(CreatePath("debug-input-lfp-bin", INPUT_DIR), filename);
}
FString M_GetConfigPath(bool for_reading)
{
    FString path;

    // Construct a user-specific config name
    if (UseKnownFolders() && GetKnownFolder(CSIDL_APPDATA, FOLDERID_RoamingAppData, true, path))
    {
        path += "/" GAME_DIR;
        CreatePath(path);
        path += "/" GAMENAMELOWERCASE ".ini";
    }
    else
    {
        path = progdir;
        path += GAMENAMELOWERCASE ".ini";
    }

    // If we are reading the config file, check if it exists. If not, fallback
    // to $PROGDIR/zdoom.ini
    if (for_reading)
    {
        if (!FileExists(path))
        {
            path = progdir;
            path << GAMENAMELOWERCASE ".ini";
        }
    }

    return path;
}
示例#11
0
	TString GetNewNameForFileDigit(const TPath &oldPath, const TString &nameWithoutDigit, __int64 & counter, size_t & leadingZeros, const TPath &pathForRename)
    {
		TString pathWithDigit;
		const int BUFFER_SIZE = 65;
		char buffer[BUFFER_SIZE];
		TString leadingZeroString;

		counter++;
		if (leadingZeros > 0)
		{
			if (LengthOfLong(counter) > LengthOfLong(counter - 1)) //если цифра удленилась
               leadingZeros--;
			for (size_t i = 0; i < leadingZeros; i++)
				leadingZeroString.push_back('0');
		}

		if (_i64toa_s(counter, buffer, BUFFER_SIZE, 10) == 0)
		{
			pathWithDigit = CreatePath(oldPath.GetDirectory(), nameWithoutDigit + leadingZeroString + TString(buffer) + oldPath.GetExtension());
			if(TPath::EqualByNameWithExtension(pathWithDigit, pathForRename))
				return pathForRename.Original();
			if (IsFileExists(pathWithDigit.c_str())) //если такой файл уже есть, то не увеличиваем номер, а добавляем _2
				return GetNewNameForFileAdd(oldPath);
		}
		else
			return GetNewNameForFileAdd(oldPath);
		return pathWithDigit;
    }
示例#12
0
void BezierController::CheckCreatePath()
{
   bool shouldCreatePath = false;

   CurveNode* current = mStartNode.get();

   while (current)
   {
      if (current->GetDirtyFlag())
      {
         shouldCreatePath = true;
         current->SetDirtyFlag(false);
         //note: we wont break cause we need
         //to reset all dirty flags
      }

      current = current->GetNext();
   }

   if (shouldCreatePath)
   {
      CreatePath();
      ResetIterators();
   }
}
示例#13
0
/*
===============
Cmd_Skin

Skins aren't actually stored in the file, only a reference
is saved out to the header file.
===============
*/
static void process_skin(char *name, char *savename)
{
	byte	*palette;
	byte	*pixels;
	int		width, height;
	byte	*cropped;
	int		y;
	// load the image
	printf ("loading %s\n", name);
	Load256Image (name, &pixels, &palette, &width, &height);
	RemapZero (pixels, palette, width, height);

	// crop it to the proper size
	cropped = malloc (model.skinwidth*model.skinheight);
	for (y=0 ; y<model.skinheight ; y++)
	{
		memcpy (cropped+y*model.skinwidth,
			pixels+y*width, model.skinwidth);
	}

	// save off the new image
	printf ("saving %s\n", savename);
	CreatePath (savename);
	WritePCXfile (savename, cropped, model.skinwidth,
		model.skinheight, palette);

	free (pixels);
	free (palette);
	free (cropped);
}
示例#14
0
/*
   ==============
   FinishSprite
   ==============
 */
void FinishSprite( void ){
	FILE    *spriteouthandle;
	int i, curframe;
	dsprite_t spritetemp;
	char savename[1024];

	if ( sprite.numframes == 0 ) {
		return;
	}

	if ( !strlen( spritename ) ) {
		Error( "Didn't name sprite file" );
	}

	sprintf( savename, "%s%s.sp2", gamedir, spritename );

	if ( g_release ) {
		char name[1024];

		sprintf( name, "%s.sp2", spritename );
		ReleaseFile( name );
		spritename[0] = 0;      // clear for a new sprite
		sprite.numframes = 0;
		return;
	}


	printf( "saving in %s\n", savename );
	CreatePath( savename );
	spriteouthandle = SafeOpenWrite( savename );


//
// write out the sprite header
//
	spritetemp.ident = LittleLong( IDSPRITEHEADER );
	spritetemp.version = LittleLong( SPRITE_VERSION );
	spritetemp.numframes = LittleLong( sprite.numframes );

	SafeWrite( spriteouthandle, &spritetemp, 12 );

//
// write out the frames
//
	curframe = 0;

	for ( i = 0 ; i < sprite.numframes ; i++ )
	{
		frames[i].width = LittleLong( frames[i].width );
		frames[i].height = LittleLong( frames[i].height );
		frames[i].origin_x = LittleLong( frames[i].origin_x );
		frames[i].origin_y = LittleLong( frames[i].origin_y );
	}
	SafeWrite( spriteouthandle, frames, sizeof( frames[0] ) * sprite.numframes );

	fclose( spriteouthandle );

	spritename[0] = 0;      // clear for a new sprite
	sprite.numframes = 0;
}
示例#15
0
bool ExtractLink(ComprDataIO &DataIO,Archive &Arc,const char *LinkName,uint &LinkCRC,bool Create)
{
#if defined(SAVE_LINKS) && defined(_UNIX)
  char LinkTarget[NM];
  if (IsLink(Arc.NewLhd.FileAttr))
  {
    int DataSize=Min(Arc.NewLhd.PackSize,sizeof(LinkTarget)-1);
    DataIO.UnpRead((byte *)LinkTarget,DataSize);
    LinkTarget[DataSize]=0;
    if (Create)
    {
      CreatePath(LinkName,NULL,true);
      if (symlink(LinkTarget,LinkName)==-1) // Error.
        if (errno==EEXIST)
          Log(Arc.FileName,St(MSymLinkExists),LinkName);
        else
        {
          Log(Arc.FileName,St(MErrCreateLnk),LinkName);
          ErrHandler.SetErrorCode(RARX_WARNING);
        }
      // We do not set time of created symlink, because utime changes
      // time of link target and lutimes is not available on all Linux
      // systems at the moment of writing this code.
    }
    int NameSize=Min(DataSize,strlen(LinkTarget));
    LinkCRC=CRC(0xffffffff,LinkTarget,NameSize);
    return(true);
  }
#endif
  return(false);
}
示例#16
0
FString M_GetSavegamesPath()
{
	FString path;

	if (!UseKnownFolders())
	{
		return progdir;
	}
	// Try standard Saved Games folder
	else if (GetKnownFolder(-1, FOLDERID_SavedGames, true, path))
	{
		path << "/" GAMENAME;
	}
	// Try defacto My Documents/My Games folder
	else if (GetKnownFolder(CSIDL_PERSONAL, FOLDERID_Documents, true, path))
	{
		// I assume since this isn't a standard folder, it doesn't have
		// a localized name either.
		path << "/My Games/" GAMENAME;
		CreatePath(path);
	}
	else
	{
		path = progdir;
	}
	return path;
}
BOOL CommonStrMethod::CreateFile(CString strFile)
{
	CString strFileName = GetNameFromAbsName(strFile);
	CString strPath = GetPathFromAbsName(strFile);
	if(!IsAbsPath(strPath))
	{
		if(strPath.GetLength() > 0)
		{
			if(strPath.GetAt(0) == _T('\\') || strPath.GetAt(0) == _T('/'))
			{
				strPath.Delete(0);
			}
		}
		strPath = GetModuleDir() + strPath;
	}
	if(!CreatePath(strPath))
	{
		return FALSE;
	}
	HANDLE hFile = ::CreateFile(strPath + strFileName, GENERIC_ALL, FILE_SHARE_READ,
		NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
	if(hFile == INVALID_HANDLE_VALUE)
	{
		return FALSE;
	}

	::CloseHandle(hFile);

	return TRUE;
}
示例#18
0
void CScatteredManage::init()
{
	char startup_dir[MAX_PATH];
	pgrid_util::Singleton<BIN_DIR>::instance();
	GetModuleFileName(NULL,(char*)(void*)pgrid_util::Singleton<BIN_DIR>::instance(),MAX_PATH);
	GetModuleFileName(NULL,startup_dir,MAX_PATH);
	_tcsrchr(startup_dir,'\\')[1] = 0;
	_tcsrchr((char*)(void*)pgrid_util::Singleton<BIN_DIR>::instance(),'\\')[1] = 0;
	strcat(startup_dir,"ScatterProgams");
	if(!IsExistDir(startup_dir))
	{
		if(!CreatePath(startup_dir))
		{
			NPLogError(("创建SCATTERED模块目录失败\n"));
			return;
		}
	}
	//遍历搜索目录 获取模块信息
	//模块名+版本号
	RegisterModules(startup_dir);

	//debug 输出启动注册的模块
	for(MNG_IT it= m_modules.begin();it!=m_modules.end();++it)
	{
		printf("%lld,%s\n",it->first,it->second.moduleTag.name.Get());
	}

	//debug
}
示例#19
0
void
wxGraphicsContext::DoDrawFilledText(const wxString &str,
                                    wxDouble x,
                                    wxDouble y,
                                    const wxGraphicsBrush& backgroundBrush)
{
    wxGraphicsBrush formerBrush = m_brush;
    wxGraphicsPen formerPen = m_pen;
    wxDouble width;
    wxDouble height;
    wxDouble descent;
    wxDouble externalLeading;
    GetTextExtent( str , &width, &height, &descent, &externalLeading );
    SetBrush( backgroundBrush );
    // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
    SetPen( wxNullGraphicsPen );

    wxGraphicsPath path = CreatePath();
    path.AddRectangle( x , y, width, height );
    FillPath( path );

    DrawText( str, x ,y);
    SetBrush( formerBrush );
    SetPen( formerPen );
}
示例#20
0
FString M_GetCachePath(bool create)
{
	FString path;

	char pathstr[PATH_MAX];
	FSRef folder;

	if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, create ? kCreateFolder : 0, &folder) &&
		noErr == FSRefMakePath(&folder, (UInt8*)pathstr, PATH_MAX))
	{
		path = pathstr;
	}
	else
	{
		path = progdir;
	}
	path += "/" GAME_DIR "/cache";

	if (create)
	{
		CreatePath(path);
	}

	return path;
}
示例#21
0
void wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2)
{
    wxGraphicsPath path = CreatePath();
    path.MoveToPoint(x1, y1);
    path.AddLineToPoint( x2, y2 );
    StrokePath( path );
}
示例#22
0
static JSBool
AfxGlobal_createPath(JSContext *cx, unsigned argc, JS::Value *vp)
{
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
	if(1 > args.length())
		return JS_FALSE;

    JSString *str = JS_ValueToString(cx, args[0]);
    if (!str)
        return JS_FALSE;

    char *c_str = JS_EncodeString(cx, str);
	if(!c_str)
		return JS_FALSE;

	bool bOk = false;

	std::wstring wPath;
	std::string path;

	if(AnsiStringToWideString(c_str, wPath)
		&& CreatePath(wPath.c_str(), wPath)
		&& WideStringToAnsiString(wPath.c_str(), path))
	{
		JSString * str = JS_NewStringCopyZ(cx, path.c_str());

		args.rval().set(STRING_TO_JSVAL(str));
	}
	else
		args.rval().set(JSVAL_NULL);

	JS_free(cx, c_str);

    return JS_TRUE;
}
示例#23
0
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush )
{
    wxGraphicsBrush formerBrush = m_brush;
	wxGraphicsPen formerPen = m_pen;

    wxDouble width;
    wxDouble height;
    wxDouble descent;
    wxDouble externalLeading;
    GetTextExtent( str , &width, &height, &descent, &externalLeading );
    SetBrush( backgroundBrush );
	// to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
	SetPen( wxNullGraphicsPen );

    wxGraphicsPath path = CreatePath();
    path.MoveToPoint( x , y );
    path.AddLineToPoint( (int) (x + sin(angle) * height) , (int) (y + cos(angle) * height) );
    path.AddLineToPoint(
        (int) (x + sin(angle) * height + cos(angle) * width) ,
        (int) (y + cos(angle) * height - sin(angle) * width));
    path.AddLineToPoint((int) (x + cos(angle) * width) , (int) (y - sin(angle) * width) );
    FillPath( path );
    DrawText( str, x ,y, angle);
    SetBrush( formerBrush );
	SetPen( formerPen );
}
示例#24
0
void
test_WriteFileWithMultipleEntries(void) {
	kod_db_file = estrdup("kod-output-multiple");
	add_entry("example.com", "RATE");
	add_entry("192.0.2.1", "DENY");
	add_entry("192.0.2.5", "RSTR");

	//
	// Manipulate timestamps. This is a bit of a hack, ideally these
	// tests should not care about the internal representation.
	//
	kod_db[0]->timestamp = 0xabcd;
	kod_db[1]->timestamp = 0xabcd;
	kod_db[2]->timestamp = 0xabcd;

	write_kod_db();

	// Open file and compare sizes and content.
	FILE * actual = fopen(kod_db_file, "rb");
	FILE * expected = fopen(CreatePath("kod-expected-multiple", INPUT_DIR),"rb");

	TEST_ASSERT_NOT_NULL(actual);
	TEST_ASSERT_NOT_NULL(expected);


	TEST_ASSERT_EQUAL(GetFileSize(expected), GetFileSize(actual));

	TEST_ASSERT_TRUE(CompareFileContent(expected, actual));
}
示例#25
0
文件: ulinks.cpp 项目: BITINT/DEFCON2
int ExtractLink(ComprDataIO &DataIO,Archive &Arc,char *DestName,unsigned int &LinkCRC,bool Create)
{
#if defined(SAVE_LINKS) && defined(_UNIX)
  char FileName[NM];
  if (IsLink(Arc.NewLhd.FileAttr))
  {
    int DataSize=Min(Arc.NewLhd.PackSize,sizeof(FileName)-1);
    DataIO.UnpRead((unsigned char *)FileName,DataSize);
    FileName[DataSize]=0;
    if (Create)
    {
      CreatePath(DestName,NULL,true);
      if (symlink(FileName,DestName)==-1)
        if (errno==EEXIST)
          Log(Arc.FileName,St(MSymLinkExists),DestName);
        else
        {
          Log(Arc.FileName,St(MErrCreateLnk),DestName);
          ErrHandler.SetErrorCode(WARNING);
        }
    }
    LinkCRC=CRC(0xffffffff,FileName,DataSize);
    return(1);
  }
#endif
  return(0);
}
示例#26
0
文件: keyFile.c 项目: sambuc/netbsd
void test_ReadEmptyKeyFile() {
	struct key* keys = NULL;

	TEST_ASSERT_EQUAL(0, auth_init(CreatePath("key-test-empty", INPUT_DIR), &keys));

	TEST_ASSERT_TRUE(keys == NULL);
}
示例#27
0
void AutoReplaceMap::writeAutoReplaceMap()
{
	// Create path
	TCHAR *p = _tcsrchr(filename, _T('\\'));
	if (p != NULL)
	{
		*p = 0;
		CreatePath(filename);
		*p = _T('\\');
	}

	// Write it
	FILE *file = _tfopen(filename, _T("wb"));
	if (file != NULL) 
	{
		map<tstring,AutoReplacement>::iterator it = replacements.begin();
		for(; it != replacements.end(); it++)
		{
			AutoReplacement &ar = it->second;

			TcharToUtf8 find(it->first.c_str());
			TcharToUtf8 replace(ar.replace.c_str());

			if (ar.useVariables)
				fprintf(file, "%s-V>%s\n", (const char *)find, (const char *)replace);
			else
				fprintf(file, "%s->%s\n", (const char *)find, (const char *)replace);
		}
		fclose(file);
	}
}
示例#28
0
文件: keyFile.c 项目: sambuc/netbsd
void test_ReadHexKeys() {
	struct key* keys = NULL;

	TEST_ASSERT_EQUAL(3, auth_init(CreatePath("key-test-hex", INPUT_DIR), &keys));

	TEST_ASSERT_TRUE(keys != NULL);

	struct key* result = NULL;
	get_key(10, &result);
	TEST_ASSERT_TRUE(result != NULL);
	TEST_ASSERT_TRUE(CompareKeysAlternative(10, 13, "MD5",
		 "\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89", *result));

	result = NULL;
	get_key(20, &result);
	TEST_ASSERT_TRUE(result != NULL);
	char data1[15]; memset(data1, 0x11, 15);
	TEST_ASSERT_TRUE(CompareKeysAlternative(20, 15, "MD5", data1, *result));

	result = NULL;
	get_key(30, &result);
	TEST_ASSERT_TRUE(result != NULL);
	char data2[13]; memset(data2, 0x01, 13);
	TEST_ASSERT_TRUE(CompareKeysAlternative(30, 13, "MD5", data2, *result));
}
示例#29
0
psPath* psPathNetwork::CreatePath(iDataConnection *db, const csString& name, Waypoint* wp1, Waypoint* wp2,
                                  const csString& flags)
{
    psPath * path = new psLinearPath(name,wp1,wp2,flags);

    return CreatePath(db, path);
}
示例#30
0
TEST(keyFile, ReadHexKeys) {
	const char* path;
	struct key* keys = NULL;
	struct key* result = NULL;
	char data[15];

	path = CreatePath("key-test-hex", INPUT_DIR);
	TEST_ASSERT_EQUAL(3, auth_init(path, &keys));
	free((void*) path);

	TEST_ASSERT_TRUE(keys != NULL);

	get_key(10, &result);
	TEST_ASSERT_TRUE(result != NULL);
	TEST_ASSERT_TRUE(CompareKey(10, 13, "MD5",
		 "\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89", result));

	result = NULL;
	get_key(20, &result);
	TEST_ASSERT_TRUE(result != NULL);
	memset(data, 0x11, 15);
	TEST_ASSERT_TRUE(CompareKey(20, 15, "MD5", data, result));

	result = NULL;
	get_key(30, &result);
	TEST_ASSERT_TRUE(result != NULL);
	memset(data, 0x01, 13);
	TEST_ASSERT_TRUE(CompareKey(30, 13, "MD5", data, result));
}