Skip to content

Commit 24213b4

Browse files
author
Teppo Järvelin
committed
astyles fixes for UNITESTS.
1 parent e5c3024 commit 24213b4

File tree

4 files changed

+102
-44
lines changed

4 files changed

+102
-44
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,33 @@ class my_stack : public AT_CellularStack {
104104
return 100;
105105
}
106106

107-
virtual const char *get_ip_address() { return "1.2.3.4";}
107+
virtual const char *get_ip_address()
108+
{
109+
return "1.2.3.4";
110+
}
108111
};
109112

110113
class my_AT_CTX : public AT_CellularContext {
111114
public:
112115
my_AT_CTX(ATHandler &at, CellularDevice *device, const char *apn = MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN) :
113116
AT_CellularContext(at, device, apn), _st(at) {}
114117
virtual ~my_AT_CTX() {}
115-
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type) { return false;}
116-
virtual NetworkStack *get_stack() {return &_st;}
117-
virtual uint32_t get_timeout_for_operation(ContextOperation op) const { return 10;}
118-
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr) { AT_CellularContext::cellular_callback(ev, ptr);}
118+
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type)
119+
{
120+
return false;
121+
}
122+
virtual NetworkStack *get_stack()
123+
{
124+
return &_st;
125+
}
126+
virtual uint32_t get_timeout_for_operation(ContextOperation op) const
127+
{
128+
return 10;
129+
}
130+
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr)
131+
{
132+
AT_CellularContext::cellular_callback(ev, ptr);
133+
}
119134

120135
my_stack _st;
121136
};
@@ -125,9 +140,18 @@ class my_AT_CTXIPV6 : public AT_CellularContext {
125140
my_AT_CTXIPV6(ATHandler &at, CellularDevice *device, const char *apn = MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN) :
126141
AT_CellularContext(at, device, apn), _st(at) {}
127142
virtual ~my_AT_CTXIPV6() {}
128-
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type) {return true;}
129-
virtual NetworkStack *get_stack() {return &_st;}
130-
virtual uint32_t get_timeout_for_operation(ContextOperation op) const { return 10;}
143+
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type)
144+
{
145+
return true;
146+
}
147+
virtual NetworkStack *get_stack()
148+
{
149+
return &_st;
150+
}
151+
virtual uint32_t get_timeout_for_operation(ContextOperation op) const
152+
{
153+
return 10;
154+
}
131155
my_stack _st;
132156
};
133157

@@ -258,7 +282,7 @@ TEST_F(TestAT_CellularContext, get_netmask_gateway)
258282
ATHandler at(&fh1, que, 0, ",");
259283
AT_CellularDevice dev(&fh1);
260284
AT_CellularContext ctx(at, &dev);
261-
const char* gg = ctx.get_netmask();
285+
const char *gg = ctx.get_netmask();
262286
EXPECT_TRUE(gg == NULL);
263287
gg = ctx.get_gateway();
264288
EXPECT_TRUE(gg == NULL);

UNITTESTS/stubs/AT_CellularDevice_stub.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const int DEFAULT_AT_TIMEOUT = 1000;
2424
using namespace mbed;
2525

2626
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), _network(0), _sms(0),
27-
_sim(0), _power(0), _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT),
28-
_modem_debug_on(false)
27+
_sim(0), _power(0), _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT),
28+
_modem_debug_on(false)
2929
{
3030
_atHandlers = new ATHandler(fh, _queue, 0, ",");
3131
}

UNITTESTS/stubs/CellularStateMachine_stub.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
#include "CellularStateMachine.h"
2121

2222
enum CellularStubState {
23-
STATE_INIT = 0,
24-
STATE_POWER_ON,
25-
STATE_DEVICE_READY,
26-
STATE_SIM_PIN,
27-
STATE_REGISTERING_NETWORK,
28-
STATE_MANUAL_REGISTERING_NETWORK,
29-
STATE_ATTACHING_NETWORK,
30-
STATE_MAX_FSM_STATE
31-
};
23+
STATE_INIT = 0,
24+
STATE_POWER_ON,
25+
STATE_DEVICE_READY,
26+
STATE_SIM_PIN,
27+
STATE_REGISTERING_NETWORK,
28+
STATE_MANUAL_REGISTERING_NETWORK,
29+
STATE_ATTACHING_NETWORK,
30+
STATE_MAX_FSM_STATE
31+
};
3232

