.autotest: One

git-svn-id: svn://ultimatepp.org/upp/trunk@7531 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-07-23 05:31:20 +00:00
parent c5e2c99129
commit eb777bc1ed
4 changed files with 52 additions and 1 deletions

View file

@ -5,8 +5,8 @@ using namespace Upp;
void Test(const InetMessage& msg, int ii, int count, const char *txt = NULL, const char *mime = NULL)
{
LOG("Testing part " << ii);
String body = msg[ii].Decode();
LOG("Testing part " << ii << ' ' << body.GetCount());
ASSERT(body.GetCount() == count);
ASSERT(body.Find(txt) >= 0);
if(mime) {
@ -34,6 +34,19 @@ CONSOLE_APP_MAIN
Test(msg, 1, 119, "Tato zpráva neobsahuje viry ani jiný škodlivý kód - avast! Antivirus je aktivní.");
Test(msg, 3, 909, "Tato zpráva neobsahuje viry ani jiný škodlivý kód -<a href=");
Test(msg, 4, 309891);
DLOG("=========================================================");
String m1 = msg.GetMessage();
SaveFile(GetHomeDirFile("msg1.txt"), m1);
InetMessage msg2;
ASSERT(msg2.Read(m1));
String m2 = msg2.GetMessage();
SaveFile(GetHomeDirFile("msg2.txt"), m2);
ASSERT(m1 == m2);
DeleteFile(GetHomeDirFile("msg1.txt"));
DeleteFile(GetHomeDirFile("msg2.txt"));
DLOG("=========================================================");
ASSERT(msg.Read(LoadFile(GetDataFile("msg2.txt"))));

25
autotest/One/One.cpp Normal file
View file

@ -0,0 +1,25 @@
#include <Core/Core.h>
using namespace Upp;
struct Base { int x; virtual ~Base() {} };
struct Derived : Base { int y; };
CONSOLE_APP_MAIN
{
One<int> x;
x.Create();
One<Base> o;
ASSERT(!o.Is<Base>());
ASSERT(!o.Is<Derived>());
o.Create();
ASSERT(o.Is<Base>());
ASSERT(!o.Is<Derived>());
o.Create<Derived>();
ASSERT(o.Is<Base>());
ASSERT(o.Is<Derived>());
}

9
autotest/One/One.upp Normal file
View file

@ -0,0 +1,9 @@
uses
Core;
file
One.cpp;
mainconfig
"" = "SSE2";

4
autotest/One/init Normal file
View file

@ -0,0 +1,4 @@
#ifndef _One_icpp_init_stub
#define _One_icpp_init_stub
#include "Core/init"
#endif