mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-07 02:24:55 -06:00
.upptst
git-svn-id: svn://ultimatepp.org/upp/trunk@9922 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
475151a09e
commit
efd128cc70
15 changed files with 290 additions and 0 deletions
|
|
@ -497,6 +497,15 @@ void Autocomplete() {
|
|||
|
||||
// ----------------------------------------------------
|
||||
|
||||
void JumpToLayout()
|
||||
{
|
||||
WithPrinterLayout<TopWindow> h;
|
||||
|
||||
SetLayout_PrinterLayout(h);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
struct Foo {
|
||||
typedef Foo CLASSNAME;
|
||||
|
||||
|
|
|
|||
17
upptst/CheckCompile/CheckCompile.h
Normal file
17
upptst/CheckCompile/CheckCompile.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef _CheckCompile_CheckCompile_h
|
||||
#define _CheckCompile_CheckCompile_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <CheckCompile/CheckCompile.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
class CheckCompile : public WithCheckCompileLayout<TopWindow> {
|
||||
public:
|
||||
typedef CheckCompile CLASSNAME;
|
||||
CheckCompile();
|
||||
};
|
||||
|
||||
#endif
|
||||
3
upptst/CheckCompile/CheckCompile.lay
Normal file
3
upptst/CheckCompile/CheckCompile.lay
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
LAYOUT(CheckCompileLayout, 200, 100)
|
||||
END_LAYOUT
|
||||
12
upptst/CheckCompile/CheckCompile.upp
Normal file
12
upptst/CheckCompile/CheckCompile.upp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
RichEdit;
|
||||
|
||||
file
|
||||
CheckCompile.h,
|
||||
main.cpp,
|
||||
CheckCompile.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
5
upptst/CheckCompile/init
Normal file
5
upptst/CheckCompile/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _CheckCompile_icpp_init_stub
|
||||
#define _CheckCompile_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "RichEdit/init"
|
||||
#endif
|
||||
17
upptst/CheckCompile/main.cpp
Normal file
17
upptst/CheckCompile/main.cpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "CheckCompile.h"
|
||||
|
||||
CheckCompile::CheckCompile()
|
||||
{
|
||||
CtrlLayout(*this, "Window title");
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
|
||||
{
|
||||
// Checks ambiguity issue with Lambda assignment vs operator<<(String&&, T)
|
||||
EditString es;
|
||||
es << [=] { LOG("HERE"); };
|
||||
String() << AsString(Random());
|
||||
}
|
||||
}
|
||||
43
upptst/MapRange/MapRange.cpp
Normal file
43
upptst/MapRange/MapRange.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
VectorMap<String, String> h;
|
||||
for(int i = 0; i < 20; i++)
|
||||
h("key" + AsString(i), "value" + AsString(i));
|
||||
|
||||
for(auto& kv : ~h) {
|
||||
DDUMP(kv.key);
|
||||
DDUMP(kv.value);
|
||||
}
|
||||
|
||||
DLOG("=========");
|
||||
|
||||
h.Unlink(11);
|
||||
|
||||
for(auto& kv : ~h) {
|
||||
DDUMP(kv.key);
|
||||
DDUMP(kv.value);
|
||||
kv.value = "123";
|
||||
}
|
||||
|
||||
DLOG("=========");
|
||||
|
||||
const VectorMap<String, String>& ch = h;
|
||||
for(auto& kv : ~ch) {
|
||||
DDUMP(kv.key);
|
||||
DDUMP(kv.value);
|
||||
}
|
||||
|
||||
DLOG("=========");
|
||||
for(int i = 0; i < h.GetCount(); i++)
|
||||
if(!h.IsUnlinked(i))
|
||||
h.Unlink(i);
|
||||
|
||||
for(auto& kv : ~h) {
|
||||
DDUMP(kv.key);
|
||||
DDUMP(kv.value);
|
||||
}
|
||||
}
|
||||
9
upptst/MapRange/MapRange.upp
Normal file
9
upptst/MapRange/MapRange.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
MapRange.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
4
upptst/MapRange/init
Normal file
4
upptst/MapRange/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _MapRange_icpp_init_stub
|
||||
#define _MapRange_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
74
upptst/Range/Range.cpp
Normal file
74
upptst/Range/Range.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
SeedRandom(0);
|
||||
|
||||
Vector<int> h = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
|
||||
Sort(SubRange(h, 2, 5).Write());
|
||||
DDUMP(h);
|
||||
Sort(SubRange(h.begin() + 1, h.end()).Write());
|
||||
DDUMP(h);
|
||||
// Sort(Range(h.begin(), 5), std::greater<int>());
|
||||
DDUMP(h);
|
||||
|
||||
DDUMPC(FilterRange(h, [=](int x) { return x & 1; }));
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
h.Add(Random(25));
|
||||
|
||||
DDUMP(FilterRange(h, [=](int x) { return x & 1; }));
|
||||
DDUMP(FilterRange(h, [=](int x) { return !(x & 1); }));
|
||||
|
||||
Sort(FilterRange(h, [=](int x) { return x & 1; }).Write());
|
||||
Sort(FilterRange(h, [=](int x) { return !(x & 1); }).Write(), std::greater<int>());
|
||||
DDUMP(h);
|
||||
|
||||
DDUMPC(ConstRange(12, 5));
|
||||
|
||||
h.Set(5, ConstRange(123, 3));
|
||||
DDUMP(h);
|
||||
|
||||
h.Insert(5, ConstRange(10, 5));
|
||||
DDUMP(h);
|
||||
|
||||
String vs = String::GetVoid();
|
||||
DDUMP(vs.IsVoid());
|
||||
vs.Clear();
|
||||
DDUMP(vs.IsVoid());
|
||||
|
||||
Array<int> ah;
|
||||
ah.Append(h);
|
||||
DDUMP(ah);
|
||||
ah.Insert(4, ConstRange(54321, 2));
|
||||
DDUMP(ah);
|
||||
|
||||
Sort(h);
|
||||
DDUMP(h);
|
||||
Reverse(SubRange(h, 5, 5).Write());
|
||||
DDUMP(h);
|
||||
|
||||
DDUMP(FindMin(h));
|
||||
DDUMP(FindMax(h));
|
||||
DDUMP(Min(h));
|
||||
DDUMP(Max(h));
|
||||
|
||||
Sort(h);
|
||||
DDUMPC(h);
|
||||
DDUMP(FindUpperBound(h, 8));
|
||||
DDUMP(FindLowerBound(h, 8));
|
||||
|
||||
DDUMP(FindUpperBound(h, 9));
|
||||
DDUMP(FindLowerBound(h, 9));
|
||||
|
||||
DDUMP(FindBinary(h, 10));
|
||||
DDUMP(FindBinary(h, 20));
|
||||
|
||||
DDUMP(Sum(h));
|
||||
|
||||
Vector<int> empty;
|
||||
DDUMP(Min(empty, 11));
|
||||
DDUMP(Max(empty, 12));
|
||||
}
|
||||
9
upptst/Range/Range.upp
Normal file
9
upptst/Range/Range.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
Range.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "MT";
|
||||
|
||||
4
upptst/Range/init
Normal file
4
upptst/Range/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _Range_icpp_init_stub
|
||||
#define _Range_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
71
upptst/Tuple/Tuple.cpp
Normal file
71
upptst/Tuple/Tuple.cpp
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct NonVal {
|
||||
Tuple<int, double> h;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
Tuple<int, int, int, int> i4;
|
||||
DDUMP(sizeof(i4));
|
||||
|
||||
Vector<Tuple<int, String>> testv;
|
||||
testv.Add(MakeTuple(13, "Hello"));
|
||||
DDUMP(testv);
|
||||
|
||||
static Tuple<int, String> h[] = { { 1, "Ahoj" } };
|
||||
|
||||
DDUMP(h[0]);
|
||||
|
||||
Tuple<int, String> x;
|
||||
x.a = 171;
|
||||
x.b = "HHH";
|
||||
|
||||
DDUMP(x.Get<int>());
|
||||
DDUMP(x.Get<String>());
|
||||
|
||||
x.Get<0>() = 666;
|
||||
DDUMP(x.Get<int>());
|
||||
|
||||
x.Get<int>() = 777;
|
||||
DDUMP(x.Get<0>());
|
||||
|
||||
Tuple<int, Point, String> z;
|
||||
z.a = 0;
|
||||
z.b = Point(1, 2);
|
||||
z.c = "HHH";
|
||||
|
||||
DDUMP(z.c);
|
||||
|
||||
DDUMP(z.Get(0));
|
||||
DDUMP(z.Get(1));
|
||||
DDUMP(z.Get(2));
|
||||
|
||||
DDUMP(z.Get<0>());
|
||||
DDUMP(z.Get<1>());
|
||||
DDUMP(z.Get<2>());
|
||||
|
||||
DDUMP(z.GetArray());
|
||||
|
||||
{
|
||||
ValueArray h = z.GetArray();
|
||||
h.Set(1, Point(5, 6));
|
||||
z.SetArray(h);
|
||||
DDUMP(z);
|
||||
}
|
||||
|
||||
Tuple<NonVal, int> y;
|
||||
y.a.x = 5;
|
||||
|
||||
Tuple<int, int> it;
|
||||
it.a = 10;
|
||||
it.b = 11;
|
||||
Tuple<double, double> ft = it;
|
||||
DDUMP(ft.a / 7);
|
||||
DDUMP(ft.b);
|
||||
}
|
||||
9
upptst/Tuple/Tuple.upp
Normal file
9
upptst/Tuple/Tuple.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
Tuple.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "MT";
|
||||
|
||||
4
upptst/Tuple/init
Normal file
4
upptst/Tuple/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _Tuple_icpp_init_stub
|
||||
#define _Tuple_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue