mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.autotest: LocalProcess
git-svn-id: svn://ultimatepp.org/upp/trunk@8064 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4eed8f708b
commit
cbf9f3c4b6
3 changed files with 56 additions and 0 deletions
43
autotest/LocalProcess/LocalProcess.cpp
Normal file
43
autotest/LocalProcess/LocalProcess.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
if(CommandLine().GetCount() && CommandLine()[0] == "localprocess") {
|
||||
int ii = 0;
|
||||
for(;;) {
|
||||
int c = getchar();
|
||||
if(c == 'Q')
|
||||
Exit(1);
|
||||
Cout() << AsString(c) << ':' << (char)c << ':' << ii++ << ' ';
|
||||
Cerr() << " ERROR" << (char)c << ii++;
|
||||
}
|
||||
}
|
||||
|
||||
LocalProcess p;
|
||||
ASSERT(p.Start2(GetExeFilePath() + " localprocess"));
|
||||
ASSERT(p.IsRunning());
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
p.Write(String(i + 'A', 1));
|
||||
p.Write("Q");
|
||||
|
||||
String e, o, err, out;
|
||||
while(p.Read2(o, e)) {
|
||||
err << e;
|
||||
out << o;
|
||||
}
|
||||
|
||||
DUMP(err);
|
||||
DUMP(out);
|
||||
DUMP(p.IsRunning());
|
||||
|
||||
ASSERT(out == "65:A:0 66:B:2 67:C:4 68:D:6 69:E:8 70:F:10 71:G:12 72:H:14 73:I:16 74:J:18 ");
|
||||
ASSERT(err == " ERRORA1 ERRORB3 ERRORC5 ERRORD7 ERRORE9 ERRORF11 ERRORG13 ERRORH15 ERRORI17 ERRORJ19");
|
||||
ASSERT(!p.IsRunning());
|
||||
|
||||
LOG("============= OK");
|
||||
}
|
||||
9
autotest/LocalProcess/LocalProcess.upp
Normal file
9
autotest/LocalProcess/LocalProcess.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
LocalProcess.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2";
|
||||
|
||||
4
autotest/LocalProcess/init
Normal file
4
autotest/LocalProcess/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _LocalProcess_icpp_init_stub
|
||||
#define _LocalProcess_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue