boting ren / Mbed OS BLEClient_mbedDevConn
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers test_m2mresource.cpp Source File

test_m2mresource.cpp

00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include "CppUTest/TestHarness.h"
00017 #include "test_m2mresource.h"
00018 #include "CppUTest/MemoryLeakDetectorMallocMacros.h"
00019 #include "m2mbase_stub.h"
00020 #include "m2mresourceinstance_stub.h"
00021 #include "m2mobjectinstance_stub.h"
00022 #include "m2mtlvdeserializer_stub.h"
00023 #include "m2mreporthandler_stub.h"
00024 #include "m2mobject_stub.h"
00025 #include "common_stub.h"
00026 #include "m2mreporthandler.h"
00027 
00028 class TestReportObserver :  public M2MReportObserver{
00029 public :
00030     TestReportObserver() {}
00031     ~TestReportObserver() {}
00032     void observation_to_be_sent(m2m::Vector<uint16_t>,bool){ }
00033 };
00034 
00035 class Handler : public M2MObservationHandler {
00036 
00037 public:
00038 
00039     Handler(){}
00040     ~Handler(){}
00041     void observation_to_be_sent(M2MBase *, uint16_t,m2m::Vector<uint16_t>,bool){
00042         visited = true;
00043     }
00044     void send_delayed_response(M2MBase *){}
00045     void resource_to_be_deleted(M2MBase *){visited=true;}
00046     void remove_object(M2MBase *){visited = true;}
00047     void value_updated(M2MBase *,const String&){visited = true;}
00048 
00049     void clear() {visited = false;}
00050     bool visited;
00051 };
00052 
00053 Test_M2MResource::Test_M2MResource()
00054 {
00055     handler = new Handler();
00056     object = new M2MObject("name", "name");
00057     object_instance = new M2MObjectInstance(*object, "name", "type", "");
00058     resource = new M2MResource(*object_instance,
00059                                "name","resource_type",
00060                                M2MResourceInstance::INTEGER,false, "name");
00061 }
00062 
00063 Test_M2MResource::~Test_M2MResource()
00064 {
00065     delete object;
00066     delete object_instance;
00067     delete resource;
00068     delete handler;
00069     m2mtlvdeserializer_stub::clear();
00070 }
00071 
00072 void Test_M2MResource::test_static_resource()
00073 {
00074     u_int8_t value[] = {"value"};
00075     M2MResource *res = new M2MResource(*m2mobject_stub::inst,
00076                                        "name",
00077                                       "resource_type",
00078                                       M2MResourceInstance::INTEGER,
00079                                       value,
00080                                       (uint32_t)sizeof(value),"name");
00081 
00082     CHECK(res != NULL);
00083     delete res;
00084 
00085 }
00086 
00087 void Test_M2MResource::test_base_type()
00088 {
00089     m2mresourceinstance_stub::base_type = M2MBase::Resource;
00090     CHECK(M2MBase::Resource == resource->base_type());
00091 }
00092 
00093 void Test_M2MResource::test_muliptle_instances()
00094 {
00095     CHECK(false == resource->supports_multiple_instances());
00096 }
00097 
00098 void Test_M2MResource::test_handle_observation_attribute()
00099 {
00100     char *d = "s";
00101 
00102     m2mresourceinstance_stub::resource_type = M2MResourceInstance::INTEGER;
00103     CHECK(false == resource->handle_observation_attribute(d));
00104 
00105     m2mresourceinstance_stub::resource_type = M2MResourceInstance::FLOAT;
00106     CHECK(false == resource->handle_observation_attribute(d));
00107 
00108     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00109                                                                               "name",
00110                                                                               "type",
00111                                                                               M2MResourceInstance::INTEGER,
00112                                                                               0,
00113                                                                               "name",
00114                                                                               false);
00115 
00116     resource->add_resource_instance(res);
00117 
00118     TestReportObserver obs;
00119     m2mbase_stub::report = new M2MReportHandler(obs);
00120 
00121     m2mbase_stub::bool_value = true;
00122     CHECK(false == resource->handle_observation_attribute(d));
00123 
00124     resource->_resource_type = M2MResourceInstance::INTEGER;
00125     m2mreporthandler_stub::bool_return = true;
00126     CHECK(true == resource->handle_observation_attribute(d));
00127 
00128     m2mbase_stub::bool_value = false;
00129     CHECK(true == resource->handle_observation_attribute(d));
00130 
00131     delete m2mbase_stub::report;
00132     m2mbase_stub::report = NULL;
00133 }
00134 
00135 void Test_M2MResource::test_add_resource_instance()
00136 {
00137     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00138                                                                               "name",
00139                                                                               "type",
00140                                                                               M2MResourceInstance::INTEGER,
00141                                                                               0,
00142                                                                               "name",
00143                                                                               false);
00144     resource->add_resource_instance(res);
00145     CHECK(resource->_resource_instance_list.size() == 1);
00146 }
00147 
00148 void Test_M2MResource::test_remove_resource_instance()
00149 {
00150     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00151                                                                               "name",
00152                                                                               "type",
00153                                                                               M2MResourceInstance::STRING,
00154                                                                               0,
00155                                                                               "name",
00156                                                                               false);
00157     resource->_resource_instance_list.push_back(res);
00158     CHECK(resource->remove_resource_instance(0) == true);
00159 }
00160 
00161 void Test_M2MResource::test_resource_instance()
00162 {
00163     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00164                                                                               "name",
00165                                                                               "type",
00166                                                                               M2MResourceInstance::STRING,
00167                                                                               0,
00168                                                                               "name",
00169                                                                               false);
00170     resource->_resource_instance_list.push_back(res);
00171     CHECK(resource->resource_instance(0) != NULL);
00172 }
00173 
00174 void Test_M2MResource::test_resource_instances()
00175 {
00176     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00177                                                                               "name",
00178                                                                               "type",
00179                                                                               M2MResourceInstance::STRING,
00180                                                                               0,
00181                                                                               "name",
00182                                                                               false);
00183     resource->_resource_instance_list.push_back(res);
00184     M2MResourceInstanceList list = resource->resource_instances();
00185     CHECK(list.size() ==1);
00186 }
00187 
00188 void Test_M2MResource::test_resource_instance_count()
00189 {
00190     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00191                                                                               "name",
00192                                                                               "type",
00193                                                                               M2MResourceInstance::STRING,
00194                                                                               0,
00195                                                                               "name",
00196                                                                               false);
00197     resource->_resource_instance_list.push_back(res);
00198     CHECK(resource->resource_instance_count() ==1);
00199 }
00200 
00201 void Test_M2MResource::test_add_observation_level()
00202 {
00203     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00204                                                                               "name",
00205                                                                               "type",
00206                                                                               M2MResourceInstance::STRING,
00207                                                                               0,
00208                                                                               "name",
00209                                                                               false);
00210     resource->_resource_instance_list.push_back(res);
00211 
00212     M2MBase::Observation obs_level = M2MBase::R_Attribute;
00213 
00214     resource->add_observation_level(obs_level);
00215 }
00216 
00217 void Test_M2MResource::test_remove_observation_level()
00218 {
00219     M2MResourceInstance *res = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00220                                                                               "name",
00221                                                                               "type",
00222                                                                               M2MResourceInstance::STRING,
00223                                                                               0,
00224                                                                               "name",
00225                                                                               false);
00226     resource->_resource_instance_list.push_back(res);
00227 
00228     M2MBase::Observation obs_level = M2MBase::R_Attribute;
00229 
00230     resource->remove_observation_level(obs_level);
00231 }
00232 
00233 void Test_M2MResource::test_handle_get_request()
00234 {
00235     uint8_t value[] = {"name"};
00236     sn_coap_hdr_s *coap_header = (sn_coap_hdr_s *)malloc(sizeof(sn_coap_hdr_s));
00237     memset(coap_header, 0, sizeof(sn_coap_hdr_s));
00238 
00239     coap_header->uri_path_ptr = value;
00240     coap_header->uri_path_len = sizeof(value);
00241 
00242     coap_header->msg_code = COAP_MSG_CODE_REQUEST_GET;
00243 
00244     common_stub::int_value = 0;
00245     m2mbase_stub::string_value = "name";
00246 
00247     m2mbase_stub::operation = M2MBase::GET_ALLOWED;
00248     m2mbase_stub::uint8_value = 200;
00249 
00250     common_stub::coap_header = (sn_coap_hdr_ *)malloc(sizeof(sn_coap_hdr_));
00251     memset(common_stub::coap_header,0,sizeof(sn_coap_hdr_));
00252     common_stub::coap_header->options_list_ptr = (sn_coap_options_list_s*)malloc(sizeof(sn_coap_options_list_s));
00253 
00254     coap_header->token_ptr = (uint8_t*)malloc(sizeof(value));
00255     memcpy(coap_header->token_ptr, value, sizeof(value));
00256 
00257     coap_header->options_list_ptr = (sn_coap_options_list_s*)malloc(sizeof(sn_coap_options_list_s));
00258     coap_header->options_list_ptr->observe = 0;
00259 
00260     coap_header->content_format = sn_coap_content_format_e(110);
00261 
00262     m2mresourceinstance_stub::header = NULL;
00263 
00264     M2MResourceInstance *res_instance = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00265                                                                               "name",
00266                                                                               "res2",
00267                                                                               M2MResourceInstance::STRING,
00268                                                                               0,
00269                                                                               "name",
00270                                                                               false);
00271 
00272     M2MResourceInstance *res_instance_1 = new M2MResourceInstance(*m2mobjectinstance_stub::resource,
00273                                                                               "name",
00274                                                                               "res2",
00275                                                                               M2MResourceInstance::STRING,
00276                                                                               0,
00277                                                                               "name",
00278                                                                               false);
00279     CHECK(resource->handle_get_request(NULL,coap_header,handler) == NULL);
00280 
00281     resource->_has_multiple_instances = true;
00282     resource->add_resource_instance(res_instance);
00283     resource->add_resource_instance(res_instance_1);
00284 
00285     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00286 
00287 
00288     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00289 
00290     // Not OMA TLV or JSON
00291     common_stub::coap_header->content_format = sn_coap_content_format_e(-1);
00292     m2mbase_stub::uint8_value = 110;
00293     coap_header->content_format = sn_coap_content_format_e(-1);
00294 
00295     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00296 
00297     // OMA TLV
00298     m2mbase_stub::uint8_value = 99;
00299     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00300 
00301     // OMA JSON
00302     m2mbase_stub::uint8_value = 100;
00303     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00304 
00305     coap_header->options_list_ptr->observe = 0;
00306     m2mbase_stub::uint16_value = 0x1c1c;
00307     m2mbase_stub::bool_value = true;
00308 
00309     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00310 
00311     m2mbase_stub::uint16_value = 10;
00312     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00313 
00314     coap_header->options_list_ptr->observe = 0;
00315 
00316     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00317 
00318     coap_header->options_list_ptr->observe = 1;
00319     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00320 
00321     // Not observable
00322     m2mbase_stub::bool_value = false;
00323     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00324 
00325     m2mbase_stub::operation = M2MBase::NOT_ALLOWED;
00326     CHECK(resource->handle_get_request(NULL,coap_header,handler) != NULL);
00327 
00328     CHECK(resource->handle_get_request(NULL,NULL,handler) != NULL);
00329 
00330     if(coap_header->token_ptr) {
00331         free(coap_header->token_ptr);
00332         coap_header->token_ptr = NULL;
00333     }
00334     if(coap_header->options_list_ptr) {
00335         free(coap_header->options_list_ptr);
00336         coap_header->options_list_ptr = NULL;
00337     }
00338 
00339     if(common_stub::coap_header){
00340         if(common_stub::coap_header->options_list_ptr) {
00341             free(common_stub::coap_header->options_list_ptr);
00342             common_stub::coap_header->options_list_ptr = NULL;
00343         }
00344         free(common_stub::coap_header);
00345         common_stub::coap_header = NULL;
00346     }
00347     free(coap_header);
00348     coap_header = NULL;
00349 
00350     m2mbase_stub::clear();
00351     common_stub::clear();
00352 }
00353 
00354 void Test_M2MResource::test_handle_put_request()
00355 {
00356     uint8_t value[] = {"name"};
00357     bool execute_value_updated = false;
00358     sn_coap_hdr_s *coap_header = (sn_coap_hdr_s *)malloc(sizeof(sn_coap_hdr_s));
00359     TestReportObserver obs;
00360     m2mbase_stub::report = new M2MReportHandler(obs);
00361 
00362     memset(coap_header, 0, sizeof(sn_coap_hdr_s));
00363 
00364     coap_header->uri_path_ptr = value;
00365     coap_header->uri_path_len = sizeof(value);
00366 
00367     coap_header->msg_code = COAP_MSG_CODE_REQUEST_PUT;
00368 
00369     common_stub::int_value = 0;
00370     m2mbase_stub::string_value = "name";
00371 
00372     m2mbase_stub::operation = M2MBase::PUT_ALLOWED;
00373     m2mbase_stub::uint8_value = 200;
00374 
00375     common_stub::coap_header = (sn_coap_hdr_ *)malloc(sizeof(sn_coap_hdr_));
00376     memset(common_stub::coap_header,0,sizeof(sn_coap_hdr_));
00377 
00378     coap_header->payload_ptr = (uint8_t*)malloc(1);
00379 
00380     sn_coap_hdr_s *coap_response = NULL;
00381 
00382     m2mresourceinstance_stub::header = NULL;
00383 
00384     CHECK(resource->handle_put_request(NULL,coap_header,handler,execute_value_updated) == NULL);
00385 
00386     resource->_has_multiple_instances = true;
00387     m2mbase_stub::uint8_value = 99;
00388     coap_header->content_format = sn_coap_content_format_e(-1);
00389     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00390     CHECK( coap_response != NULL);
00391 
00392     m2mbase_stub::uint8_value = 0;
00393 
00394     coap_header->options_list_ptr = (sn_coap_options_list_s*)malloc(sizeof(sn_coap_options_list_s));
00395     coap_header->options_list_ptr->uri_query_ptr = value;
00396     coap_header->options_list_ptr->uri_query_len = sizeof(value);
00397 
00398     coap_header->content_format = sn_coap_content_format_e(99);
00399     m2mtlvdeserializer_stub::bool_value = true;
00400 
00401     m2mbase_stub::bool_value = false;
00402 
00403 
00404     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00405     CHECK( coap_response != NULL);
00406 
00407     free(coap_header->options_list_ptr);
00408     coap_header->options_list_ptr = NULL;
00409 
00410     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00411     CHECK( coap_response != NULL);
00412 
00413     m2mtlvdeserializer_stub::bool_value = false;
00414 
00415     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00416 
00417     CHECK( coap_response != NULL);
00418 
00419     m2mtlvdeserializer_stub::error = M2MTLVDeserializer::NotFound;
00420     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00421 
00422     CHECK( coap_response != NULL);
00423 
00424     m2mtlvdeserializer_stub::error = M2MTLVDeserializer::NotValid;
00425     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00426 
00427     CHECK( coap_response != NULL);
00428 
00429     m2mtlvdeserializer_stub::error = M2MTLVDeserializer::NotAllowed;
00430     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00431 
00432     CHECK( coap_response != NULL);
00433 
00434     coap_header->content_format = sn_coap_content_format_e(100);
00435 
00436     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00437 
00438     CHECK( coap_response != NULL);
00439 
00440     m2mbase_stub::bool_value = true;
00441 
00442     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00443 
00444     CHECK( coap_response != NULL);
00445 
00446     m2mbase_stub::operation = M2MBase::NOT_ALLOWED;
00447 
00448     coap_response = resource->handle_put_request(NULL,coap_header,handler,execute_value_updated);
00449 
00450     CHECK( coap_response != NULL);
00451 
00452     coap_response = resource->handle_put_request(NULL,NULL,handler,execute_value_updated);
00453 
00454     CHECK( coap_response != NULL);
00455 
00456     //free(coap_header->options_list_ptr);
00457     free(coap_header->payload_ptr);
00458     free(common_stub::coap_header);
00459     free(coap_header);
00460     delete m2mbase_stub::report;
00461     m2mbase_stub::report = NULL;
00462     m2mtlvdeserializer_stub::clear();
00463     common_stub::clear();
00464     m2mbase_stub::clear();
00465 }
00466 
00467 void Test_M2MResource::test_handle_post_request()
00468 {
00469     uint8_t value[] = {"name"};
00470     bool execute_value_updated = false;
00471     sn_coap_hdr_s *coap_header = (sn_coap_hdr_s *)malloc(sizeof(sn_coap_hdr_s));
00472     memset(coap_header, 0, sizeof(sn_coap_hdr_s));
00473 
00474     coap_header->uri_path_ptr = value;
00475     coap_header->uri_path_len = sizeof(value);
00476 
00477     coap_header->msg_code = COAP_MSG_CODE_REQUEST_POST;
00478 
00479     String *name = new String("name");
00480     common_stub::int_value = 0;
00481     m2mbase_stub::string_value = "name";
00482 
00483     m2mbase_stub::operation = M2MBase::POST_ALLOWED;
00484     m2mbase_stub::uint8_value = 200;
00485 
00486     common_stub::coap_header = (sn_coap_hdr_ *)malloc(sizeof(sn_coap_hdr_));
00487     memset(common_stub::coap_header,0,sizeof(sn_coap_hdr_));
00488 
00489     coap_header->payload_ptr = (uint8_t*)malloc(1);
00490 
00491     coap_header->options_list_ptr = (sn_coap_options_list_s*)malloc(sizeof(sn_coap_options_list_s));
00492     coap_header->options_list_ptr->uri_query_ptr = value;
00493     coap_header->options_list_ptr->uri_query_len = sizeof(value);
00494 
00495     coap_header->content_format = sn_coap_content_format_e(99);
00496 
00497 
00498     resource->_delayed_response = true;
00499     resource->_delayed_token = (uint8_t*)malloc(1);
00500     *resource->_delayed_token  = 2;
00501     coap_header->token_ptr = (uint8_t*)malloc(1);
00502     *coap_header->token_ptr = 1;
00503     coap_header->token_len = 1;
00504 
00505     m2mbase_stub::bool_value = false;
00506     m2mresourceinstance_stub::string_value = name;
00507 
00508     CHECK(resource->handle_post_request(NULL,coap_header,handler,execute_value_updated) != NULL);
00509 
00510     coap_header->content_format = sn_coap_content_format_e(0);
00511 
00512     CHECK(resource->handle_post_request(NULL,coap_header,handler,execute_value_updated) != NULL);
00513 
00514     m2mresourceinstance_stub::int_value = sizeof(value);
00515     m2mresourceinstance_stub::value = value;
00516 
00517     resource->_delayed_response = false;
00518     sn_coap_hdr_s *coap_response = resource->handle_post_request(NULL,coap_header,handler,execute_value_updated);
00519 
00520     CHECK(coap_response != NULL);
00521     free(coap_response->payload_ptr);
00522 
00523     m2mbase_stub::operation = M2MBase::NOT_ALLOWED;
00524     CHECK(resource->handle_post_request(NULL,coap_header,handler,execute_value_updated) != NULL);
00525 
00526     CHECK(resource->handle_post_request(NULL,NULL,handler,execute_value_updated) != NULL);
00527 
00528     free(coap_header->token_ptr);
00529     free(coap_header->options_list_ptr);
00530     free(coap_header->payload_ptr);
00531 
00532     delete name;
00533     free(coap_header);
00534     free(common_stub::coap_header);
00535 
00536     m2mbase_stub::clear();
00537     common_stub::clear();
00538 }
00539 
00540 void Test_M2MResource::test_notification_update()
00541 {
00542     TestReportObserver obs;
00543     m2mbase_stub::report = new M2MReportHandler(obs);
00544     m2mbase_stub::bool_value = true;
00545 
00546     resource->notification_update();
00547 
00548     delete m2mbase_stub::report;
00549     m2mbase_stub::report = NULL;
00550 }
00551 
00552 void Test_M2MResource::test_set_delayed_response()
00553 {
00554     resource->set_delayed_response(true);
00555     CHECK(resource->_delayed_response == true);
00556 }
00557 
00558 void Test_M2MResource::test_send_delayed_post_response()
00559 {
00560     resource->_delayed_response = true;
00561     m2mbase_stub::observe = handler;
00562     CHECK(resource->send_delayed_post_response() == true);
00563 }
00564 
00565 void Test_M2MResource::test_get_delayed_token()
00566 {
00567     uint8_t value[] = {"1"};
00568     uint8_t *token = NULL;
00569     uint8_t token_len = 0;
00570     resource->_delayed_token_len = 1;
00571     resource->_delayed_token = (uint8_t*)malloc(sizeof(1));
00572     memcpy(resource->_delayed_token,value,1);
00573     resource->get_delayed_token(token,token_len);
00574     CHECK(token != NULL);
00575     free(token);
00576 
00577     token = NULL;
00578     token = (uint8_t*)malloc(1);
00579     token_len = 1;
00580     resource->get_delayed_token(token,token_len);
00581     CHECK(token != NULL);
00582     free(token);
00583 
00584 }
00585 
00586 void Test_M2MResource::test_delayed_response()
00587 {
00588     resource->_delayed_response = false;
00589     CHECK(resource->delayed_response() == false);
00590 }
00591 
00592 void Test_M2MResource::test_execute_params()
00593 {
00594     M2MResource::M2MExecuteParameter *params = new M2MResource::M2MExecuteParameter();
00595     CHECK(params->get_argument_value() == NULL);
00596     CHECK(params->get_argument_value_length() == 0);
00597     CHECK(params->get_argument_object_name() == "");
00598     CHECK(params->get_argument_resource_name() == "");
00599     CHECK(params->get_argument_object_instance_id() == 0);
00600 
00601     uint8_t value[] = {"test"};
00602     int length = sizeof(value);
00603     params->_value = (uint8_t*)malloc(length);
00604     memcpy(params->_value,value,length);
00605     params->_value_length = length;
00606     params->_object_name = "object";
00607     params->_resource_name = "resource";
00608     params->_object_instance_id = 0;
00609     CHECK(params->_value == params->get_argument_value());
00610     CHECK(params->_value_length == params->get_argument_value_length());
00611     CHECK(params->_resource_name == params->get_argument_resource_name());
00612     CHECK(params->_object_name == params->get_argument_object_name());
00613     CHECK(params->_object_instance_id == params->get_argument_object_instance_id());
00614 
00615     delete params;
00616 }
00617 
00618 void Test_M2MResource::test_ctor()
00619 {
00620     M2MResource* res = new M2MResource(*m2mobject_stub::inst,&params,M2MResourceInstance::INTEGER,0);
00621     delete res;
00622 }
00623 
00624 void Test_M2MResource::test_get_parent_object_instance()
00625 {
00626     M2MResource* res = new M2MResource(*m2mobject_stub::inst,&params,M2MResourceInstance::INTEGER,0);
00627 
00628     // Only for the code coverage
00629     res->get_parent_object_instance();
00630     delete res;
00631 
00632 }