3333
namespace CellularStateMachine_stub {
3434
extern nsapi_error_t nsapi_error_value;

UNITTESTS/target_h/myCellularDevice.h

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,57 +34,91 @@ class CellularInformation;
3434
class CellularContext;
3535
class FileHandle;
3636

37-
class myCellularDevice : public CellularDevice
38-
{
37+
class myCellularDevice : public CellularDevice {
3938
public:
40-
myCellularDevice(FileHandle *fh) : CellularDevice (fh), _context_list(0), _network(0) {}
41-
~myCellularDevice() {
39+
myCellularDevice(FileHandle *fh) : CellularDevice(fh), _context_list(0), _network(0) {}
40+
~myCellularDevice()
41+
{
4242
delete _context_list;
4343
delete _network;
4444
}
45-
virtual CellularContext *create_context(FileHandle *fh = NULL, const char *apn = NULL) {
45+
virtual CellularContext *create_context(FileHandle *fh = NULL, const char *apn = NULL)
46+
{
4647
EventQueue que;
4748
FileHandle_stub fh1;
4849
ATHandler at(&fh1, que, 0, ",");
4950
_context_list = new AT_CellularContext(at, NULL);
50-
return _context_list;}
51-
virtual void delete_context(CellularContext *context) { delete _context_list;}
51+
return _context_list;
52+
}
53+
virtual void delete_context(CellularContext *context)
54+
{
55+
delete _context_list;
56+
}
5257

53-
virtual CellularNetwork *open_network(FileHandle *fh = NULL) {
58+
virtual CellularNetwork *open_network(FileHandle *fh = NULL)
59+
{
5460
EventQueue que;
5561
FileHandle_stub fh1;
5662
ATHandler at(&fh1, que, 0, ",");
5763
_network = new AT_CellularNetwork(at);
58-
return _network;}
64+
return _network;
65+
}
5966

60-
virtual CellularSMS *open_sms(FileHandle *fh = NULL) {return NULL;}
67+
virtual CellularSMS *open_sms(FileHandle *fh = NULL)
68+
{
69+
return NULL;
70+
}
6171

62-
virtual CellularPower *open_power(FileHandle *fh = NULL) {return NULL;}
72+
virtual CellularPower *open_power(FileHandle *fh = NULL)
73+
{
74+
return NULL;
75+
}
6376

64-
virtual CellularSIM *open_sim(FileHandle *fh = NULL) {return NULL;}
77+
virtual CellularSIM *open_sim(FileHandle *fh = NULL)
78+
{
79+
return NULL;
80+
}
6581

66-
virtual CellularInformation *open_information(FileHandle *fh = NULL) {return NULL;}
82+
virtual CellularInformation *open_information(FileHandle *fh = NULL)
83+
{
84+
return NULL;
85+
}
6786

68-
virtual void close_network(){delete _network;}
87+
virtual void close_network()
88+
{
89+
delete _network;
90+
}
6991

70-
virtual void close_sms(){}
92+
virtual void close_sms() {}
7193

72-
virtual void close_power(){}
94+
virtual void close_power() {}
7395

74-
virtual void close_sim(){}
96+
virtual void close_sim() {}
7597

76-
virtual void close_information(){}
98+
virtual void close_information() {}
7799

78-
virtual void set_timeout(int timeout){}
100+
virtual void set_timeout(int timeout) {}
79101

80-
virtual uint16_t get_send_delay() const{ return 0;}
102+
virtual uint16_t get_send_delay() const
103+
{
104+
return 0;
105+
}
81106

82-
virtual void modem_debug_on(bool on){}
107+
virtual void modem_debug_on(bool on) {}
83108

84-
virtual nsapi_error_t init_module(){ return 0;}
109+
virtual nsapi_error_t init_module()
110+
{
111+
return 0;
112+
}
85113

86-
virtual CellularContext *get_context_list() const { return _context_list;}
87-
void cellular_callback(nsapi_event_t ev, intptr_t ptr) {CellularDevice::cellular_callback(ev, ptr);}
114+
virtual CellularContext *get_context_list() const
115+
{
116+
return _context_list;
117+
}
118+
void cellular_callback(nsapi_event_t ev, intptr_t ptr)
119+
{
120+
CellularDevice::cellular_callback(ev, ptr);
121+
}
88122
AT_CellularNetwork *_network;
89123
AT_CellularContext *_context_list;
90124
};

0 commit comments

Comments
 (0)