Ram Gandikota
/
metronome
FRDM K64F Metronome
mbed-client/test/mbedclient/utest/m2minterfaceimpl/test_m2minterfaceimpl.cpp@0:a2cb7295a1f7, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:35:07 2017 +0000
- Revision:
- 0:a2cb7295a1f7
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:a2cb7295a1f7 | 1 | /* |
ram54288 | 0:a2cb7295a1f7 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
ram54288 | 0:a2cb7295a1f7 | 3 | * SPDX-License-Identifier: Apache-2.0 |
ram54288 | 0:a2cb7295a1f7 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
ram54288 | 0:a2cb7295a1f7 | 5 | * not use this file except in compliance with the License. |
ram54288 | 0:a2cb7295a1f7 | 6 | * You may obtain a copy of the License at |
ram54288 | 0:a2cb7295a1f7 | 7 | * |
ram54288 | 0:a2cb7295a1f7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ram54288 | 0:a2cb7295a1f7 | 9 | * |
ram54288 | 0:a2cb7295a1f7 | 10 | * Unless required by applicable law or agreed to in writing, software |
ram54288 | 0:a2cb7295a1f7 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ram54288 | 0:a2cb7295a1f7 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ram54288 | 0:a2cb7295a1f7 | 13 | * See the License for the specific language governing permissions and |
ram54288 | 0:a2cb7295a1f7 | 14 | * limitations under the License. |
ram54288 | 0:a2cb7295a1f7 | 15 | */ |
ram54288 | 0:a2cb7295a1f7 | 16 | #include "CppUTest/TestHarness.h" |
ram54288 | 0:a2cb7295a1f7 | 17 | #include "test_m2minterfaceimpl.h" |
ram54288 | 0:a2cb7295a1f7 | 18 | #include "m2minterfaceobserver.h" |
ram54288 | 0:a2cb7295a1f7 | 19 | #include "m2mconnectionhandler_stub.h" |
ram54288 | 0:a2cb7295a1f7 | 20 | #include "m2msecurity_stub.h" |
ram54288 | 0:a2cb7295a1f7 | 21 | #include "m2mnsdlinterface_stub.h" |
ram54288 | 0:a2cb7295a1f7 | 22 | #include "m2mobject_stub.h" |
ram54288 | 0:a2cb7295a1f7 | 23 | #include "m2mobjectinstance_stub.h" |
ram54288 | 0:a2cb7295a1f7 | 24 | #include "m2mbase.h" |
ram54288 | 0:a2cb7295a1f7 | 25 | |
ram54288 | 0:a2cb7295a1f7 | 26 | entropy_cb ent_cb; |
ram54288 | 0:a2cb7295a1f7 | 27 | |
ram54288 | 0:a2cb7295a1f7 | 28 | class TestObserver : public M2MInterfaceObserver { |
ram54288 | 0:a2cb7295a1f7 | 29 | |
ram54288 | 0:a2cb7295a1f7 | 30 | public: |
ram54288 | 0:a2cb7295a1f7 | 31 | TestObserver() : val_updated(false), error_occured(false), |
ram54288 | 0:a2cb7295a1f7 | 32 | registered(false), unregistered(false), bootstrapped(false) |
ram54288 | 0:a2cb7295a1f7 | 33 | { |
ram54288 | 0:a2cb7295a1f7 | 34 | } |
ram54288 | 0:a2cb7295a1f7 | 35 | |
ram54288 | 0:a2cb7295a1f7 | 36 | virtual ~TestObserver(){} |
ram54288 | 0:a2cb7295a1f7 | 37 | void bootstrap_done(M2MSecurity */*server_object*/){ |
ram54288 | 0:a2cb7295a1f7 | 38 | bootstrapped = true; |
ram54288 | 0:a2cb7295a1f7 | 39 | } |
ram54288 | 0:a2cb7295a1f7 | 40 | |
ram54288 | 0:a2cb7295a1f7 | 41 | void object_registered(M2MSecurity */*security_object*/, |
ram54288 | 0:a2cb7295a1f7 | 42 | const M2MServer &/*server_object*/) { |
ram54288 | 0:a2cb7295a1f7 | 43 | registered = true; |
ram54288 | 0:a2cb7295a1f7 | 44 | } |
ram54288 | 0:a2cb7295a1f7 | 45 | |
ram54288 | 0:a2cb7295a1f7 | 46 | void object_unregistered(M2MSecurity */*server_object*/){ |
ram54288 | 0:a2cb7295a1f7 | 47 | unregistered = true; |
ram54288 | 0:a2cb7295a1f7 | 48 | } |
ram54288 | 0:a2cb7295a1f7 | 49 | |
ram54288 | 0:a2cb7295a1f7 | 50 | void registration_updated(M2MSecurity */*security_object*/, |
ram54288 | 0:a2cb7295a1f7 | 51 | const M2MServer &/*server_object*/){ |
ram54288 | 0:a2cb7295a1f7 | 52 | registered = true; |
ram54288 | 0:a2cb7295a1f7 | 53 | } |
ram54288 | 0:a2cb7295a1f7 | 54 | |
ram54288 | 0:a2cb7295a1f7 | 55 | void error(M2MInterface::Error /*error*/){ |
ram54288 | 0:a2cb7295a1f7 | 56 | error_occured = true; |
ram54288 | 0:a2cb7295a1f7 | 57 | } |
ram54288 | 0:a2cb7295a1f7 | 58 | |
ram54288 | 0:a2cb7295a1f7 | 59 | void value_updated(M2MBase *, M2MBase::BaseType ){ |
ram54288 | 0:a2cb7295a1f7 | 60 | val_updated = true; |
ram54288 | 0:a2cb7295a1f7 | 61 | } |
ram54288 | 0:a2cb7295a1f7 | 62 | |
ram54288 | 0:a2cb7295a1f7 | 63 | bool val_updated; |
ram54288 | 0:a2cb7295a1f7 | 64 | bool error_occured; |
ram54288 | 0:a2cb7295a1f7 | 65 | bool registered; |
ram54288 | 0:a2cb7295a1f7 | 66 | bool unregistered; |
ram54288 | 0:a2cb7295a1f7 | 67 | bool bootstrapped; |
ram54288 | 0:a2cb7295a1f7 | 68 | }; |
ram54288 | 0:a2cb7295a1f7 | 69 | |
ram54288 | 0:a2cb7295a1f7 | 70 | class M2MBaseTest : public M2MBase |
ram54288 | 0:a2cb7295a1f7 | 71 | { |
ram54288 | 0:a2cb7295a1f7 | 72 | public: |
ram54288 | 0:a2cb7295a1f7 | 73 | M2MBaseTest() : M2MBase("a", M2MBase::Static, "type","a",false){} |
ram54288 | 0:a2cb7295a1f7 | 74 | }; |
ram54288 | 0:a2cb7295a1f7 | 75 | |
ram54288 | 0:a2cb7295a1f7 | 76 | Test_M2MInterfaceImpl::Test_M2MInterfaceImpl() |
ram54288 | 0:a2cb7295a1f7 | 77 | { |
ram54288 | 0:a2cb7295a1f7 | 78 | observer = new TestObserver(); |
ram54288 | 0:a2cb7295a1f7 | 79 | impl = new M2MInterfaceImpl(*observer, |
ram54288 | 0:a2cb7295a1f7 | 80 | "endpoint_name", |
ram54288 | 0:a2cb7295a1f7 | 81 | "endpoint_type", |
ram54288 | 0:a2cb7295a1f7 | 82 | 120, |
ram54288 | 0:a2cb7295a1f7 | 83 | 8000, |
ram54288 | 0:a2cb7295a1f7 | 84 | "domain"); |
ram54288 | 0:a2cb7295a1f7 | 85 | } |
ram54288 | 0:a2cb7295a1f7 | 86 | |
ram54288 | 0:a2cb7295a1f7 | 87 | Test_M2MInterfaceImpl:: ~Test_M2MInterfaceImpl() |
ram54288 | 0:a2cb7295a1f7 | 88 | { |
ram54288 | 0:a2cb7295a1f7 | 89 | delete observer; |
ram54288 | 0:a2cb7295a1f7 | 90 | delete impl; |
ram54288 | 0:a2cb7295a1f7 | 91 | } |
ram54288 | 0:a2cb7295a1f7 | 92 | |
ram54288 | 0:a2cb7295a1f7 | 93 | void Test_M2MInterfaceImpl::test_constructor() |
ram54288 | 0:a2cb7295a1f7 | 94 | { |
ram54288 | 0:a2cb7295a1f7 | 95 | TestObserver obs; |
ram54288 | 0:a2cb7295a1f7 | 96 | |
ram54288 | 0:a2cb7295a1f7 | 97 | M2MInterfaceImpl* obj = new M2MInterfaceImpl(obs, |
ram54288 | 0:a2cb7295a1f7 | 98 | "endpoint_name", |
ram54288 | 0:a2cb7295a1f7 | 99 | "endpoint_type", |
ram54288 | 0:a2cb7295a1f7 | 100 | 120, |
ram54288 | 0:a2cb7295a1f7 | 101 | 8000, |
ram54288 | 0:a2cb7295a1f7 | 102 | "domain", |
ram54288 | 0:a2cb7295a1f7 | 103 | M2MInterface::TCP); |
ram54288 | 0:a2cb7295a1f7 | 104 | CHECK(obj->_current_state == 0); |
ram54288 | 0:a2cb7295a1f7 | 105 | //TODO: Check rest of variables |
ram54288 | 0:a2cb7295a1f7 | 106 | delete obj; |
ram54288 | 0:a2cb7295a1f7 | 107 | obj = new M2MInterfaceImpl(obs, |
ram54288 | 0:a2cb7295a1f7 | 108 | "endpoint_name", |
ram54288 | 0:a2cb7295a1f7 | 109 | "endpoint_type", |
ram54288 | 0:a2cb7295a1f7 | 110 | 120, |
ram54288 | 0:a2cb7295a1f7 | 111 | 8000, |
ram54288 | 0:a2cb7295a1f7 | 112 | "domain", |
ram54288 | 0:a2cb7295a1f7 | 113 | M2MInterface::TCP_QUEUE); |
ram54288 | 0:a2cb7295a1f7 | 114 | delete obj; |
ram54288 | 0:a2cb7295a1f7 | 115 | } |
ram54288 | 0:a2cb7295a1f7 | 116 | |
ram54288 | 0:a2cb7295a1f7 | 117 | void Test_M2MInterfaceImpl::test_bootstrap() |
ram54288 | 0:a2cb7295a1f7 | 118 | { |
ram54288 | 0:a2cb7295a1f7 | 119 | M2MSecurity *sec = new M2MSecurity(M2MSecurity::Bootstrap); |
ram54288 | 0:a2cb7295a1f7 | 120 | m2msecurity_stub::int_value = 2; |
ram54288 | 0:a2cb7295a1f7 | 121 | String *val = new String("coaps://[2001:12:12:23::23:FF]:5685"); |
ram54288 | 0:a2cb7295a1f7 | 122 | |
ram54288 | 0:a2cb7295a1f7 | 123 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 124 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 125 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 126 | |
ram54288 | 0:a2cb7295a1f7 | 127 | |
ram54288 | 0:a2cb7295a1f7 | 128 | impl->bootstrap(NULL); |
ram54288 | 0:a2cb7295a1f7 | 129 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 130 | |
ram54288 | 0:a2cb7295a1f7 | 131 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 132 | |
ram54288 | 0:a2cb7295a1f7 | 133 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP); |
ram54288 | 0:a2cb7295a1f7 | 134 | |
ram54288 | 0:a2cb7295a1f7 | 135 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 136 | |
ram54288 | 0:a2cb7295a1f7 | 137 | val = new String("coaps://[10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 138 | |
ram54288 | 0:a2cb7295a1f7 | 139 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 140 | |
ram54288 | 0:a2cb7295a1f7 | 141 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 142 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 143 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 144 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 145 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 146 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 147 | |
ram54288 | 0:a2cb7295a1f7 | 148 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 149 | |
ram54288 | 0:a2cb7295a1f7 | 150 | val = new String("coaps://10.45.3.83]:5685"); |
ram54288 | 0:a2cb7295a1f7 | 151 | |
ram54288 | 0:a2cb7295a1f7 | 152 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 153 | |
ram54288 | 0:a2cb7295a1f7 | 154 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 155 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 156 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 157 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 158 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 159 | |
ram54288 | 0:a2cb7295a1f7 | 160 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 161 | |
ram54288 | 0:a2cb7295a1f7 | 162 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 163 | |
ram54288 | 0:a2cb7295a1f7 | 164 | val = new String("coap://10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 165 | |
ram54288 | 0:a2cb7295a1f7 | 166 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 167 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 168 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 169 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 170 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 171 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 172 | |
ram54288 | 0:a2cb7295a1f7 | 173 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP); |
ram54288 | 0:a2cb7295a1f7 | 174 | |
ram54288 | 0:a2cb7295a1f7 | 175 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 176 | |
ram54288 | 0:a2cb7295a1f7 | 177 | val = new String("coap://10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 178 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 179 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 180 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 181 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 182 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 183 | |
ram54288 | 0:a2cb7295a1f7 | 184 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP); |
ram54288 | 0:a2cb7295a1f7 | 185 | |
ram54288 | 0:a2cb7295a1f7 | 186 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 187 | |
ram54288 | 0:a2cb7295a1f7 | 188 | val = new String("coap://10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 189 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 190 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 191 | |
ram54288 | 0:a2cb7295a1f7 | 192 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 193 | |
ram54288 | 0:a2cb7295a1f7 | 194 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP); |
ram54288 | 0:a2cb7295a1f7 | 195 | |
ram54288 | 0:a2cb7295a1f7 | 196 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 197 | m2mconnectionhandler_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 198 | |
ram54288 | 0:a2cb7295a1f7 | 199 | // Ignore the event. |
ram54288 | 0:a2cb7295a1f7 | 200 | impl->_current_state = M2MInterfaceImpl::STATE_WAITING; |
ram54288 | 0:a2cb7295a1f7 | 201 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 202 | |
ram54288 | 0:a2cb7295a1f7 | 203 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 204 | |
ram54288 | 0:a2cb7295a1f7 | 205 | impl->bootstrap(sec); |
ram54288 | 0:a2cb7295a1f7 | 206 | |
ram54288 | 0:a2cb7295a1f7 | 207 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 208 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 209 | |
ram54288 | 0:a2cb7295a1f7 | 210 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 211 | val = NULL; |
ram54288 | 0:a2cb7295a1f7 | 212 | |
ram54288 | 0:a2cb7295a1f7 | 213 | delete sec; |
ram54288 | 0:a2cb7295a1f7 | 214 | } |
ram54288 | 0:a2cb7295a1f7 | 215 | |
ram54288 | 0:a2cb7295a1f7 | 216 | void Test_M2MInterfaceImpl::test_cancel_bootstrap() |
ram54288 | 0:a2cb7295a1f7 | 217 | { |
ram54288 | 0:a2cb7295a1f7 | 218 | // Check for coverage, currently no implementation |
ram54288 | 0:a2cb7295a1f7 | 219 | impl->cancel_bootstrap(); |
ram54288 | 0:a2cb7295a1f7 | 220 | } |
ram54288 | 0:a2cb7295a1f7 | 221 | |
ram54288 | 0:a2cb7295a1f7 | 222 | void Test_M2MInterfaceImpl::test_register_object() |
ram54288 | 0:a2cb7295a1f7 | 223 | { |
ram54288 | 0:a2cb7295a1f7 | 224 | M2MSecurity *sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 225 | m2msecurity_stub::int_value = 2; |
ram54288 | 0:a2cb7295a1f7 | 226 | |
ram54288 | 0:a2cb7295a1f7 | 227 | M2MObject *object = new M2MObject("test", "test"); |
ram54288 | 0:a2cb7295a1f7 | 228 | M2MObjectInstance *ins = object->create_object_instance(); |
ram54288 | 0:a2cb7295a1f7 | 229 | ins->create_dynamic_resource("test","type",M2MResourceInstance::STRING,false,false); |
ram54288 | 0:a2cb7295a1f7 | 230 | |
ram54288 | 0:a2cb7295a1f7 | 231 | M2MObjectList list; |
ram54288 | 0:a2cb7295a1f7 | 232 | list.push_back(object); |
ram54288 | 0:a2cb7295a1f7 | 233 | |
ram54288 | 0:a2cb7295a1f7 | 234 | String *val = new String("coaps://[2001:12:12:23::23:FF]:5685"); |
ram54288 | 0:a2cb7295a1f7 | 235 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 236 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 237 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 238 | |
ram54288 | 0:a2cb7295a1f7 | 239 | impl->register_object(NULL,list); |
ram54288 | 0:a2cb7295a1f7 | 240 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 241 | |
ram54288 | 0:a2cb7295a1f7 | 242 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 243 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTER); |
ram54288 | 0:a2cb7295a1f7 | 244 | |
ram54288 | 0:a2cb7295a1f7 | 245 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 246 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 247 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTER); |
ram54288 | 0:a2cb7295a1f7 | 248 | |
ram54288 | 0:a2cb7295a1f7 | 249 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 250 | val = new String("coaps://[10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 251 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 252 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 253 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 254 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 255 | |
ram54288 | 0:a2cb7295a1f7 | 256 | delete impl->_security; |
ram54288 | 0:a2cb7295a1f7 | 257 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 258 | sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 259 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 260 | |
ram54288 | 0:a2cb7295a1f7 | 261 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 262 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 263 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 264 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 265 | val = new String("coaps://10.45.3.83]:5685"); |
ram54288 | 0:a2cb7295a1f7 | 266 | |
ram54288 | 0:a2cb7295a1f7 | 267 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 268 | |
ram54288 | 0:a2cb7295a1f7 | 269 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 270 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 271 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 272 | |
ram54288 | 0:a2cb7295a1f7 | 273 | delete impl->_security; |
ram54288 | 0:a2cb7295a1f7 | 274 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 275 | sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 276 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 277 | |
ram54288 | 0:a2cb7295a1f7 | 278 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 279 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 280 | |
ram54288 | 0:a2cb7295a1f7 | 281 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 282 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 283 | val = new String("coaps://10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 284 | delete impl->_security; |
ram54288 | 0:a2cb7295a1f7 | 285 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 286 | sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 287 | |
ram54288 | 0:a2cb7295a1f7 | 288 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 289 | |
ram54288 | 0:a2cb7295a1f7 | 290 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 291 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 292 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 293 | |
ram54288 | 0:a2cb7295a1f7 | 294 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 295 | |
ram54288 | 0:a2cb7295a1f7 | 296 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTER); |
ram54288 | 0:a2cb7295a1f7 | 297 | |
ram54288 | 0:a2cb7295a1f7 | 298 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 299 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 300 | val = new String("coap://10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 301 | delete impl->_security; |
ram54288 | 0:a2cb7295a1f7 | 302 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 303 | sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 304 | |
ram54288 | 0:a2cb7295a1f7 | 305 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 306 | |
ram54288 | 0:a2cb7295a1f7 | 307 | m2msecurity_stub::string_value = val; |
ram54288 | 0:a2cb7295a1f7 | 308 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 309 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 310 | |
ram54288 | 0:a2cb7295a1f7 | 311 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 312 | |
ram54288 | 0:a2cb7295a1f7 | 313 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTER); |
ram54288 | 0:a2cb7295a1f7 | 314 | |
ram54288 | 0:a2cb7295a1f7 | 315 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 316 | val = new String("coap://10.45.3.83:5685"); |
ram54288 | 0:a2cb7295a1f7 | 317 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 318 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTER); |
ram54288 | 0:a2cb7295a1f7 | 319 | |
ram54288 | 0:a2cb7295a1f7 | 320 | |
ram54288 | 0:a2cb7295a1f7 | 321 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 322 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 323 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 324 | |
ram54288 | 0:a2cb7295a1f7 | 325 | delete impl->_security; |
ram54288 | 0:a2cb7295a1f7 | 326 | impl->_security = NULL; |
ram54288 | 0:a2cb7295a1f7 | 327 | sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 328 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 329 | |
ram54288 | 0:a2cb7295a1f7 | 330 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 331 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 332 | |
ram54288 | 0:a2cb7295a1f7 | 333 | impl->_current_state = M2MInterfaceImpl::STATE_BOOTSTRAP; |
ram54288 | 0:a2cb7295a1f7 | 334 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 335 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 336 | |
ram54288 | 0:a2cb7295a1f7 | 337 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 338 | |
ram54288 | 0:a2cb7295a1f7 | 339 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP); |
ram54288 | 0:a2cb7295a1f7 | 340 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 341 | |
ram54288 | 0:a2cb7295a1f7 | 342 | impl->_current_state = M2MInterfaceImpl::STATE_BOOTSTRAP; |
ram54288 | 0:a2cb7295a1f7 | 343 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 344 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 345 | |
ram54288 | 0:a2cb7295a1f7 | 346 | impl->register_object(sec,list); |
ram54288 | 0:a2cb7295a1f7 | 347 | |
ram54288 | 0:a2cb7295a1f7 | 348 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 349 | |
ram54288 | 0:a2cb7295a1f7 | 350 | |
ram54288 | 0:a2cb7295a1f7 | 351 | delete val; |
ram54288 | 0:a2cb7295a1f7 | 352 | val = NULL; |
ram54288 | 0:a2cb7295a1f7 | 353 | |
ram54288 | 0:a2cb7295a1f7 | 354 | list.clear(); |
ram54288 | 0:a2cb7295a1f7 | 355 | delete object; |
ram54288 | 0:a2cb7295a1f7 | 356 | delete sec; |
ram54288 | 0:a2cb7295a1f7 | 357 | } |
ram54288 | 0:a2cb7295a1f7 | 358 | |
ram54288 | 0:a2cb7295a1f7 | 359 | void Test_M2MInterfaceImpl::test_update_registration() |
ram54288 | 0:a2cb7295a1f7 | 360 | { |
ram54288 | 0:a2cb7295a1f7 | 361 | impl->_current_state = M2MInterfaceImpl::STATE_REGISTERED; |
ram54288 | 0:a2cb7295a1f7 | 362 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 363 | impl->update_registration(NULL,120); |
ram54288 | 0:a2cb7295a1f7 | 364 | |
ram54288 | 0:a2cb7295a1f7 | 365 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_UPDATE_REGISTRATION); |
ram54288 | 0:a2cb7295a1f7 | 366 | |
ram54288 | 0:a2cb7295a1f7 | 367 | impl->_current_state = M2MInterfaceImpl::STATE_REGISTERED; |
ram54288 | 0:a2cb7295a1f7 | 368 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 369 | impl->update_registration(NULL,120); |
ram54288 | 0:a2cb7295a1f7 | 370 | |
ram54288 | 0:a2cb7295a1f7 | 371 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_UPDATE_REGISTRATION); |
ram54288 | 0:a2cb7295a1f7 | 372 | |
ram54288 | 0:a2cb7295a1f7 | 373 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 374 | impl->update_registration(NULL,120); |
ram54288 | 0:a2cb7295a1f7 | 375 | |
ram54288 | 0:a2cb7295a1f7 | 376 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 377 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 378 | |
ram54288 | 0:a2cb7295a1f7 | 379 | impl->_current_state = M2MInterfaceImpl::STATE_BOOTSTRAP; |
ram54288 | 0:a2cb7295a1f7 | 380 | impl->update_registration(NULL,120); |
ram54288 | 0:a2cb7295a1f7 | 381 | |
ram54288 | 0:a2cb7295a1f7 | 382 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP); |
ram54288 | 0:a2cb7295a1f7 | 383 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 384 | |
ram54288 | 0:a2cb7295a1f7 | 385 | impl->update_registration(NULL,30); |
ram54288 | 0:a2cb7295a1f7 | 386 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 387 | |
ram54288 | 0:a2cb7295a1f7 | 388 | impl->update_registration(NULL,120); |
ram54288 | 0:a2cb7295a1f7 | 389 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 390 | |
ram54288 | 0:a2cb7295a1f7 | 391 | |
ram54288 | 0:a2cb7295a1f7 | 392 | M2MObject *object = new M2MObject("test", "test"); |
ram54288 | 0:a2cb7295a1f7 | 393 | M2MObjectInstance *ins = object->create_object_instance(); |
ram54288 | 0:a2cb7295a1f7 | 394 | ins->create_dynamic_resource("test","type",M2MResourceInstance::STRING,false,false); |
ram54288 | 0:a2cb7295a1f7 | 395 | |
ram54288 | 0:a2cb7295a1f7 | 396 | M2MObjectList list; |
ram54288 | 0:a2cb7295a1f7 | 397 | list.push_back(object); |
ram54288 | 0:a2cb7295a1f7 | 398 | impl->_current_state = M2MInterfaceImpl::STATE_REGISTERED; |
ram54288 | 0:a2cb7295a1f7 | 399 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 400 | impl->update_registration(NULL, list); |
ram54288 | 0:a2cb7295a1f7 | 401 | |
ram54288 | 0:a2cb7295a1f7 | 402 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_UPDATE_REGISTRATION); |
ram54288 | 0:a2cb7295a1f7 | 403 | list.clear(); |
ram54288 | 0:a2cb7295a1f7 | 404 | |
ram54288 | 0:a2cb7295a1f7 | 405 | impl->_current_state = M2MInterfaceImpl::STATE_REGISTERED; |
ram54288 | 0:a2cb7295a1f7 | 406 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 407 | impl->update_registration(NULL, list); |
ram54288 | 0:a2cb7295a1f7 | 408 | |
ram54288 | 0:a2cb7295a1f7 | 409 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_UPDATE_REGISTRATION); |
ram54288 | 0:a2cb7295a1f7 | 410 | delete object; |
ram54288 | 0:a2cb7295a1f7 | 411 | |
ram54288 | 0:a2cb7295a1f7 | 412 | } |
ram54288 | 0:a2cb7295a1f7 | 413 | |
ram54288 | 0:a2cb7295a1f7 | 414 | void Test_M2MInterfaceImpl::test_unregister_object() |
ram54288 | 0:a2cb7295a1f7 | 415 | { |
ram54288 | 0:a2cb7295a1f7 | 416 | impl->_current_state = M2MInterfaceImpl::STATE_REGISTERED; |
ram54288 | 0:a2cb7295a1f7 | 417 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 418 | |
ram54288 | 0:a2cb7295a1f7 | 419 | impl->unregister_object(NULL); |
ram54288 | 0:a2cb7295a1f7 | 420 | |
ram54288 | 0:a2cb7295a1f7 | 421 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 422 | |
ram54288 | 0:a2cb7295a1f7 | 423 | impl->_current_state = M2MInterfaceImpl::STATE_REGISTERED; |
ram54288 | 0:a2cb7295a1f7 | 424 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 425 | |
ram54288 | 0:a2cb7295a1f7 | 426 | impl->unregister_object(NULL); |
ram54288 | 0:a2cb7295a1f7 | 427 | |
ram54288 | 0:a2cb7295a1f7 | 428 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 429 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 430 | |
ram54288 | 0:a2cb7295a1f7 | 431 | impl->_current_state = M2MInterfaceImpl::STATE_IDLE; |
ram54288 | 0:a2cb7295a1f7 | 432 | |
ram54288 | 0:a2cb7295a1f7 | 433 | impl->unregister_object(NULL); |
ram54288 | 0:a2cb7295a1f7 | 434 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 435 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 436 | } |
ram54288 | 0:a2cb7295a1f7 | 437 | |
ram54288 | 0:a2cb7295a1f7 | 438 | void Test_M2MInterfaceImpl::test_set_queue_sleep_handler() |
ram54288 | 0:a2cb7295a1f7 | 439 | { |
ram54288 | 0:a2cb7295a1f7 | 440 | callback_handler cb(this,&Test_M2MInterfaceImpl::test_callback_handler); |
ram54288 | 0:a2cb7295a1f7 | 441 | impl->set_queue_sleep_handler(cb); |
ram54288 | 0:a2cb7295a1f7 | 442 | CHECK(impl->_callback_handler != NULL); |
ram54288 | 0:a2cb7295a1f7 | 443 | |
ram54288 | 0:a2cb7295a1f7 | 444 | callback_handler cb1(NULL); |
ram54288 | 0:a2cb7295a1f7 | 445 | impl->set_queue_sleep_handler(cb1); |
ram54288 | 0:a2cb7295a1f7 | 446 | CHECK(impl->_callback_handler == NULL); |
ram54288 | 0:a2cb7295a1f7 | 447 | } |
ram54288 | 0:a2cb7295a1f7 | 448 | |
ram54288 | 0:a2cb7295a1f7 | 449 | |
ram54288 | 0:a2cb7295a1f7 | 450 | void Test_M2MInterfaceImpl::test_set_random_number_callback() |
ram54288 | 0:a2cb7295a1f7 | 451 | { |
ram54288 | 0:a2cb7295a1f7 | 452 | random_number_cb cb(&test_random_callback); |
ram54288 | 0:a2cb7295a1f7 | 453 | impl->set_random_number_callback(cb); |
ram54288 | 0:a2cb7295a1f7 | 454 | } |
ram54288 | 0:a2cb7295a1f7 | 455 | |
ram54288 | 0:a2cb7295a1f7 | 456 | void Test_M2MInterfaceImpl::test_set_entropy_callback() |
ram54288 | 0:a2cb7295a1f7 | 457 | { |
ram54288 | 0:a2cb7295a1f7 | 458 | impl->set_entropy_callback(ent_cb); |
ram54288 | 0:a2cb7295a1f7 | 459 | } |
ram54288 | 0:a2cb7295a1f7 | 460 | |
ram54288 | 0:a2cb7295a1f7 | 461 | void Test_M2MInterfaceImpl::test_set_platform_network_handler() |
ram54288 | 0:a2cb7295a1f7 | 462 | { |
ram54288 | 0:a2cb7295a1f7 | 463 | void *test = NULL; |
ram54288 | 0:a2cb7295a1f7 | 464 | impl->set_platform_network_handler(test); |
ram54288 | 0:a2cb7295a1f7 | 465 | } |
ram54288 | 0:a2cb7295a1f7 | 466 | |
ram54288 | 0:a2cb7295a1f7 | 467 | void Test_M2MInterfaceImpl::test_coap_message_ready() |
ram54288 | 0:a2cb7295a1f7 | 468 | { |
ram54288 | 0:a2cb7295a1f7 | 469 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 470 | uint8_t *data_ptr = (uint8_t *)malloc(sizeof(uint8_t)); |
ram54288 | 0:a2cb7295a1f7 | 471 | uint16_t data_len = sizeof(uint8_t); |
ram54288 | 0:a2cb7295a1f7 | 472 | sn_nsdl_addr_s *address_ptr = (sn_nsdl_addr_s*)malloc(sizeof(sn_nsdl_addr_s)); |
ram54288 | 0:a2cb7295a1f7 | 473 | |
ram54288 | 0:a2cb7295a1f7 | 474 | impl->coap_message_ready(data_ptr,data_len,address_ptr); |
ram54288 | 0:a2cb7295a1f7 | 475 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 476 | |
ram54288 | 0:a2cb7295a1f7 | 477 | impl->_current_state = M2MInterfaceImpl::STATE_WAITING; |
ram54288 | 0:a2cb7295a1f7 | 478 | impl->coap_message_ready(data_ptr,data_len,address_ptr); |
ram54288 | 0:a2cb7295a1f7 | 479 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 480 | |
ram54288 | 0:a2cb7295a1f7 | 481 | m2mconnectionhandler_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 482 | impl->coap_message_ready(data_ptr,data_len,address_ptr); |
ram54288 | 0:a2cb7295a1f7 | 483 | |
ram54288 | 0:a2cb7295a1f7 | 484 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 485 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 486 | |
ram54288 | 0:a2cb7295a1f7 | 487 | free(address_ptr); |
ram54288 | 0:a2cb7295a1f7 | 488 | free(data_ptr); |
ram54288 | 0:a2cb7295a1f7 | 489 | } |
ram54288 | 0:a2cb7295a1f7 | 490 | |
ram54288 | 0:a2cb7295a1f7 | 491 | void Test_M2MInterfaceImpl::test_client_registered() |
ram54288 | 0:a2cb7295a1f7 | 492 | { |
ram54288 | 0:a2cb7295a1f7 | 493 | impl->client_registered(NULL); |
ram54288 | 0:a2cb7295a1f7 | 494 | |
ram54288 | 0:a2cb7295a1f7 | 495 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTERED); |
ram54288 | 0:a2cb7295a1f7 | 496 | CHECK(observer->registered == true); |
ram54288 | 0:a2cb7295a1f7 | 497 | } |
ram54288 | 0:a2cb7295a1f7 | 498 | |
ram54288 | 0:a2cb7295a1f7 | 499 | void Test_M2MInterfaceImpl::test_registration_updated() |
ram54288 | 0:a2cb7295a1f7 | 500 | { |
ram54288 | 0:a2cb7295a1f7 | 501 | M2MServer *server = NULL; |
ram54288 | 0:a2cb7295a1f7 | 502 | impl->registration_updated(*server); |
ram54288 | 0:a2cb7295a1f7 | 503 | |
ram54288 | 0:a2cb7295a1f7 | 504 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTERED); |
ram54288 | 0:a2cb7295a1f7 | 505 | CHECK(observer->registered == true); |
ram54288 | 0:a2cb7295a1f7 | 506 | } |
ram54288 | 0:a2cb7295a1f7 | 507 | |
ram54288 | 0:a2cb7295a1f7 | 508 | void Test_M2MInterfaceImpl::test_registration_error() |
ram54288 | 0:a2cb7295a1f7 | 509 | { |
ram54288 | 0:a2cb7295a1f7 | 510 | impl->registration_error(1); |
ram54288 | 0:a2cb7295a1f7 | 511 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 512 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 513 | |
ram54288 | 0:a2cb7295a1f7 | 514 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 515 | impl->registration_error(1, true); |
ram54288 | 0:a2cb7295a1f7 | 516 | CHECK(observer->error_occured == false); |
ram54288 | 0:a2cb7295a1f7 | 517 | } |
ram54288 | 0:a2cb7295a1f7 | 518 | |
ram54288 | 0:a2cb7295a1f7 | 519 | void Test_M2MInterfaceImpl::test_client_unregistered() |
ram54288 | 0:a2cb7295a1f7 | 520 | { |
ram54288 | 0:a2cb7295a1f7 | 521 | impl->client_unregistered(); |
ram54288 | 0:a2cb7295a1f7 | 522 | |
ram54288 | 0:a2cb7295a1f7 | 523 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 524 | CHECK(observer->unregistered == true); |
ram54288 | 0:a2cb7295a1f7 | 525 | } |
ram54288 | 0:a2cb7295a1f7 | 526 | |
ram54288 | 0:a2cb7295a1f7 | 527 | void Test_M2MInterfaceImpl::test_bootstrap_wait() |
ram54288 | 0:a2cb7295a1f7 | 528 | { |
ram54288 | 0:a2cb7295a1f7 | 529 | M2MSecurity *sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 530 | impl->bootstrap_wait(sec); |
ram54288 | 0:a2cb7295a1f7 | 531 | |
ram54288 | 0:a2cb7295a1f7 | 532 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP_WAIT); |
ram54288 | 0:a2cb7295a1f7 | 533 | CHECK(impl->_security == sec); |
ram54288 | 0:a2cb7295a1f7 | 534 | CHECK(observer->bootstrapped == false); |
ram54288 | 0:a2cb7295a1f7 | 535 | |
ram54288 | 0:a2cb7295a1f7 | 536 | delete sec; |
ram54288 | 0:a2cb7295a1f7 | 537 | } |
ram54288 | 0:a2cb7295a1f7 | 538 | |
ram54288 | 0:a2cb7295a1f7 | 539 | |
ram54288 | 0:a2cb7295a1f7 | 540 | void Test_M2MInterfaceImpl::test_bootstrap_done() |
ram54288 | 0:a2cb7295a1f7 | 541 | { |
ram54288 | 0:a2cb7295a1f7 | 542 | M2MSecurity *sec = new M2MSecurity(M2MSecurity::M2MServer); |
ram54288 | 0:a2cb7295a1f7 | 543 | impl->bootstrap_done(sec); |
ram54288 | 0:a2cb7295a1f7 | 544 | |
ram54288 | 0:a2cb7295a1f7 | 545 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAPPED); |
ram54288 | 0:a2cb7295a1f7 | 546 | CHECK(observer->bootstrapped == true); |
ram54288 | 0:a2cb7295a1f7 | 547 | |
ram54288 | 0:a2cb7295a1f7 | 548 | delete sec; |
ram54288 | 0:a2cb7295a1f7 | 549 | } |
ram54288 | 0:a2cb7295a1f7 | 550 | |
ram54288 | 0:a2cb7295a1f7 | 551 | void Test_M2MInterfaceImpl::test_bootstrap_error() |
ram54288 | 0:a2cb7295a1f7 | 552 | { |
ram54288 | 0:a2cb7295a1f7 | 553 | impl->bootstrap_error(); |
ram54288 | 0:a2cb7295a1f7 | 554 | |
ram54288 | 0:a2cb7295a1f7 | 555 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 556 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 557 | } |
ram54288 | 0:a2cb7295a1f7 | 558 | |
ram54288 | 0:a2cb7295a1f7 | 559 | void Test_M2MInterfaceImpl::test_coap_data_processed() |
ram54288 | 0:a2cb7295a1f7 | 560 | { |
ram54288 | 0:a2cb7295a1f7 | 561 | impl->coap_data_processed(); |
ram54288 | 0:a2cb7295a1f7 | 562 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 563 | } |
ram54288 | 0:a2cb7295a1f7 | 564 | |
ram54288 | 0:a2cb7295a1f7 | 565 | void Test_M2MInterfaceImpl::test_value_updated() |
ram54288 | 0:a2cb7295a1f7 | 566 | { |
ram54288 | 0:a2cb7295a1f7 | 567 | impl->value_updated(NULL); |
ram54288 | 0:a2cb7295a1f7 | 568 | CHECK(observer->val_updated == false); |
ram54288 | 0:a2cb7295a1f7 | 569 | |
ram54288 | 0:a2cb7295a1f7 | 570 | M2MBaseTest b; |
ram54288 | 0:a2cb7295a1f7 | 571 | impl->value_updated(&b); |
ram54288 | 0:a2cb7295a1f7 | 572 | CHECK(observer->val_updated == true); |
ram54288 | 0:a2cb7295a1f7 | 573 | } |
ram54288 | 0:a2cb7295a1f7 | 574 | |
ram54288 | 0:a2cb7295a1f7 | 575 | void Test_M2MInterfaceImpl::test_data_available() |
ram54288 | 0:a2cb7295a1f7 | 576 | { |
ram54288 | 0:a2cb7295a1f7 | 577 | uint8_t* data = (uint8_t*)malloc(sizeof(uint8_t)); |
ram54288 | 0:a2cb7295a1f7 | 578 | uint16_t data_size = sizeof(uint8_t); |
ram54288 | 0:a2cb7295a1f7 | 579 | M2MConnectionObserver::SocketAddress *address = (M2MConnectionObserver::SocketAddress*) |
ram54288 | 0:a2cb7295a1f7 | 580 | malloc(sizeof(M2MConnectionObserver::SocketAddress)); |
ram54288 | 0:a2cb7295a1f7 | 581 | |
ram54288 | 0:a2cb7295a1f7 | 582 | address->_stack = M2MInterface::LwIP_IPv4; |
ram54288 | 0:a2cb7295a1f7 | 583 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 584 | |
ram54288 | 0:a2cb7295a1f7 | 585 | impl->data_available(data,data_size,*address); |
ram54288 | 0:a2cb7295a1f7 | 586 | |
ram54288 | 0:a2cb7295a1f7 | 587 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 588 | |
ram54288 | 0:a2cb7295a1f7 | 589 | address->_stack = M2MInterface::LwIP_IPv6; |
ram54288 | 0:a2cb7295a1f7 | 590 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 591 | |
ram54288 | 0:a2cb7295a1f7 | 592 | impl->data_available(data,data_size,*address); |
ram54288 | 0:a2cb7295a1f7 | 593 | |
ram54288 | 0:a2cb7295a1f7 | 594 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 595 | |
ram54288 | 0:a2cb7295a1f7 | 596 | address->_stack = M2MInterface::LwIP_IPv4; |
ram54288 | 0:a2cb7295a1f7 | 597 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 598 | |
ram54288 | 0:a2cb7295a1f7 | 599 | impl->data_available(data,data_size,*address); |
ram54288 | 0:a2cb7295a1f7 | 600 | |
ram54288 | 0:a2cb7295a1f7 | 601 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 602 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 603 | |
ram54288 | 0:a2cb7295a1f7 | 604 | free(data); |
ram54288 | 0:a2cb7295a1f7 | 605 | free(address); |
ram54288 | 0:a2cb7295a1f7 | 606 | } |
ram54288 | 0:a2cb7295a1f7 | 607 | |
ram54288 | 0:a2cb7295a1f7 | 608 | void Test_M2MInterfaceImpl::test_socket_error() |
ram54288 | 0:a2cb7295a1f7 | 609 | { |
ram54288 | 0:a2cb7295a1f7 | 610 | for (int i = 0; i <= MBED_CLIENT_RECONNECTION_COUNT; i++) { |
ram54288 | 0:a2cb7295a1f7 | 611 | impl->socket_error(M2MConnectionHandler::SSL_CONNECTION_ERROR); |
ram54288 | 0:a2cb7295a1f7 | 612 | impl->_retry_timer_expired = true; |
ram54288 | 0:a2cb7295a1f7 | 613 | } |
ram54288 | 0:a2cb7295a1f7 | 614 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 615 | |
ram54288 | 0:a2cb7295a1f7 | 616 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 617 | impl->socket_error(M2MConnectionHandler::SOCKET_READ_ERROR, false); |
ram54288 | 0:a2cb7295a1f7 | 618 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 619 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 620 | |
ram54288 | 0:a2cb7295a1f7 | 621 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 622 | impl->socket_error(M2MConnectionHandler::DNS_RESOLVING_ERROR, false); |
ram54288 | 0:a2cb7295a1f7 | 623 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 624 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 625 | |
ram54288 | 0:a2cb7295a1f7 | 626 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 627 | impl->socket_error(M2MConnectionHandler::SOCKET_SEND_ERROR, false); |
ram54288 | 0:a2cb7295a1f7 | 628 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 629 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 630 | |
ram54288 | 0:a2cb7295a1f7 | 631 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 632 | impl->socket_error(M2MConnectionHandler::SSL_HANDSHAKE_ERROR, false); |
ram54288 | 0:a2cb7295a1f7 | 633 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 634 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 635 | |
ram54288 | 0:a2cb7295a1f7 | 636 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 637 | impl->socket_error(M2MConnectionHandler::SOCKET_ABORT, false); |
ram54288 | 0:a2cb7295a1f7 | 638 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 639 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 640 | |
ram54288 | 0:a2cb7295a1f7 | 641 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 642 | impl->socket_error(M2MConnectionHandler::ERROR_NONE, false); |
ram54288 | 0:a2cb7295a1f7 | 643 | CHECK(observer->error_occured == false); |
ram54288 | 0:a2cb7295a1f7 | 644 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 645 | } |
ram54288 | 0:a2cb7295a1f7 | 646 | |
ram54288 | 0:a2cb7295a1f7 | 647 | void Test_M2MInterfaceImpl::test_address_ready() |
ram54288 | 0:a2cb7295a1f7 | 648 | { |
ram54288 | 0:a2cb7295a1f7 | 649 | M2MConnectionObserver::SocketAddress *address = |
ram54288 | 0:a2cb7295a1f7 | 650 | (M2MConnectionObserver::SocketAddress*) malloc(sizeof(M2MConnectionObserver::SocketAddress)); |
ram54288 | 0:a2cb7295a1f7 | 651 | M2MConnectionObserver::ServerType server_type = M2MConnectionObserver::Bootstrap; |
ram54288 | 0:a2cb7295a1f7 | 652 | uint16_t server_port = 5685; |
ram54288 | 0:a2cb7295a1f7 | 653 | |
ram54288 | 0:a2cb7295a1f7 | 654 | address->_stack = M2MInterface::LwIP_IPv6; |
ram54288 | 0:a2cb7295a1f7 | 655 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 656 | |
ram54288 | 0:a2cb7295a1f7 | 657 | impl->address_ready(*address,server_type,server_port); |
ram54288 | 0:a2cb7295a1f7 | 658 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP_RESOURCE_CREATED); |
ram54288 | 0:a2cb7295a1f7 | 659 | |
ram54288 | 0:a2cb7295a1f7 | 660 | address->_stack = M2MInterface::LwIP_IPv4; |
ram54288 | 0:a2cb7295a1f7 | 661 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 662 | |
ram54288 | 0:a2cb7295a1f7 | 663 | impl->address_ready(*address,server_type,server_port); |
ram54288 | 0:a2cb7295a1f7 | 664 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_BOOTSTRAP_RESOURCE_CREATED); |
ram54288 | 0:a2cb7295a1f7 | 665 | |
ram54288 | 0:a2cb7295a1f7 | 666 | |
ram54288 | 0:a2cb7295a1f7 | 667 | address->_stack = M2MInterface::LwIP_IPv6; |
ram54288 | 0:a2cb7295a1f7 | 668 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 669 | |
ram54288 | 0:a2cb7295a1f7 | 670 | impl->address_ready(*address,server_type,server_port); |
ram54288 | 0:a2cb7295a1f7 | 671 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 672 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 673 | |
ram54288 | 0:a2cb7295a1f7 | 674 | // Test for Address resolving for LWM2M server |
ram54288 | 0:a2cb7295a1f7 | 675 | server_type = M2MConnectionObserver::LWM2MServer; |
ram54288 | 0:a2cb7295a1f7 | 676 | |
ram54288 | 0:a2cb7295a1f7 | 677 | address->_stack = M2MInterface::LwIP_IPv4; |
ram54288 | 0:a2cb7295a1f7 | 678 | m2mnsdlinterface_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 679 | |
ram54288 | 0:a2cb7295a1f7 | 680 | impl->address_ready(*address,server_type,server_port); |
ram54288 | 0:a2cb7295a1f7 | 681 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTER_ADDRESS_RESOLVED); |
ram54288 | 0:a2cb7295a1f7 | 682 | |
ram54288 | 0:a2cb7295a1f7 | 683 | impl->address_ready(*address,server_type,server_port); |
ram54288 | 0:a2cb7295a1f7 | 684 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_REGISTER_ADDRESS_RESOLVED); |
ram54288 | 0:a2cb7295a1f7 | 685 | |
ram54288 | 0:a2cb7295a1f7 | 686 | address->_stack = M2MInterface::LwIP_IPv6; |
ram54288 | 0:a2cb7295a1f7 | 687 | m2mnsdlinterface_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 688 | |
ram54288 | 0:a2cb7295a1f7 | 689 | impl->address_ready(*address,server_type,server_port); |
ram54288 | 0:a2cb7295a1f7 | 690 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_IDLE); |
ram54288 | 0:a2cb7295a1f7 | 691 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 692 | |
ram54288 | 0:a2cb7295a1f7 | 693 | free(address); |
ram54288 | 0:a2cb7295a1f7 | 694 | } |
ram54288 | 0:a2cb7295a1f7 | 695 | |
ram54288 | 0:a2cb7295a1f7 | 696 | void Test_M2MInterfaceImpl::test_data_sent() |
ram54288 | 0:a2cb7295a1f7 | 697 | { |
ram54288 | 0:a2cb7295a1f7 | 698 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 699 | |
ram54288 | 0:a2cb7295a1f7 | 700 | impl->data_sent(); |
ram54288 | 0:a2cb7295a1f7 | 701 | |
ram54288 | 0:a2cb7295a1f7 | 702 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 703 | |
ram54288 | 0:a2cb7295a1f7 | 704 | m2mconnectionhandler_stub::bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 705 | |
ram54288 | 0:a2cb7295a1f7 | 706 | impl->data_sent(); |
ram54288 | 0:a2cb7295a1f7 | 707 | |
ram54288 | 0:a2cb7295a1f7 | 708 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 709 | CHECK(observer->error_occured == false); |
ram54288 | 0:a2cb7295a1f7 | 710 | |
ram54288 | 0:a2cb7295a1f7 | 711 | impl->_callback_handler = callback_handler(this, &Test_M2MInterfaceImpl::test_callback_handler); |
ram54288 | 0:a2cb7295a1f7 | 712 | |
ram54288 | 0:a2cb7295a1f7 | 713 | m2mconnectionhandler_stub::bool_value = true; |
ram54288 | 0:a2cb7295a1f7 | 714 | |
ram54288 | 0:a2cb7295a1f7 | 715 | impl->_binding_mode = M2MInterface::UDP_QUEUE; |
ram54288 | 0:a2cb7295a1f7 | 716 | impl->data_sent(); |
ram54288 | 0:a2cb7295a1f7 | 717 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 718 | |
ram54288 | 0:a2cb7295a1f7 | 719 | impl->_binding_mode = M2MInterface::TCP_QUEUE; |
ram54288 | 0:a2cb7295a1f7 | 720 | impl->data_sent(); |
ram54288 | 0:a2cb7295a1f7 | 721 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 722 | |
ram54288 | 0:a2cb7295a1f7 | 723 | impl->_binding_mode = M2MInterface::SMS_QUEUE; |
ram54288 | 0:a2cb7295a1f7 | 724 | impl->data_sent(); |
ram54288 | 0:a2cb7295a1f7 | 725 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 726 | |
ram54288 | 0:a2cb7295a1f7 | 727 | impl->_binding_mode = M2MInterface::UDP_SMS_QUEUE; |
ram54288 | 0:a2cb7295a1f7 | 728 | impl->data_sent(); |
ram54288 | 0:a2cb7295a1f7 | 729 | CHECK(impl->_current_state == M2MInterfaceImpl::STATE_WAITING); |
ram54288 | 0:a2cb7295a1f7 | 730 | } |
ram54288 | 0:a2cb7295a1f7 | 731 | |
ram54288 | 0:a2cb7295a1f7 | 732 | void Test_M2MInterfaceImpl::test_timer_expired() |
ram54288 | 0:a2cb7295a1f7 | 733 | { |
ram54288 | 0:a2cb7295a1f7 | 734 | visited = false; |
ram54288 | 0:a2cb7295a1f7 | 735 | impl->_callback_handler = NULL; |
ram54288 | 0:a2cb7295a1f7 | 736 | impl->timer_expired(M2MTimerObserver::QueueSleep); |
ram54288 | 0:a2cb7295a1f7 | 737 | CHECK(visited == false); |
ram54288 | 0:a2cb7295a1f7 | 738 | |
ram54288 | 0:a2cb7295a1f7 | 739 | impl->_callback_handler = callback_handler(this, &Test_M2MInterfaceImpl::test_callback_handler); |
ram54288 | 0:a2cb7295a1f7 | 740 | |
ram54288 | 0:a2cb7295a1f7 | 741 | visited = false; |
ram54288 | 0:a2cb7295a1f7 | 742 | impl->timer_expired(M2MTimerObserver::QueueSleep); |
ram54288 | 0:a2cb7295a1f7 | 743 | CHECK(visited == true); |
ram54288 | 0:a2cb7295a1f7 | 744 | visited = false; |
ram54288 | 0:a2cb7295a1f7 | 745 | |
ram54288 | 0:a2cb7295a1f7 | 746 | impl->_bootstrapped = true; |
ram54288 | 0:a2cb7295a1f7 | 747 | impl->timer_expired(M2MTimerObserver::RetryTimer); |
ram54288 | 0:a2cb7295a1f7 | 748 | CHECK(impl->_retry_timer_expired == true); |
ram54288 | 0:a2cb7295a1f7 | 749 | |
ram54288 | 0:a2cb7295a1f7 | 750 | impl->_bootstrapped = false; |
ram54288 | 0:a2cb7295a1f7 | 751 | impl->timer_expired(M2MTimerObserver::RetryTimer); |
ram54288 | 0:a2cb7295a1f7 | 752 | CHECK(impl->_retry_timer_expired == true); |
ram54288 | 0:a2cb7295a1f7 | 753 | |
ram54288 | 0:a2cb7295a1f7 | 754 | observer->error_occured = false; |
ram54288 | 0:a2cb7295a1f7 | 755 | impl->timer_expired(M2MTimerObserver::BootstrapTimer); |
ram54288 | 0:a2cb7295a1f7 | 756 | CHECK(observer->error_occured == true); |
ram54288 | 0:a2cb7295a1f7 | 757 | } |
ram54288 | 0:a2cb7295a1f7 | 758 | |
ram54288 | 0:a2cb7295a1f7 | 759 | void Test_M2MInterfaceImpl::test_callback_handler() |
ram54288 | 0:a2cb7295a1f7 | 760 | { |
ram54288 | 0:a2cb7295a1f7 | 761 | visited = true; |
ram54288 | 0:a2cb7295a1f7 | 762 | } |
ram54288 | 0:a2cb7295a1f7 | 763 | |
ram54288 | 0:a2cb7295a1f7 | 764 | uint32_t test_random_callback(void) |
ram54288 | 0:a2cb7295a1f7 | 765 | { |
ram54288 | 0:a2cb7295a1f7 | 766 | return 1; |
ram54288 | 0:a2cb7295a1f7 | 767 | } |