diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/itoserver.cpp | 8 | ||||
-rw-r--r-- | src/tests/multiserver.cpp | 31 | ||||
-rw-r--r-- | src/tests/rot13.cpp | 8 |
3 files changed, 31 insertions, 16 deletions
diff --git a/src/tests/itoserver.cpp b/src/tests/itoserver.cpp index cf5f6d1..5f6e4fa 100644 --- a/src/tests/itoserver.cpp +++ b/src/tests/itoserver.cpp | |||
@@ -33,8 +33,12 @@ public: | |||
33 | virtual void onNewData( Bu::Client *pClient ) | 33 | virtual void onNewData( Bu::Client *pClient ) |
34 | { | 34 | { |
35 | TRACE(); | 35 | TRACE(); |
36 | pClient->write( pClient->getInput().getStr(), pClient->getInputSize() ); | 36 | char buf[1024]; |
37 | pClient->seek( pClient->getInputSize() ); | 37 | while( pClient->hasInput() ) |
38 | { | ||
39 | int iAmnt = pClient->read( buf, 1024 ); | ||
40 | pClient->write( buf, iAmnt ); | ||
41 | } | ||
38 | } | 42 | } |
39 | }; | 43 | }; |
40 | 44 | ||
diff --git a/src/tests/multiserver.cpp b/src/tests/multiserver.cpp index 22ce94b..85971b5 100644 --- a/src/tests/multiserver.cpp +++ b/src/tests/multiserver.cpp | |||
@@ -19,8 +19,12 @@ public: | |||
19 | 19 | ||
20 | virtual void onNewData( Bu::Client *pClient ) | 20 | virtual void onNewData( Bu::Client *pClient ) |
21 | { | 21 | { |
22 | pClient->write( pClient->getInput() ); | 22 | char buf[1024]; |
23 | pClient->seek( pClient->getInputSize() ); | 23 | while( pClient->hasInput() ) |
24 | { | ||
25 | int iAmnt = pClient->read( buf, 1024 ); | ||
26 | pClient->write( buf, iAmnt ); | ||
27 | } | ||
24 | } | 28 | } |
25 | }; | 29 | }; |
26 | 30 | ||
@@ -34,20 +38,23 @@ public: | |||
34 | 38 | ||
35 | virtual void onNewData( Bu::Client *pClient ) | 39 | virtual void onNewData( Bu::Client *pClient ) |
36 | { | 40 | { |
37 | Bu::FString sTmp = pClient->getInput(); | 41 | while( pClient->hasInput() ) |
38 | for( int j = 0; j < sTmp.getSize(); j++ ) | ||
39 | { | 42 | { |
40 | if( sTmp[j] >= 'a' && sTmp[j] <= 'z' ) | 43 | char sTmp[1024]; |
41 | { | 44 | int iAmnt = pClient->read( sTmp, 1024 ); |
42 | sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a'; | 45 | for( int j = 0; j < iAmnt; j++ ) |
43 | } | ||
44 | else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' ) | ||
45 | { | 46 | { |
46 | sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A'; | 47 | if( sTmp[j] >= 'a' && sTmp[j] <= 'z' ) |
48 | { | ||
49 | sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a'; | ||
50 | } | ||
51 | else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' ) | ||
52 | { | ||
53 | sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A'; | ||
54 | } | ||
47 | } | 55 | } |
56 | pClient->write( sTmp, iAmnt ); | ||
48 | } | 57 | } |
49 | pClient->write( sTmp ); | ||
50 | pClient->seek( pClient->getInputSize() ); | ||
51 | } | 58 | } |
52 | }; | 59 | }; |
53 | 60 | ||
diff --git a/src/tests/rot13.cpp b/src/tests/rot13.cpp index 2326888..03ba385 100644 --- a/src/tests/rot13.cpp +++ b/src/tests/rot13.cpp | |||
@@ -67,8 +67,12 @@ public: | |||
67 | 67 | ||
68 | void onNewData( Bu::Client *pClient ) | 68 | void onNewData( Bu::Client *pClient ) |
69 | { | 69 | { |
70 | pClient->write( pClient->getInput().getStr(), pClient->getInputSize() ); | 70 | char buf[1024]; |
71 | pClient->seek( pClient->getInputSize() ); | 71 | while( pClient->hasInput() ) |
72 | { | ||
73 | int iAmnt = pClient->read( buf, 1024 ); | ||
74 | pClient->write( buf, iAmnt ); | ||
75 | } | ||
72 | } | 76 | } |
73 | }; | 77 | }; |
74 | 78 | ||