--- truecrypt/platform/platformtest.cpp 2018/04/24 16:54:48 1.1.1.3 +++ truecrypt/platform/platformtest.cpp 2018/04/24 17:09:11 1.1.1.9 @@ -1,9 +1,9 @@ /* - Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. - Governed by the TrueCrypt License 2.5 the full text of which is contained - in the file License.txt included in TrueCrypt binary and source code - distribution packages. + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. */ #include "PlatformTest.h" @@ -18,6 +18,7 @@ #include "StringConverter.h" #include "SyncEvent.h" #include "Thread.h" +#include "Common/Tcdefs.h" namespace TrueCrypt { @@ -45,6 +46,20 @@ namespace TrueCrypt string str = "string test"; wstring wstr = L"wstring test"; + string convStr = "test"; + StringConverter::ToSingle (wstr, convStr); + if (convStr != "wstring test") + throw TestFailed (SRC_POS); + + StringConverter::Erase (convStr); + if (convStr != " ") + throw TestFailed (SRC_POS); + + wstring wEraseTest = L"erase test"; + StringConverter::Erase (wEraseTest); + if (wEraseTest != L" ") + throw TestFailed (SRC_POS); + list stringList; stringList.push_back (str + "1"); stringList.push_back (str + "2"); @@ -222,7 +237,7 @@ namespace TrueCrypt if (sizeof (byte) != 1 || sizeof (int8) != 1 || sizeof (__int8) != 1) throw TestFailed (SRC_POS); if (sizeof (uint16) != 2 || sizeof (int16) != 2 || sizeof (__int16) != 2) throw TestFailed (SRC_POS); if (sizeof (uint32) != 4 || sizeof (int32) != 4 || sizeof (__int32) != 4) throw TestFailed (SRC_POS); - if (sizeof (uint64) != 8 || sizeof (int64) != 8 || sizeof (__int64) != 8) throw TestFailed (SRC_POS); + if (sizeof (uint64) != 8 || sizeof (int64) != 8) throw TestFailed (SRC_POS); // Exception handling TestFlag = false; @@ -280,7 +295,7 @@ namespace TrueCrypt TestFlag = false; { - finally_do_arg (bool&, TestFlag, { finally_arg = true; }); + finally_do_arg (bool*, &TestFlag, { *finally_arg = true; }); if (TestFlag) throw TestFailed (SRC_POS); } @@ -290,7 +305,7 @@ namespace TrueCrypt TestFlag = false; int tesFlag2 = 0; { - finally_do_arg2 (bool&, TestFlag, int&, tesFlag2, { finally_arg = true; finally_arg2 = 2; }); + finally_do_arg2 (bool*, &TestFlag, int*, &tesFlag2, { *finally_arg = true; *finally_arg2 = 2; }); if (TestFlag || tesFlag2 != 0) throw TestFailed (SRC_POS); }