Ram Gandikota
/
IOTMetronome
FRDM K64F Metronome
mbed-client/test/mbedclient/utest/m2mbase/m2mbasetest.cpp@0:dbad57390bd1, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:37:05 2017 +0000
- Revision:
- 0:dbad57390bd1
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:dbad57390bd1 | 1 | /* |
ram54288 | 0:dbad57390bd1 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
ram54288 | 0:dbad57390bd1 | 3 | * SPDX-License-Identifier: Apache-2.0 |
ram54288 | 0:dbad57390bd1 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
ram54288 | 0:dbad57390bd1 | 5 | * not use this file except in compliance with the License. |
ram54288 | 0:dbad57390bd1 | 6 | * You may obtain a copy of the License at |
ram54288 | 0:dbad57390bd1 | 7 | * |
ram54288 | 0:dbad57390bd1 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ram54288 | 0:dbad57390bd1 | 9 | * |
ram54288 | 0:dbad57390bd1 | 10 | * Unless required by applicable law or agreed to in writing, software |
ram54288 | 0:dbad57390bd1 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ram54288 | 0:dbad57390bd1 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ram54288 | 0:dbad57390bd1 | 13 | * See the License for the specific language governing permissions and |
ram54288 | 0:dbad57390bd1 | 14 | * limitations under the License. |
ram54288 | 0:dbad57390bd1 | 15 | */ |
ram54288 | 0:dbad57390bd1 | 16 | //CppUTest includes should be after your and system includes |
ram54288 | 0:dbad57390bd1 | 17 | #include "CppUTest/TestHarness.h" |
ram54288 | 0:dbad57390bd1 | 18 | #include "test_m2mbase.h" |
ram54288 | 0:dbad57390bd1 | 19 | |
ram54288 | 0:dbad57390bd1 | 20 | TEST_GROUP(M2MBase) |
ram54288 | 0:dbad57390bd1 | 21 | { |
ram54288 | 0:dbad57390bd1 | 22 | Test_M2MBase* m2m_base; |
ram54288 | 0:dbad57390bd1 | 23 | Handler *obsHandler; |
ram54288 | 0:dbad57390bd1 | 24 | void setup() { |
ram54288 | 0:dbad57390bd1 | 25 | // Path ownership moved to m2mbase |
ram54288 | 0:dbad57390bd1 | 26 | char* path = (char*)malloc(5); |
ram54288 | 0:dbad57390bd1 | 27 | strcpy(path, "test"); |
ram54288 | 0:dbad57390bd1 | 28 | |
ram54288 | 0:dbad57390bd1 | 29 | obsHandler = new Handler(); |
ram54288 | 0:dbad57390bd1 | 30 | m2m_base = new Test_M2MBase(path, obsHandler); |
ram54288 | 0:dbad57390bd1 | 31 | } |
ram54288 | 0:dbad57390bd1 | 32 | |
ram54288 | 0:dbad57390bd1 | 33 | void teardown() { |
ram54288 | 0:dbad57390bd1 | 34 | delete m2m_base; |
ram54288 | 0:dbad57390bd1 | 35 | delete obsHandler; |
ram54288 | 0:dbad57390bd1 | 36 | } |
ram54288 | 0:dbad57390bd1 | 37 | }; |
ram54288 | 0:dbad57390bd1 | 38 | |
ram54288 | 0:dbad57390bd1 | 39 | TEST(M2MBase, Create) |
ram54288 | 0:dbad57390bd1 | 40 | { |
ram54288 | 0:dbad57390bd1 | 41 | CHECK(m2m_base != NULL); |
ram54288 | 0:dbad57390bd1 | 42 | } |
ram54288 | 0:dbad57390bd1 | 43 | |
ram54288 | 0:dbad57390bd1 | 44 | TEST(M2MBase, set_operation) |
ram54288 | 0:dbad57390bd1 | 45 | { |
ram54288 | 0:dbad57390bd1 | 46 | m2m_base->test_set_operation(); |
ram54288 | 0:dbad57390bd1 | 47 | } |
ram54288 | 0:dbad57390bd1 | 48 | |
ram54288 | 0:dbad57390bd1 | 49 | TEST(M2MBase, test_set_base_type) |
ram54288 | 0:dbad57390bd1 | 50 | { |
ram54288 | 0:dbad57390bd1 | 51 | m2m_base->test_set_base_type(); |
ram54288 | 0:dbad57390bd1 | 52 | } |
ram54288 | 0:dbad57390bd1 | 53 | |
ram54288 | 0:dbad57390bd1 | 54 | TEST(M2MBase, set_interface_description) |
ram54288 | 0:dbad57390bd1 | 55 | { |
ram54288 | 0:dbad57390bd1 | 56 | m2m_base->test_set_interface_description(); |
ram54288 | 0:dbad57390bd1 | 57 | } |
ram54288 | 0:dbad57390bd1 | 58 | |
ram54288 | 0:dbad57390bd1 | 59 | TEST(M2MBase, uri_path) |
ram54288 | 0:dbad57390bd1 | 60 | { |
ram54288 | 0:dbad57390bd1 | 61 | m2m_base->test_uri_path(); |
ram54288 | 0:dbad57390bd1 | 62 | } |
ram54288 | 0:dbad57390bd1 | 63 | |
ram54288 | 0:dbad57390bd1 | 64 | TEST(M2MBase, set_resource_type) |
ram54288 | 0:dbad57390bd1 | 65 | { |
ram54288 | 0:dbad57390bd1 | 66 | m2m_base->test_set_resource_type(); |
ram54288 | 0:dbad57390bd1 | 67 | } |
ram54288 | 0:dbad57390bd1 | 68 | |
ram54288 | 0:dbad57390bd1 | 69 | TEST(M2MBase, set_coap_content_type) |
ram54288 | 0:dbad57390bd1 | 70 | { |
ram54288 | 0:dbad57390bd1 | 71 | m2m_base->test_set_coap_content_type(); |
ram54288 | 0:dbad57390bd1 | 72 | } |
ram54288 | 0:dbad57390bd1 | 73 | |
ram54288 | 0:dbad57390bd1 | 74 | TEST(M2MBase, set_instance_id) |
ram54288 | 0:dbad57390bd1 | 75 | { |
ram54288 | 0:dbad57390bd1 | 76 | m2m_base->test_set_instance_id(); |
ram54288 | 0:dbad57390bd1 | 77 | } |
ram54288 | 0:dbad57390bd1 | 78 | |
ram54288 | 0:dbad57390bd1 | 79 | TEST(M2MBase, observation_number) |
ram54288 | 0:dbad57390bd1 | 80 | { |
ram54288 | 0:dbad57390bd1 | 81 | m2m_base->test_observation_number(); |
ram54288 | 0:dbad57390bd1 | 82 | } |
ram54288 | 0:dbad57390bd1 | 83 | |
ram54288 | 0:dbad57390bd1 | 84 | TEST(M2MBase, mode) |
ram54288 | 0:dbad57390bd1 | 85 | { |
ram54288 | 0:dbad57390bd1 | 86 | m2m_base->test_mode(); |
ram54288 | 0:dbad57390bd1 | 87 | } |
ram54288 | 0:dbad57390bd1 | 88 | |
ram54288 | 0:dbad57390bd1 | 89 | TEST(M2MBase, observation_token) |
ram54288 | 0:dbad57390bd1 | 90 | { |
ram54288 | 0:dbad57390bd1 | 91 | m2m_base->test_get_observation_token(); |
ram54288 | 0:dbad57390bd1 | 92 | } |
ram54288 | 0:dbad57390bd1 | 93 | |
ram54288 | 0:dbad57390bd1 | 94 | TEST(M2MBase, observation_level) |
ram54288 | 0:dbad57390bd1 | 95 | { |
ram54288 | 0:dbad57390bd1 | 96 | m2m_base->test_observation_level(); |
ram54288 | 0:dbad57390bd1 | 97 | } |
ram54288 | 0:dbad57390bd1 | 98 | |
ram54288 | 0:dbad57390bd1 | 99 | TEST(M2MBase, set_observation_token) |
ram54288 | 0:dbad57390bd1 | 100 | { |
ram54288 | 0:dbad57390bd1 | 101 | m2m_base->test_set_observation_token(); |
ram54288 | 0:dbad57390bd1 | 102 | } |
ram54288 | 0:dbad57390bd1 | 103 | |
ram54288 | 0:dbad57390bd1 | 104 | TEST(M2MBase, set_under_observation) |
ram54288 | 0:dbad57390bd1 | 105 | { |
ram54288 | 0:dbad57390bd1 | 106 | m2m_base->test_set_under_observation(); |
ram54288 | 0:dbad57390bd1 | 107 | } |
ram54288 | 0:dbad57390bd1 | 108 | |
ram54288 | 0:dbad57390bd1 | 109 | TEST(M2MBase, set_observable) |
ram54288 | 0:dbad57390bd1 | 110 | { |
ram54288 | 0:dbad57390bd1 | 111 | m2m_base->test_set_observable(); |
ram54288 | 0:dbad57390bd1 | 112 | } |
ram54288 | 0:dbad57390bd1 | 113 | |
ram54288 | 0:dbad57390bd1 | 114 | TEST(M2MBase, add_observation_level) |
ram54288 | 0:dbad57390bd1 | 115 | { |
ram54288 | 0:dbad57390bd1 | 116 | m2m_base->test_add_observation_level(); |
ram54288 | 0:dbad57390bd1 | 117 | } |
ram54288 | 0:dbad57390bd1 | 118 | |
ram54288 | 0:dbad57390bd1 | 119 | TEST(M2MBase, remove_observation_level) |
ram54288 | 0:dbad57390bd1 | 120 | { |
ram54288 | 0:dbad57390bd1 | 121 | m2m_base->test_remove_observation_level(); |
ram54288 | 0:dbad57390bd1 | 122 | } |
ram54288 | 0:dbad57390bd1 | 123 | |
ram54288 | 0:dbad57390bd1 | 124 | TEST(M2MBase, name) |
ram54288 | 0:dbad57390bd1 | 125 | { |
ram54288 | 0:dbad57390bd1 | 126 | m2m_base->test_name(); |
ram54288 | 0:dbad57390bd1 | 127 | } |
ram54288 | 0:dbad57390bd1 | 128 | |
ram54288 | 0:dbad57390bd1 | 129 | TEST(M2MBase, name_id) |
ram54288 | 0:dbad57390bd1 | 130 | { |
ram54288 | 0:dbad57390bd1 | 131 | m2m_base->test_name_id(); |
ram54288 | 0:dbad57390bd1 | 132 | } |
ram54288 | 0:dbad57390bd1 | 133 | |
ram54288 | 0:dbad57390bd1 | 134 | TEST(M2MBase, test_handle_observation_attribute) |
ram54288 | 0:dbad57390bd1 | 135 | { |
ram54288 | 0:dbad57390bd1 | 136 | m2m_base->test_handle_observation_attribute(); |
ram54288 | 0:dbad57390bd1 | 137 | } |
ram54288 | 0:dbad57390bd1 | 138 | |
ram54288 | 0:dbad57390bd1 | 139 | TEST(M2MBase, test_observation_to_be_sent) |
ram54288 | 0:dbad57390bd1 | 140 | { |
ram54288 | 0:dbad57390bd1 | 141 | m2m_base->test_observation_to_be_sent(); |
ram54288 | 0:dbad57390bd1 | 142 | } |
ram54288 | 0:dbad57390bd1 | 143 | |
ram54288 | 0:dbad57390bd1 | 144 | TEST(M2MBase, test_handle_get_request) |
ram54288 | 0:dbad57390bd1 | 145 | { |
ram54288 | 0:dbad57390bd1 | 146 | m2m_base->test_handle_get_request(); |
ram54288 | 0:dbad57390bd1 | 147 | } |
ram54288 | 0:dbad57390bd1 | 148 | |
ram54288 | 0:dbad57390bd1 | 149 | TEST(M2MBase, test_handle_put_request) |
ram54288 | 0:dbad57390bd1 | 150 | { |
ram54288 | 0:dbad57390bd1 | 151 | m2m_base->test_handle_put_request(); |
ram54288 | 0:dbad57390bd1 | 152 | } |
ram54288 | 0:dbad57390bd1 | 153 | |
ram54288 | 0:dbad57390bd1 | 154 | TEST(M2MBase, test_handle_post_request) |
ram54288 | 0:dbad57390bd1 | 155 | { |
ram54288 | 0:dbad57390bd1 | 156 | m2m_base->test_handle_post_request(); |
ram54288 | 0:dbad57390bd1 | 157 | } |
ram54288 | 0:dbad57390bd1 | 158 | |
ram54288 | 0:dbad57390bd1 | 159 | TEST(M2MBase, test_memory_alloc) |
ram54288 | 0:dbad57390bd1 | 160 | { |
ram54288 | 0:dbad57390bd1 | 161 | m2m_base->test_memory_alloc(); |
ram54288 | 0:dbad57390bd1 | 162 | } |
ram54288 | 0:dbad57390bd1 | 163 | |
ram54288 | 0:dbad57390bd1 | 164 | TEST(M2MBase, test_memory_free) |
ram54288 | 0:dbad57390bd1 | 165 | { |
ram54288 | 0:dbad57390bd1 | 166 | m2m_base->test_memory_free(); |
ram54288 | 0:dbad57390bd1 | 167 | } |
ram54288 | 0:dbad57390bd1 | 168 | |
ram54288 | 0:dbad57390bd1 | 169 | TEST(M2MBase, test_report_handler) |
ram54288 | 0:dbad57390bd1 | 170 | { |
ram54288 | 0:dbad57390bd1 | 171 | m2m_base->test_report_handler(); |
ram54288 | 0:dbad57390bd1 | 172 | } |
ram54288 | 0:dbad57390bd1 | 173 | |
ram54288 | 0:dbad57390bd1 | 174 | TEST(M2MBase, test_observation_handler) |
ram54288 | 0:dbad57390bd1 | 175 | { |
ram54288 | 0:dbad57390bd1 | 176 | m2m_base->test_observation_handler(); |
ram54288 | 0:dbad57390bd1 | 177 | } |
ram54288 | 0:dbad57390bd1 | 178 | |
ram54288 | 0:dbad57390bd1 | 179 | TEST(M2MBase, test_id_number) |
ram54288 | 0:dbad57390bd1 | 180 | { |
ram54288 | 0:dbad57390bd1 | 181 | m2m_base->test_id_number(); |
ram54288 | 0:dbad57390bd1 | 182 | } |
ram54288 | 0:dbad57390bd1 | 183 | |
ram54288 | 0:dbad57390bd1 | 184 | TEST(M2MBase, test_set_register_uri) |
ram54288 | 0:dbad57390bd1 | 185 | { |
ram54288 | 0:dbad57390bd1 | 186 | m2m_base->test_set_register_uri(); |
ram54288 | 0:dbad57390bd1 | 187 | } |
ram54288 | 0:dbad57390bd1 | 188 | |
ram54288 | 0:dbad57390bd1 | 189 | TEST(M2MBase, test_set_observation_number) |
ram54288 | 0:dbad57390bd1 | 190 | { |
ram54288 | 0:dbad57390bd1 | 191 | m2m_base->test_set_observation_number(); |
ram54288 | 0:dbad57390bd1 | 192 | } |
ram54288 | 0:dbad57390bd1 | 193 | |
ram54288 | 0:dbad57390bd1 | 194 | TEST(M2MBase, test_set_max_age) |
ram54288 | 0:dbad57390bd1 | 195 | { |
ram54288 | 0:dbad57390bd1 | 196 | m2m_base->test_set_max_age(); |
ram54288 | 0:dbad57390bd1 | 197 | } |
ram54288 | 0:dbad57390bd1 | 198 | |
ram54288 | 0:dbad57390bd1 | 199 | TEST(M2MBase, test_is_under_observation) |
ram54288 | 0:dbad57390bd1 | 200 | { |
ram54288 | 0:dbad57390bd1 | 201 | m2m_base->test_is_under_observation(); |
ram54288 | 0:dbad57390bd1 | 202 | } |
ram54288 | 0:dbad57390bd1 | 203 | |
ram54288 | 0:dbad57390bd1 | 204 | TEST(M2MBase, test_value_updated_function) |
ram54288 | 0:dbad57390bd1 | 205 | { |
ram54288 | 0:dbad57390bd1 | 206 | m2m_base->test_value_updated_function(); |
ram54288 | 0:dbad57390bd1 | 207 | } |
ram54288 | 0:dbad57390bd1 | 208 | |
ram54288 | 0:dbad57390bd1 | 209 | TEST(M2MBase, test_build_path) |
ram54288 | 0:dbad57390bd1 | 210 | { |
ram54288 | 0:dbad57390bd1 | 211 | m2m_base->test_build_path(); |
ram54288 | 0:dbad57390bd1 | 212 | } |
ram54288 | 0:dbad57390bd1 | 213 | |
ram54288 | 0:dbad57390bd1 | 214 | TEST(M2MBase, test_set_observation_handler) |
ram54288 | 0:dbad57390bd1 | 215 | { |
ram54288 | 0:dbad57390bd1 | 216 | m2m_base->test_set_observation_handler(); |
ram54288 | 0:dbad57390bd1 | 217 | } |
ram54288 | 0:dbad57390bd1 | 218 | |
ram54288 | 0:dbad57390bd1 | 219 | TEST(M2MBase, test_resource_type) |
ram54288 | 0:dbad57390bd1 | 220 | { |
ram54288 | 0:dbad57390bd1 | 221 | m2m_base->test_resource_type(); |
ram54288 | 0:dbad57390bd1 | 222 | } |
ram54288 | 0:dbad57390bd1 | 223 | |
ram54288 | 0:dbad57390bd1 | 224 | TEST(M2MBase, test_resource_name_length) |
ram54288 | 0:dbad57390bd1 | 225 | { |
ram54288 | 0:dbad57390bd1 | 226 | m2m_base->test_resource_name_length(); |
ram54288 | 0:dbad57390bd1 | 227 | } |
ram54288 | 0:dbad57390bd1 | 228 | |
ram54288 | 0:dbad57390bd1 | 229 | TEST(M2MBase, test_get_nsdl_resource) |
ram54288 | 0:dbad57390bd1 | 230 | { |
ram54288 | 0:dbad57390bd1 | 231 | m2m_base->test_get_nsdl_resource(); |
ram54288 | 0:dbad57390bd1 | 232 | } |
ram54288 | 0:dbad57390bd1 | 233 | |
ram54288 | 0:dbad57390bd1 | 234 | TEST(M2MBase, test_create_path) |
ram54288 | 0:dbad57390bd1 | 235 | { |
ram54288 | 0:dbad57390bd1 | 236 | m2m_base->test_create_path(); |
ram54288 | 0:dbad57390bd1 | 237 | } |
ram54288 | 0:dbad57390bd1 | 238 | |
ram54288 | 0:dbad57390bd1 | 239 | TEST(M2MBase, test_create_report_handler) |
ram54288 | 0:dbad57390bd1 | 240 | { |
ram54288 | 0:dbad57390bd1 | 241 | m2m_base->test_create_report_handler(); |
ram54288 | 0:dbad57390bd1 | 242 | } |
ram54288 | 0:dbad57390bd1 | 243 | |
ram54288 | 0:dbad57390bd1 | 244 | TEST(M2MBase, test_validate_string_length) |
ram54288 | 0:dbad57390bd1 | 245 | { |
ram54288 | 0:dbad57390bd1 | 246 | m2m_base->test_validate_string_length(); |
ram54288 | 0:dbad57390bd1 | 247 | } |
ram54288 | 0:dbad57390bd1 | 248 | |
ram54288 | 0:dbad57390bd1 | 249 | TEST(M2MBase, test_is_integer) |
ram54288 | 0:dbad57390bd1 | 250 | { |
ram54288 | 0:dbad57390bd1 | 251 | m2m_base->test_is_integer(); |
ram54288 | 0:dbad57390bd1 | 252 | } |
ram54288 | 0:dbad57390bd1 | 253 | |
ram54288 | 0:dbad57390bd1 | 254 | TEST(M2MBase, test_alloc_string_copy) |
ram54288 | 0:dbad57390bd1 | 255 | { |
ram54288 | 0:dbad57390bd1 | 256 | m2m_base->test_alloc_string_copy(); |
ram54288 | 0:dbad57390bd1 | 257 | } |
ram54288 | 0:dbad57390bd1 | 258 | |
ram54288 | 0:dbad57390bd1 | 259 | TEST(M2MBase, test_alloc_copy) |
ram54288 | 0:dbad57390bd1 | 260 | { |
ram54288 | 0:dbad57390bd1 | 261 | m2m_base->test_alloc_copy(); |
ram54288 | 0:dbad57390bd1 | 262 | } |
ram54288 | 0:dbad57390bd1 | 263 | |
ram54288 | 0:dbad57390bd1 | 264 | TEST(M2MBase, test_ctor) |
ram54288 | 0:dbad57390bd1 | 265 | { |
ram54288 | 0:dbad57390bd1 | 266 | m2m_base->test_ctor(); |
ram54288 | 0:dbad57390bd1 | 267 | } |