.autotest

git-svn-id: svn://ultimatepp.org/upp/trunk@10910 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-03-07 10:35:30 +00:00
parent 6bc412e167
commit c8ecec60df
3 changed files with 62 additions and 3 deletions

View file

@ -0,0 +1,51 @@
#include <Core/Core.h>
using namespace Upp;
template <class T>
void Test(T c)
{
T h = c;
{
Value v = h;
ASSERT(~v == AsString(c));
ASSERT(v.Is<T>());
ASSERT(v.To<T>() == h);
T h1 = v;
ASSERT(h == h1);
}
{
Value v = RawToValue(h);
ASSERT(v.Is<T>());
ASSERT(v.To<T>() == h);
T h1 = v.To<T>();
ASSERT(h == h1);
}
{ // this is not supported by Value definition (RichToValue should only be used in client type)
Value v = RichToValue(h);
ASSERT(~v == AsString(c));
ASSERT(v.Is<T>());
T h1 = v.To<T>();
ASSERT(h == h1);
}
}
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
{
struct Foo { int x; } x;
x.x = 123;
Value v = RawToValue(x);
ASSERT(v.Is<Foo>());
ASSERT(v.To<Foo>().x == 123);
}
Test<int>(1234);
Test<String>("1234");
Test<WString>("1234");
LOG("=== Everything OK");
}

View file

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

View file

@ -55,14 +55,13 @@ CONSOLE_APP_MAIN
uuid.c = 1111;
uuid.d = 19999;
CheckType(uuid, true);
CheckType(Arial(50).Bold().Strikeout(), true);
{
DrawingDraw g(100, 100);
g.DrawText(0, 0, "Hello world");
Drawing x = g.GetResult();
CheckType(x);
CheckType(x);
}
{
@ -71,7 +70,7 @@ CONSOLE_APP_MAIN
Painting x = g.GetResult();
CheckType(x);
}
{
CheckType(CreateImage(Size(20, 20), Blue));
}