Check creation of maximal count of cynara requests 85/28985/7
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 17 Oct 2014 18:27:59 +0000 (20:27 +0200)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Thu, 30 Oct 2014 12:29:41 +0000 (13:29 +0100)
Request creating function should return CYNARA_API_MAX_PENDING_REQUESTS,
when maximal number of possible requests (2^16) is created.

Change-Id: Icdbbf6e6377a73892ccd8f4affa31756f6161414

tests/cynara-tests/test_cases_async.cpp

index 066dcc1985eedffba72516a484f0e193fc67ce50..256b1585fd8a757ee0e28f543ed6c48bc2f669da 100644 (file)
 
 #include <cynara-client-async.h>
 
+#include <cstdint>
+
+using namespace CynaraTestClientAsync;
+
 void tca01_initialize_func()
 {
-    CynaraTestClientAsync::Client client;
+    Client client;
 }
 
 void tca02_empty_cache_miss_func()
 {
     std::string testNo("02");
-    CynaraTestClientAsync::Client client;
+    Client client;
 
     client.checkCache({testNo}, CYNARA_API_CACHE_MISS);
     client.checkCache({testNo}, CYNARA_API_CACHE_MISS);
 }
 
+void tca03_create_max_requests_func()
+{
+    std::string testNo("03");
+    cynara_check_id id;
+    RequestEntity callbackData = {RequestFunction(), 0, CYNARA_CALL_CAUSE_FINISH};
+
+    Client client;
+
+    for (auto i = 0; i <= UINT16_MAX; ++i) {
+        client.createRequest({testNo, i}, id, callbackData, CYNARA_API_SUCCESS);
+        client.assertStatus(READWRITE);
+    }
+
+    client.createRequest({testNo}, id, callbackData, CYNARA_API_MAX_PENDING_REQUESTS);
+    client.assertStatus(READWRITE);
+}
+
 RUNNER_TEST_GROUP_INIT(cynara_async_tests)
 
 RUN_CYNARA_TEST(tca01_initialize)
 RUN_CYNARA_TEST(tca02_empty_cache_miss)
+RUN_CYNARA_TEST(tca03_create_max_requests)