11 # define NUL "/dev/null"
16 void single_check(const char *device
, const char *connection
, const char *model
, GSM_Error expected
)
20 GSM_Debug_Info
*debug_info
;
22 /* Allocates state machine */
23 s
= GSM_AllocStateMachine();
24 test_result(s
!= NULL
);
26 debug_info
= GSM_GetDebug(s
);
27 GSM_SetDebugGlobal(TRUE
, debug_info
);
29 smcfg
= GSM_GetConfig(s
, 0);
30 strcpy(smcfg
->Model
, model
);
31 smcfg
->Device
= strdup(device
);
32 smcfg
->UseGlobalDebugFile
= TRUE
;
33 smcfg
->Connection
= strdup(connection
);
34 smcfg
->PhoneFeatures
[0] = F_PBK_ENCODENUMBER
;
35 smcfg
->PhoneFeatures
[1] = 0;
36 GSM_SetConfigNum(s
, 1);
38 error
= GSM_InitConnection(s
, 1);
39 test_result(error
== expected
);
41 /* Free state machine */
42 GSM_FreeStateMachine(s
);
45 int main(int argc UNUSED
, char **argv UNUSED
)
47 GSM_Debug_Info
*debug_info
;
49 debug_info
= GSM_GetGlobalDebug();
50 GSM_SetDebugFileDescriptor(stderr
, FALSE
, debug_info
);
51 GSM_SetDebugLevel("textall", debug_info
);
53 single_check("/NONEXISTING/DEVICE/NODE", "NONSENSE", "", ERR_UNKNOWNCONNECTIONTYPESTRING
);
55 single_check("/NONEXISTING/DEVICE/NODE", "at", "", ERR_DEVICENOTEXIST
);
56 single_check("/NONEXISTING/DEVICE/NODE", "at-nodtr", "", ERR_DEVICENOTEXIST
);
57 single_check("/NONEXISTING/DEVICE/NODE", "at19200-nopower", "", ERR_DEVICENOTEXIST
);
58 single_check("/NONEXISTING/DEVICE/NODE", "at115200", "", ERR_DEVICENOTEXIST
);
59 single_check("/NONEXISTING/DEVICE/NODE", "at", "at", ERR_DEVICENOTEXIST
);
60 single_check("/NONEXISTING/DEVICE/NODE", "at", "atobex", ERR_DEVICENOTEXIST
);
61 single_check(NUL
, "at", "", ERR_DEVICEOPENERROR
);
62 single_check(NUL
, "at ", "", ERR_DEVICEOPENERROR
);
64 #ifdef GSM_ENABLE_FBUS2DLR3
65 single_check("/NONEXISTING/DEVICE/NODE", "dlr3", "", ERR_DEVICENOTEXIST
);
67 single_check("/dev/null ", "dlr3", "", ERR_DEVICEOPENERROR
);
70 #ifdef GSM_ENABLE_DKU5FBUS2
71 single_check("/NONEXISTING/DEVICE/NODE", "dku5", "", ERR_DEVICENOTEXIST
);
73 single_check("/dev/null ", "dku5", "", ERR_DEVICEOPENERROR
);
80 /* Editor configuration
81 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: