Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
test_athandler.cpp
00001 /* 00002 * Copyright (c) 2018, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #include "CppUTest/TestHarness.h" 00018 #include "test_athandler.h" 00019 #include <string.h> 00020 #include "AT_CellularNetwork.h" 00021 #include "EventQueue.h" 00022 #include "ATHandler.h" 00023 #include "AT_CellularStack.h" 00024 #include "FileHandle_stub.h" 00025 #include "CellularLog.h" 00026 #include "mbed_poll_stub.h" 00027 00028 #include "Timer_stub.h" 00029 00030 using namespace mbed; 00031 using namespace events; 00032 00033 void urc_callback() 00034 { 00035 } 00036 00037 Test_ATHandler::Test_ATHandler() 00038 { 00039 00040 } 00041 00042 Test_ATHandler::~Test_ATHandler() 00043 { 00044 } 00045 00046 void Test_ATHandler::test_ATHandler_constructor() 00047 { 00048 EventQueue que; 00049 FileHandle_stub fh1; 00050 00051 ATHandler *at = new ATHandler(&fh1, que, 0, ","); 00052 00053 delete at; 00054 00055 at = new ATHandler(&fh1, que, 0, NULL); 00056 00057 delete at; 00058 } 00059 00060 void Test_ATHandler::test_ATHandler_get_file_handle() 00061 { 00062 EventQueue que; 00063 FileHandle_stub fh1; 00064 00065 ATHandler at(&fh1, que, 0, ","); 00066 CHECK_EQUAL(&fh1, at.get_file_handle()); 00067 } 00068 00069 void Test_ATHandler::test_ATHandler_set_file_handle() 00070 { 00071 EventQueue que; 00072 FileHandle_stub fh1, fh2; 00073 00074 ATHandler at(&fh1, que, 0, ","); 00075 00076 at.set_file_handle(&fh2); 00077 } 00078 00079 void Test_ATHandler::test_ATHandler_lock() 00080 { 00081 EventQueue que; 00082 FileHandle_stub fh1; 00083 00084 ATHandler at(&fh1, que, 0, ","); 00085 00086 at.lock(); 00087 } 00088 00089 void Test_ATHandler::test_ATHandler_unlock() 00090 { 00091 EventQueue que; 00092 FileHandle_stub fh1; 00093 00094 ATHandler at(&fh1, que, 0, ","); 00095 filehandle_stub_short_value_counter = 1; 00096 fh1.short_value = POLLIN; 00097 at.unlock(); 00098 } 00099 00100 void Test_ATHandler::test_ATHandler_unlock_return_error() 00101 { 00102 EventQueue que; 00103 FileHandle_stub fh1; 00104 00105 ATHandler at(&fh1, que, 0, ","); 00106 CHECK(NSAPI_ERROR_OK == at.unlock_return_error()); 00107 } 00108 00109 void Test_ATHandler::test_ATHandler_set_urc_handler() 00110 { 00111 EventQueue que; 00112 FileHandle_stub fh1; 00113 00114 ATHandler at(&fh1, que, 0, ","); 00115 const char ch[] = "testtesttesttest"; 00116 at.set_urc_handler(ch, &urc_callback); 00117 } 00118 00119 void Test_ATHandler::test_ATHandler_get_last_error() 00120 { 00121 EventQueue que; 00122 FileHandle_stub fh1; 00123 00124 ATHandler at(&fh1, que, 0, ","); 00125 CHECK(NSAPI_ERROR_OK == at.get_last_error()); 00126 } 00127 00128 void Test_ATHandler::test_ATHandler_get_last_device_error() 00129 { 00130 EventQueue que; 00131 FileHandle_stub fh1; 00132 00133 ATHandler at(&fh1, que, 0, ","); 00134 CHECK(0 == at.get_last_device_error().errCode); 00135 } 00136 00137 void Test_ATHandler::test_ATHandler_inc_ref_count() 00138 { 00139 EventQueue que; 00140 FileHandle_stub fh1; 00141 00142 ATHandler at(&fh1, que, 0, ","); 00143 at.inc_ref_count(); 00144 } 00145 00146 void Test_ATHandler::test_ATHandler_dec_ref_count() 00147 { 00148 EventQueue que; 00149 FileHandle_stub fh1; 00150 00151 ATHandler at(&fh1, que, 0, ","); 00152 at.dec_ref_count(); 00153 } 00154 00155 void Test_ATHandler::test_ATHandler_get_ref_count() 00156 { 00157 EventQueue que; 00158 FileHandle_stub fh1; 00159 00160 ATHandler at(&fh1, que, 0, ","); 00161 CHECK(1 == at.get_ref_count()); 00162 00163 at.inc_ref_count(); 00164 CHECK(2 == at.get_ref_count()); 00165 00166 at.inc_ref_count(); 00167 CHECK(3 == at.get_ref_count()); 00168 00169 at.dec_ref_count(); 00170 at.dec_ref_count(); 00171 CHECK(1 == at.get_ref_count()); 00172 } 00173 00174 void Test_ATHandler::test_ATHandler_set_at_timeout() 00175 { 00176 EventQueue que; 00177 FileHandle_stub fh1; 00178 00179 ATHandler at(&fh1, que, 0, ","); 00180 at.set_at_timeout(8); 00181 00182 at.set_at_timeout(80, true); 00183 } 00184 00185 void Test_ATHandler::test_ATHandler_restore_at_timeout() 00186 { 00187 EventQueue que; 00188 FileHandle_stub fh1; 00189 00190 ATHandler at(&fh1, que, 0, ","); 00191 at.set_at_timeout(80, true); 00192 at.set_at_timeout(800); 00193 at.restore_at_timeout(); 00194 } 00195 00196 void Test_ATHandler::test_ATHandler_clear_error() 00197 { 00198 EventQueue que; 00199 FileHandle_stub fh1; 00200 00201 ATHandler at(&fh1, que, 0, ","); 00202 at.clear_error(); 00203 } 00204 00205 void Test_ATHandler::test_ATHandler_process_oob() 00206 { 00207 EventQueue que; 00208 FileHandle_stub fh1; 00209 00210 ATHandler at(&fh1, que, 0, ","); 00211 filehandle_stub_short_value_counter = 1; 00212 fh1.short_value = POLLIN; 00213 at.set_urc_handler("s", &urc_callback); 00214 at.process_oob(); 00215 00216 filehandle_stub_short_value_counter = 2; 00217 at.process_oob(); 00218 00219 //at.fill_buffer(); 00220 uint8_t buf[5]; 00221 at.clear_error(); 00222 char table[] = "ssssssssssssssssssssssssssssssss\0"; 00223 filehandle_stub_table = table; 00224 filehandle_stub_table_pos = 0; 00225 at.read_bytes(buf, 5); 00226 00227 filehandle_stub_short_value_counter = 2; 00228 at.process_oob(); 00229 00230 at.clear_error(); 00231 timer_stub_value = 0; 00232 filehandle_stub_table_pos = 0; 00233 at.read_bytes(buf, 5); 00234 00235 filehandle_stub_short_value_counter = 1; 00236 at.process_oob(); 00237 00238 char table2[4]; 00239 table2[0] = '\r'; 00240 table2[1] = '\r'; 00241 table2[2] = '\n'; 00242 table2[3] = 0; 00243 filehandle_stub_table = table2; 00244 00245 at.clear_error(); 00246 timer_stub_value = 0; 00247 filehandle_stub_table_pos = 0; 00248 at.read_bytes(buf, 1); 00249 00250 filehandle_stub_short_value_counter = 1; 00251 at.process_oob(); 00252 00253 00254 filehandle_stub_table = table; 00255 00256 00257 filehandle_stub_short_value_counter = 0; 00258 filehandle_stub_table_pos = 0; 00259 filehandle_stub_table = NULL; 00260 } 00261 00262 void Test_ATHandler::test_ATHandler_set_filehandle_sigio() 00263 { 00264 EventQueue que; 00265 FileHandle_stub fh1; 00266 00267 ATHandler at(&fh1, que, 0, ","); 00268 at.set_filehandle_sigio(); 00269 } 00270 00271 void Test_ATHandler::test_ATHandler_flush() 00272 { 00273 EventQueue que; 00274 FileHandle_stub fh1; 00275 00276 ATHandler at(&fh1, que, 0, ","); 00277 filehandle_stub_short_value_counter = 1; 00278 fh1.short_value = POLLIN; 00279 at.flush(); 00280 } 00281 00282 void Test_ATHandler::test_ATHandler_cmd_start() 00283 { 00284 EventQueue que; 00285 FileHandle_stub fh1; 00286 00287 ATHandler at(&fh1, que, 0, ","); 00288 mbed_poll_stub::revents_value = POLLOUT; 00289 mbed_poll_stub::int_value = 1; 00290 fh1.size_value = 3; 00291 at.cmd_start("s"); 00292 mbed_poll_stub::revents_value = POLLIN; 00293 mbed_poll_stub::int_value = 0; 00294 00295 at.cmd_start("s"); 00296 00297 at.cmd_start("s"); 00298 } 00299 00300 void Test_ATHandler::test_ATHandler_write_int() 00301 { 00302 EventQueue que; 00303 FileHandle_stub fh1; 00304 00305 ATHandler at(&fh1, que, 0, ","); 00306 fh1.size_value = -1; 00307 at.write_int(4); 00308 00309 at.clear_error(); 00310 mbed_poll_stub::revents_value = POLLOUT; 00311 mbed_poll_stub::int_value = 1; 00312 fh1.size_value = 6; 00313 at.write_int(4); 00314 00315 at.write_int(2147483647); 00316 00317 at.write_int(2147483647+1); 00318 00319 // at.at_error(0, DeviceErrorType(0)); 00320 // at.write_int(4); 00321 } 00322 00323 void Test_ATHandler::test_ATHandler_write_string() 00324 { 00325 EventQueue que; 00326 FileHandle_stub fh1; 00327 00328 ATHandler at(&fh1, que, 0, ","); 00329 at.write_string("help"); 00330 CHECK(NSAPI_ERROR_DEVICE_ERROR == at.get_last_error()); 00331 00332 at.clear_error(); 00333 mbed_poll_stub::revents_value = POLLOUT; 00334 mbed_poll_stub::int_value = 1; 00335 fh1.size_value = -1; 00336 at.cmd_start("s"); 00337 at.write_string("help", true); 00338 CHECK(NSAPI_ERROR_DEVICE_ERROR == at.get_last_error()); 00339 00340 at.clear_error(); 00341 mbed_poll_stub::revents_value = POLLOUT; 00342 mbed_poll_stub::int_value = 1; 00343 fh1.size_value = -1; 00344 at.write_string("help", true); 00345 CHECK(NSAPI_ERROR_DEVICE_ERROR == at.get_last_error()); 00346 00347 at.clear_error(); 00348 mbed_poll_stub::revents_value = POLLOUT; 00349 mbed_poll_stub::int_value = 1; 00350 fh1.size_value = 7; 00351 at.write_string("help", true); 00352 CHECK(NSAPI_ERROR_OK == at.get_last_error()); 00353 } 00354 00355 void Test_ATHandler::test_ATHandler_cmd_stop() 00356 { 00357 EventQueue que; 00358 FileHandle_stub fh1; 00359 00360 ATHandler at(&fh1, que, 0, ","); 00361 fh1.size_value = -1; 00362 at.cmd_stop(); 00363 00364 at.write_string("help", true); 00365 00366 at.cmd_stop(); 00367 CHECK(NSAPI_ERROR_DEVICE_ERROR == at.get_last_error()); 00368 } 00369 00370 void Test_ATHandler::test_ATHandler_write_bytes() 00371 { 00372 EventQueue que; 00373 FileHandle_stub fh1; 00374 00375 ATHandler at(&fh1, que, 0, ","); 00376 fh1.size_value = -1; 00377 uint8_t data[] = "data"; 00378 at.write_bytes(data, 4); 00379 00380 at.write_bytes(data, 4); 00381 CHECK(NSAPI_ERROR_DEVICE_ERROR == at.get_last_error()); 00382 } 00383 00384 void Test_ATHandler::test_ATHandler_set_stop_tag() 00385 { 00386 EventQueue que; 00387 FileHandle_stub fh1; 00388 00389 ATHandler at(&fh1, que, 0, ","); 00390 at.set_stop_tag("s"); 00391 } 00392 00393 void Test_ATHandler::test_ATHandler_set_delimiter() 00394 { 00395 EventQueue que; 00396 FileHandle_stub fh1; 00397 00398 ATHandler at(&fh1, que, 0, ","); 00399 at.set_delimiter('+'); 00400 } 00401 00402 void Test_ATHandler::test_ATHandler_skip_param() 00403 { 00404 EventQueue que; 00405 FileHandle_stub fh1; 00406 00407 ATHandler at(&fh1, que, 0, ","); 00408 at.skip_param(); 00409 00410 char table[] = "ssssssssssssssssssssssssssssOK\r\n\0"; 00411 filehandle_stub_table = table; 00412 filehandle_stub_table_pos = 0; 00413 00414 at.flush(); 00415 at.clear_error(); 00416 at.resp_start(); 00417 at.skip_param(); 00418 CHECK(at.get_last_error() == NSAPI_ERROR_DEVICE_ERROR ); 00419 00420 char table1[] = "ss,sssssssssssss,sssssssssssOK\r\n\0"; 00421 filehandle_stub_table = table1; 00422 filehandle_stub_table_pos = 0; 00423 00424 at.flush(); 00425 at.clear_error(); 00426 at.resp_start(); 00427 at.skip_param(); 00428 00429 char table2[] = "sssOK\r\n\0"; 00430 filehandle_stub_table = table2; 00431 filehandle_stub_table_pos = 0; 00432 00433 at.flush(); 00434 at.clear_error(); 00435 at.resp_start(); 00436 at.skip_param(); 00437 00438 char table3[] = "sssssssOK\nssss\0"; 00439 filehandle_stub_table = table3; 00440 filehandle_stub_table_pos = 0; 00441 00442 //Need to create a new instance because stop tag already found 00443 ATHandler at2(&fh1, que, 0, ","); 00444 at2.flush(); 00445 at2.clear_error(); 00446 at2.resp_start(); 00447 at2.skip_param(); 00448 00449 at2.skip_param(4, 3); 00450 00451 filehandle_stub_table = table3; 00452 filehandle_stub_table_pos = 0; 00453 00454 at2.flush(); 00455 at2.clear_error(); 00456 at2.resp_start(); 00457 at2.skip_param(4, 3); 00458 00459 filehandle_stub_table = table3; 00460 filehandle_stub_table_pos = 0; 00461 00462 at2.flush(); 00463 at2.clear_error(); 00464 at2.resp_start(); 00465 at2.skip_param(24, 17); 00466 } 00467 00468 void Test_ATHandler::test_ATHandler_read_bytes() 00469 { 00470 EventQueue que; 00471 FileHandle_stub fh1; 00472 00473 ATHandler at(&fh1, que, 0, ","); 00474 uint8_t buf[5]; 00475 CHECK(-1 == at.read_bytes(buf, 25)); 00476 00477 CHECK(-1 == at.read_bytes(buf, 5)); 00478 00479 char table[] = "ssssssssssssssssssssssssssssOK\r\n\0"; 00480 filehandle_stub_table = table; 00481 filehandle_stub_table_pos = 0; 00482 mbed_poll_stub::revents_value = POLLIN; 00483 mbed_poll_stub::int_value = strlen(table); 00484 00485 00486 at.clear_error(); 00487 CHECK(5 == at.read_bytes(buf, 5)); 00488 } 00489 00490 void Test_ATHandler::test_ATHandler_read_string() 00491 { 00492 EventQueue que; 00493 FileHandle_stub fh1; 00494 00495 ATHandler at(&fh1, que, 0, ","); 00496 00497 at.clear_error(); 00498 char table[] = "\"s,\"OK\r\n\0"; 00499 filehandle_stub_table = table; 00500 filehandle_stub_table_pos = 0; 00501 mbed_poll_stub::revents_value = POLLIN; 00502 mbed_poll_stub::int_value = strlen(table); 00503 00504 char buf[5]; 00505 uint8_t buf2[5]; 00506 at.resp_start(); 00507 at.read_bytes(buf2, 5); 00508 CHECK(-1 == at.read_string(buf, 15)); 00509 at.flush(); 00510 at.clear_error(); 00511 00512 filehandle_stub_table = table; 00513 filehandle_stub_table_pos = 0; 00514 00515 at.resp_start(); 00516 at.read_bytes(buf2, 1); 00517 CHECK(1 == at.read_string(buf, 5, true)); 00518 at.flush(); 00519 at.clear_error(); 00520 00521 char table2[] = "\"s\"OK\r\n\0"; 00522 filehandle_stub_table = table2; 00523 filehandle_stub_table_pos = 0; 00524 mbed_poll_stub::revents_value = POLLIN; 00525 mbed_poll_stub::int_value = strlen(table2); 00526 00527 at.resp_start(); 00528 at.read_bytes(buf2, 1); 00529 CHECK(1 == at.read_string(buf, 5, true)); 00530 at.flush(); 00531 at.clear_error(); 00532 00533 char table3[] = "sss\rsss\0"; 00534 filehandle_stub_table = table3; 00535 filehandle_stub_table_pos = 0; 00536 mbed_poll_stub::revents_value = POLLIN; 00537 mbed_poll_stub::int_value = strlen(table); 00538 00539 at.resp_start("s"); 00540 at.read_string(buf, 5, true); 00541 at.flush(); 00542 at.clear_error(); 00543 00544 char table4[] = "\"s\"\0"; 00545 filehandle_stub_table = table4; 00546 filehandle_stub_table_pos = 0; 00547 mbed_poll_stub::revents_value = POLLIN; 00548 mbed_poll_stub::int_value = strlen(table); 00549 00550 at.resp_start("s"); 00551 at.read_string(buf, 5, true); 00552 00553 filehandle_stub_table = NULL; 00554 filehandle_stub_table_pos = 0; 00555 mbed_poll_stub::revents_value = POLLOUT; 00556 mbed_poll_stub::int_value = 0; 00557 } 00558 00559 void Test_ATHandler::test_ATHandler_read_int() 00560 { 00561 EventQueue que; 00562 FileHandle_stub fh1; 00563 00564 ATHandler at(&fh1, que, 0, ","); 00565 00566 int32_t ret= at.read_int(); 00567 CHECK(-1 == ret); 00568 at.clear_error(); 00569 00570 char table[] = "\",\"OK\r\n\0"; 00571 filehandle_stub_table = table; 00572 filehandle_stub_table_pos = 0; 00573 mbed_poll_stub::revents_value = POLLIN; 00574 mbed_poll_stub::int_value = strlen(table); 00575 00576 at.resp_start(); 00577 00578 ret= at.read_int(); 00579 CHECK(-1 == ret); 00580 at.flush(); 00581 at.clear_error(); 00582 00583 char table2[] = "\"2,\"OK\r\n\0"; 00584 filehandle_stub_table = table2; 00585 filehandle_stub_table_pos = 0; 00586 mbed_poll_stub::revents_value = POLLIN; 00587 mbed_poll_stub::int_value = strlen(table2); 00588 00589 at.resp_start(); 00590 00591 ret= at.read_int(); 00592 CHECK(2 == ret); 00593 00594 } 00595 00596 void Test_ATHandler::test_ATHandler_resp_start() 00597 { 00598 EventQueue que; 00599 FileHandle_stub fh1; 00600 00601 filehandle_stub_table = NULL; 00602 filehandle_stub_table_pos = 0; 00603 00604 ATHandler at(&fh1, que, 0, ","); 00605 at.resp_start(); 00606 at.resp_start(); 00607 00608 char table2[] = "\"2,\"OK\r\n\0"; 00609 filehandle_stub_table = table2; 00610 filehandle_stub_table_pos = 0; 00611 00612 at.flush(); 00613 at.clear_error(); 00614 at.resp_start("ssssaaaassssaaaassss"); //too long prefix 00615 00616 char table3[] = "+CME ERROR: 108\0"; 00617 filehandle_stub_table = table3; 00618 filehandle_stub_table_pos = 0; 00619 00620 at.flush(); 00621 at.clear_error(); 00622 at.resp_start(); 00623 00624 filehandle_stub_table_pos = 0; 00625 00626 at.flush(); 00627 at.clear_error(); 00628 at.resp_start(); 00629 00630 char table4[] = "+CMS ERROR: 6\0"; 00631 filehandle_stub_table = table4; 00632 filehandle_stub_table_pos = 0; 00633 00634 at.flush(); 00635 at.clear_error(); 00636 at.resp_start(); 00637 00638 char table5[] = "ERROR\r\n\0"; 00639 filehandle_stub_table = table5; 00640 filehandle_stub_table_pos = 0; 00641 00642 at.flush(); 00643 at.clear_error(); 00644 at.resp_start(); 00645 00646 char table6[] = "OK\r\n\0"; 00647 filehandle_stub_table = table6; 00648 filehandle_stub_table_pos = 0; 00649 00650 at.flush(); 00651 at.clear_error(); 00652 at.resp_start(); 00653 00654 char table7[] = "ssssss\0"; 00655 filehandle_stub_table = table7; 00656 filehandle_stub_table_pos = 0; 00657 00658 at.flush(); 00659 at.clear_error(); 00660 at.set_urc_handler("ss", NULL); 00661 at.resp_start(); 00662 } 00663 00664 void Test_ATHandler::test_ATHandler_resp_stop() 00665 { 00666 EventQueue que; 00667 FileHandle_stub fh1; 00668 00669 ATHandler at(&fh1, que, 0, ","); 00670 00671 char table[] = "21 OK\r\n\0"; 00672 filehandle_stub_table = table; 00673 filehandle_stub_table_pos = 0; 00674 00675 at.info_elem('2'); 00676 at.set_stop_tag("OK\r\n"); 00677 at.resp_stop(); 00678 00679 char table3[] = "+CME ERROR: 108\0"; 00680 filehandle_stub_table = table3; 00681 filehandle_stub_table_pos = 0; 00682 00683 at.flush(); 00684 at.clear_error(); 00685 at.resp_start(); 00686 00687 at.resp_stop(); 00688 00689 char table7[] = "ssssss\0"; 00690 filehandle_stub_table = table7; 00691 filehandle_stub_table_pos = 0; 00692 00693 at.flush(); 00694 at.clear_error(); 00695 at.resp_start("ss", false); 00696 at.resp_stop(); 00697 } 00698 00699 void Test_ATHandler::test_ATHandler_info_resp() 00700 { 00701 EventQueue que; 00702 FileHandle_stub fh1; 00703 00704 filehandle_stub_table = NULL; 00705 00706 ATHandler at(&fh1, que, 0, ","); 00707 CHECK(at.info_resp()); 00708 00709 at.resp_start(); 00710 CHECK(!at.info_resp()); 00711 00712 at.flush(); 00713 at.clear_error(); 00714 00715 char table2[] = "21 OK\r\n\0"; 00716 filehandle_stub_table = table2; 00717 filehandle_stub_table_pos = 0; 00718 mbed_poll_stub::revents_value = POLLIN; 00719 mbed_poll_stub::int_value = strlen(table2); 00720 00721 at.resp_start("21"); 00722 CHECK(at.info_resp()); 00723 00724 CHECK(!at.info_resp()); 00725 00726 at.flush(); 00727 at.clear_error(); 00728 00729 char table3[] = "21 OK\r\n\0"; 00730 filehandle_stub_table = table3; 00731 filehandle_stub_table_pos = 0; 00732 mbed_poll_stub::revents_value = POLLIN; 00733 mbed_poll_stub::int_value = strlen(table3); 00734 00735 CHECK(at.info_resp()); 00736 } 00737 00738 void Test_ATHandler::test_ATHandler_info_elem() 00739 { 00740 EventQueue que; 00741 FileHandle_stub fh1; 00742 00743 char table[] = "21 OK\r\n\0"; 00744 filehandle_stub_table = table; 00745 filehandle_stub_table_pos = 0; 00746 mbed_poll_stub::revents_value = POLLIN; 00747 mbed_poll_stub::int_value = strlen(table); 00748 00749 ATHandler at(&fh1, que, 0, ","); 00750 CHECK(!at.info_elem('O')); 00751 at.flush(); 00752 00753 char table2[] = "21 OK\r\n\0"; 00754 filehandle_stub_table = table2; 00755 filehandle_stub_table_pos = 0; 00756 mbed_poll_stub::revents_value = POLLIN; 00757 mbed_poll_stub::int_value = strlen(table2); 00758 00759 at.clear_error(); 00760 at.resp_start("21"); 00761 CHECK(at.info_elem('O')); 00762 at.flush(); 00763 00764 filehandle_stub_table = NULL; 00765 filehandle_stub_table_pos = 0; 00766 00767 at.clear_error(); 00768 at.resp_start("21"); 00769 CHECK(!at.info_elem('2')); 00770 } 00771 00772 void Test_ATHandler::test_ATHandler_consume_to_stop_tag() 00773 { 00774 EventQueue que; 00775 FileHandle_stub fh1; 00776 00777 ATHandler at(&fh1, que, 0, ","); 00778 CHECK(at.consume_to_stop_tag()); 00779 } 00780 00781 void Test_ATHandler::test_ATHandler_set_debug() 00782 { 00783 EventQueue que; 00784 FileHandle_stub fh1; 00785 00786 ATHandler at(&fh1, que, 0, ","); 00787 at.set_debug(true); 00788 00789 at.set_debug(false); 00790 } 00791 00792 void Test_ATHandler::test_ATHandler_get_3gpp_error() 00793 { 00794 EventQueue que; 00795 FileHandle_stub fh1; 00796 00797 ATHandler at(&fh1, que, 0, ","); 00798 int ret = at.get_3gpp_error(); 00799 }
Generated on Tue Jul 12 2022 12:45:51 by
1.7.2