Nicolas Borla / Mbed OS BBR_1Ebene
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers test_at_cellularinformation.cpp Source File

test_at_cellularinformation.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_at_cellularinformation.h"
00019 #include <string.h>
00020 #include "ATHandler_stub.h"
00021 #include "EventQueue.h"
00022 #include "FileHandle_stub.h"
00023 #include "ATHandler.h"
00024 #include "AT_CellularInformation.h"
00025 #include "AT_CellularBase.h"
00026 
00027 using namespace mbed;
00028 using namespace events;
00029 
00030 Test_AT_CellularInformation::Test_AT_CellularInformation()
00031 {
00032 
00033 }
00034 
00035 Test_AT_CellularInformation::~Test_AT_CellularInformation()
00036 {
00037 }
00038 
00039 void Test_AT_CellularInformation::test_AT_CellularInformation_get_manufacturer()
00040 {
00041     EventQueue eq;
00042     FileHandle_stub fh;
00043     ATHandler ah(&fh, eq, 0, ",");
00044     AT_CellularInformation aci(ah);
00045 
00046     ATHandler_stub::nsapi_error_value = 8;
00047 
00048     char buf[8];
00049     CHECK(8 == aci.get_manufacturer(buf, 8));
00050 }
00051 
00052 void Test_AT_CellularInformation::test_AT_CellularInformation_get_model()
00053 {
00054     EventQueue eq;
00055     FileHandle_stub fh;
00056     ATHandler ah(&fh, eq, 0, ",");
00057     AT_CellularInformation aci(ah);
00058 
00059     ATHandler_stub::nsapi_error_value = 7;
00060 
00061     char buf[8];
00062     CHECK(7 == aci.get_model(buf, 8));
00063 }
00064 
00065 void Test_AT_CellularInformation::test_AT_CellularInformation_get_revision()
00066 {
00067     EventQueue eq;
00068     FileHandle_stub fh;
00069     ATHandler ah(&fh, eq, 0, ",");
00070 
00071     //Used heap var here to visit heap constructor
00072     AT_CellularInformation *aci = new AT_CellularInformation(ah);
00073 
00074     ATHandler_stub::nsapi_error_value = 6;
00075 
00076     char buf[8];
00077     CHECK(6 == aci->get_revision(buf, 8));
00078 
00079     delete aci;
00080 }
00081