diff options
Diffstat (limited to 'test/testclnt.lua')
| -rw-r--r-- | test/testclnt.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua index 38dc19a..cdd2c08 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
| @@ -438,6 +438,25 @@ function rebind_test() | |||
| 438 | end | 438 | end |
| 439 | 439 | ||
| 440 | ------------------------------------------------------------------------ | 440 | ------------------------------------------------------------------------ |
| 441 | function getstats_test() | ||
| 442 | reconnect() | ||
| 443 | local t = 0 | ||
| 444 | for i = 1, 25 do | ||
| 445 | local c = math.random(1, 100) | ||
| 446 | remote (string.format ([[ | ||
| 447 | str = data:receive(%d) | ||
| 448 | data:send(str) | ||
| 449 | ]], c)) | ||
| 450 | c:send(string.rep("a", c)) | ||
| 451 | c:receive(c) | ||
| 452 | local r, s, a = c:getstats() | ||
| 453 | assert(r == t, "received count failed") | ||
| 454 | assert(s == t, "sent count failed") | ||
| 455 | end | ||
| 456 | print("ok") | ||
| 457 | end | ||
| 458 | |||
| 459 | ------------------------------------------------------------------------ | ||
| 441 | test("method registration") | 460 | test("method registration") |
| 442 | test_methods(socket.tcp(), { | 461 | test_methods(socket.tcp(), { |
| 443 | "accept", | 462 | "accept", |
| @@ -499,6 +518,9 @@ test("accept function: ") | |||
| 499 | accept_timeout() | 518 | accept_timeout() |
| 500 | accept_errors() | 519 | accept_errors() |
| 501 | 520 | ||
| 521 | test("getstats test") | ||
| 522 | getstats_test() | ||
| 523 | |||
| 502 | test("character line") | 524 | test("character line") |
| 503 | test_asciiline(1) | 525 | test_asciiline(1) |
| 504 | test_asciiline(17) | 526 | test_asciiline(17) |
