Translation update done using Pootle.
[gammu.git] / tests / CMakeLists.txt
blobe3df1d5381274e8b5aa8ae8f4f03b5ff11048ef6
1 # cmake <http://www.cmake.org> build file for Gammu
2 # Copyright © 2007 - 2009 Michal Čihař
3 # vim: expandtab sw=4 ts=4 sts=4:
5 project (gammu-tests C)
7 include(SetupDummyPhone)
9 include(GammuTuneCompiler)
11 # Define path for cmake tests
12 if (EXECUTABLE_OUTPUT_PATH)
13     set (GAMMU_TEST_PATH "${EXECUTABLE_OUTPUT_PATH}/")
14 else (EXECUTABLE_OUTPUT_PATH)
15     set (GAMMU_TEST_PATH "${CMAKE_CURRENT_BINARY_DIR}/")
16 endif (EXECUTABLE_OUTPUT_PATH)
18 # We use Gammu
19 include_directories("${CMAKE_CURRENT_BINARY_DIR}/../include")
21 # Basic check for statemachine allocation
22 add_executable(statemachine-alloc statemachine-alloc.c)
23 target_link_libraries(statemachine-alloc libGammu ${LIBINTL_LIBRARIES})
24 add_test(statemachine-alloc "${GAMMU_TEST_PATH}/statemachine-alloc${GAMMU_TEST_SUFFIX}")
26 if (BLUETOOTH_RF_SEARCHING)
27     add_executable(bluetooth_checkservicename bluetooth_checkservicename.c)
28     target_link_libraries(bluetooth_checkservicename libGammu ${LIBINTL_LIBRARIES})
29     add_test(bluetooth_checkservicename "${GAMMU_TEST_PATH}/bluetooth_checkservicename${GAMMU_TEST_SUFFIX}")
30 endif (BLUETOOTH_RF_SEARCHING)
32 # Basic check for sizes
33 add_executable(sizes sizes.c)
34 add_test(sizes "${GAMMU_TEST_PATH}/sizes${GAMMU_TEST_SUFFIX}")
35 set_tests_properties(sizes PROPERTIES
36     FAIL_REGULAR_EXPRESSION "[0-9][0-9] MiB")
38 add_executable(base64 base64.c)
39 target_link_libraries(base64 libGammu ${LIBINTL_LIBRARIES})
40 add_test(base64 "${GAMMU_TEST_PATH}/base64${GAMMU_TEST_SUFFIX}")
42 # Array manipulation tests
43 add_executable(array-test array-test.c)
44 target_link_libraries (array-test array)
45 add_test(array "${GAMMU_TEST_PATH}/array-test${GAMMU_TEST_SUFFIX}")
47 # SQL backend date parsing
48 if (HAVE_MYSQL_MYSQL_H OR LIBDBI_FOUND OR HAVE_POSTGRESQL_LIBPQ_FE_H)
49     if (LIBDBI_FOUND)
50         include_directories (${LIBDBI_INCLUDE_DIR})
51     endif (LIBDBI_FOUND)
53     if (MYSQL_FOUND)
54         include_directories (${MYSQL_INCLUDE_DIR})
55     endif (MYSQL_FOUND)
57     if (POSTGRES_FOUND)
58         include_directories (${POSTGRES_INCLUDE_DIR})
59     endif (POSTGRES_FOUND)
61     add_executable(sql-parse-date sql-parse-date.c)
62     target_link_libraries (sql-parse-date gsmsd)
63     add_test(sql-parse-date "${GAMMU_TEST_PATH}/sql-parse-date${GAMMU_TEST_SUFFIX}")
64 endif (HAVE_MYSQL_MYSQL_H OR LIBDBI_FOUND OR HAVE_POSTGRESQL_LIBPQ_FE_H)
66 # Backup comments
67 if (WITH_BACKUP)
68     add_executable(backup-comment backup-comment.c)
69     target_link_libraries (backup-comment libGammu ${LIBINTL_LIBRARIES})
70     add_test(backup-comment "${GAMMU_TEST_PATH}/backup-comment${GAMMU_TEST_SUFFIX}")
71 endif (WITH_BACKUP)
73 # Backup reading
74 if (WITH_BACKUP)
75     add_executable(read-backup read-backup.c)
76     target_link_libraries (read-backup libGammu ${LIBINTL_LIBRARIES})
78     # List test cases
79     file(GLOB BACKUPS
80         RELATIVE "${Gammu_SOURCE_DIR}/tests/backups"
81         "${Gammu_SOURCE_DIR}/tests/backups/*.backup")
82     list(SORT BACKUPS)
84     foreach(TESTBACKUP ${BACKUPS})
85         string(REPLACE .backup "" TESTNAME ${TESTBACKUP})
86         add_test("read-backup-${TESTNAME}"
87             "${GAMMU_TEST_PATH}/read-backup${GAMMU_TEST_SUFFIX}"
88             "${Gammu_SOURCE_DIR}/tests/backups/${TESTBACKUP}")
89     endforeach(TESTBACKUP $BACKUPS)
90 endif (WITH_BACKUP)
92 # Basic check for statemachine functionality
93 add_executable(statemachine-init statemachine-init.c)
94 target_link_libraries(statemachine-init libGammu ${LIBINTL_LIBRARIES})
95 add_test(statemachine-init "${GAMMU_TEST_PATH}/statemachine-init${GAMMU_TEST_SUFFIX}")
97 # USB device parsing
98 if (LIBUSB_FOUND AND WITH_NOKIA_SUPPORT)
99     add_executable(usb-device-parse usb-device-parse.c)
100     target_link_libraries(usb-device-parse libGammu ${LIBINTL_LIBRARIES})
101     add_test(usb-device-parse "${GAMMU_TEST_PATH}/usb-device-parse${GAMMU_TEST_SUFFIX}")
102 endif (LIBUSB_FOUND AND WITH_NOKIA_SUPPORT)
104 # Debug testing
105 add_executable(debug debug.c)
106 target_link_libraries(debug libGammu ${LIBINTL_LIBRARIES})
107 add_test(debug "${GAMMU_TEST_PATH}/debug${GAMMU_TEST_SUFFIX}")
109 # Check error code  descriptions
110 add_executable(dump-error-codes dump-error-codes.c)
111 target_link_libraries(dump-error-codes libGammu ${LIBINTL_LIBRARIES})
112 add_test(dump-error-codes "${GAMMU_TEST_PATH}/dump-error-codes${GAMMU_TEST_SUFFIX}" "-n")
114 # Check feature code names
115 add_executable(dump-features dump-features.c)
116 target_link_libraries(dump-features libGammu ${LIBINTL_LIBRARIES})
117 add_test(dump-features "${GAMMU_TEST_PATH}/dump-features${GAMMU_TEST_SUFFIX}" "-n")
119 # Check feature parsing
120 add_executable(features-parsing features-parsing.c)
121 target_link_libraries(features-parsing libGammu ${LIBINTL_LIBRARIES})
122 add_test(features-parsing "${GAMMU_TEST_PATH}/features-parsing${GAMMU_TEST_SUFFIX}" "-n")
124 # Check network codes decoding
125 add_executable(network-codes network-codes.c)
126 target_link_libraries(network-codes libGammu ${LIBINTL_LIBRARIES})
127 add_test(network-codes "${GAMMU_TEST_PATH}/network-codes${GAMMU_TEST_SUFFIX}" "-n")
129 if (WITH_BACKUP)
130     # smsbackup parsing
131     add_executable(smsbackup smsbackup.c)
132     target_link_libraries(smsbackup messagedisplay)
133     target_link_libraries(smsbackup libGammu ${LIBINTL_LIBRARIES})
135     # List test cases
136     file(GLOB VCARDS
137         RELATIVE "${Gammu_SOURCE_DIR}/tests/smsbackups"
138         "${Gammu_SOURCE_DIR}/tests/smsbackups/*.smsbackup")
139     list(SORT VCARDS)
141     foreach(TESTVCARD ${VCARDS})
142         string(REPLACE .smsbackup "" TESTNAME ${TESTVCARD})
143         add_test("smsbackup-${TESTNAME}"
144             "${GAMMU_TEST_PATH}/smsbackup${GAMMU_TEST_SUFFIX}"
145             "${Gammu_SOURCE_DIR}/tests/smsbackups/${TESTVCARD}")
146     endforeach(TESTVCARD $VCARDS)
147 endif (WITH_BACKUP)
149 if (WITH_BACKUP)
150     # vCard parsing
151     add_executable(vcard-read vcard-read.c)
152     target_link_libraries(vcard-read memorydisplay)
153     target_link_libraries(vcard-read libGammu ${LIBINTL_LIBRARIES})
155     # List test cases
156     file(GLOB VCARDS
157         RELATIVE "${Gammu_SOURCE_DIR}/tests/vcards"
158         "${Gammu_SOURCE_DIR}/tests/vcards/*.vcf")
159     list(SORT VCARDS)
161     foreach(TESTVCARD ${VCARDS})
162         string(REPLACE vcf backup TESTBACKUP ${TESTVCARD})
163         string(REPLACE .vcf "" TESTNAME ${TESTVCARD})
164         add_test("vcard-read-${TESTNAME}"
165             "${GAMMU_TEST_PATH}/vcard-read${GAMMU_TEST_SUFFIX}"
166             "${Gammu_SOURCE_DIR}/tests/vcards/${TESTVCARD}"
167             "${Gammu_SOURCE_DIR}/tests/vcards/${TESTBACKUP}")
168     endforeach(TESTVCARD $VCARDS)
170     file(GLOB VCARDS
171         RELATIVE "${Gammu_SOURCE_DIR}/tests/vcards-failing"
172         "${Gammu_SOURCE_DIR}/tests/vcards-failing/*.vcf")
173     list(SORT VCARDS)
175     foreach(TESTVCARD ${VCARDS})
176         string(REPLACE vcf backup TESTBACKUP ${TESTVCARD})
177         string(REPLACE .vcf "" TESTNAME ${TESTVCARD})
178         add_test("vcard-read-${TESTNAME}"
179             "${GAMMU_TEST_PATH}/vcard-read${GAMMU_TEST_SUFFIX}"
180             "${Gammu_SOURCE_DIR}/tests/vcards-failing/${TESTVCARD}"
181             "${Gammu_SOURCE_DIR}/tests/vcards-failing/${TESTBACKUP}")
182         set_tests_properties(
183             "vcard-read-${TESTNAME}"
184             PROPERTIES WILL_FAIL TRUE)
185     endforeach(TESTVCARD $VCARDS)
187     # LDIF parsing
188     add_executable(ldif-read ldif-read.c)
189     target_link_libraries(ldif-read memorydisplay)
190     target_link_libraries(ldif-read libGammu ${LIBINTL_LIBRARIES})
192     # List test cases
193     file(GLOB LDIFS
194         RELATIVE "${Gammu_SOURCE_DIR}/tests/ldif"
195         "${Gammu_SOURCE_DIR}/tests/ldif/*.ldif")
196     list(SORT LDIFS)
198     foreach(TESTLDIF ${LDIFS})
199         string(REPLACE ldif backup TESTBACKUP ${TESTLDIF})
200         string(REPLACE .ldif "" TESTNAME ${TESTLDIF})
201         add_test("ldif-read-${TESTNAME}"
202             "${GAMMU_TEST_PATH}/ldif-read${GAMMU_TEST_SUFFIX}"
203             "${Gammu_SOURCE_DIR}/tests/ldif/${TESTLDIF}"
204             "${Gammu_SOURCE_DIR}/tests/ldif/${TESTBACKUP}")
205     endforeach(TESTLDIF $LDIFS)
207 endif (WITH_BACKUP)
209 # [iv]Calendar parsing
210 if (WITH_BACKUP)
211     add_executable(cal-read cal-read.c)
212     target_link_libraries(cal-read libGammu ${LIBINTL_LIBRARIES})
214     # List test cases
215     file(GLOB VCALS
216         RELATIVE "${Gammu_SOURCE_DIR}/tests/vcal"
217         "${Gammu_SOURCE_DIR}/tests/vcal/*.vcs")
218     list(SORT VCALS)
220     foreach(TESTVCAL ${VCALS})
221         string(REPLACE vcs backup TESTBACKUP ${TESTVCAL})
222         string(REPLACE .vcs "" TESTNAME ${TESTVCAL})
223         add_test("cal-read-${TESTNAME}"
224             "${GAMMU_TEST_PATH}/cal-read${GAMMU_TEST_SUFFIX}"
225             "${Gammu_SOURCE_DIR}/tests/vcal/${TESTVCAL}"
226             "${Gammu_SOURCE_DIR}/tests/vcal/${TESTBACKUP}")
227     endforeach(TESTVCAL $VCALS)
229     # List test cases
230     file(GLOB VCALS
231         RELATIVE "${Gammu_SOURCE_DIR}/tests/vcal"
232         "${Gammu_SOURCE_DIR}/tests/vcal/*.ics")
233     list(SORT VCALS)
235     foreach(TESTVCAL ${VCALS})
236         string(REPLACE ics backup TESTBACKUP ${TESTVCAL})
237         string(REPLACE .ics "" TESTNAME ${TESTVCAL})
238         add_test("cal-read-${TESTNAME}"
239             "${GAMMU_TEST_PATH}/cal-read${GAMMU_TEST_SUFFIX}"
240             "${Gammu_SOURCE_DIR}/tests/vcal/${TESTVCAL}"
241             "${Gammu_SOURCE_DIR}/tests/vcal/${TESTBACKUP}")
242     endforeach(TESTVCAL $VCALS)
243 endif (WITH_BACKUP)
245 # SMS parsing
246 if (WITH_NOKIA6110)
247     add_executable(sms-nokia-01 sms-nokia-01.c)
248     target_link_libraries(sms-nokia-01 libGammu ${LIBINTL_LIBRARIES})
249     target_link_libraries(sms-nokia-01 messagedisplay)
250     add_test(sms-nokia-01 "${GAMMU_TEST_PATH}/sms-nokia-01${GAMMU_TEST_SUFFIX}")
251 endif (WITH_NOKIA6110)
253 if (WITH_NOKIA6510)
254     add_executable(sms-nokia-02 sms-nokia-02.c)
255     target_link_libraries(sms-nokia-02 libGammu ${LIBINTL_LIBRARIES})
256     target_link_libraries(sms-nokia-02 messagedisplay)
257     add_test(sms-nokia-02 "${GAMMU_TEST_PATH}/sms-nokia-02${GAMMU_TEST_SUFFIX}")
258 endif (WITH_NOKIA6510)
260 if (WITH_NOKIA6510)
261     add_executable(sms-nokia-03 sms-nokia-03.c)
262     target_link_libraries(sms-nokia-03 libGammu ${LIBINTL_LIBRARIES})
263     target_link_libraries(sms-nokia-03 messagedisplay)
264     add_test(sms-nokia-03 "${GAMMU_TEST_PATH}/sms-nokia-03${GAMMU_TEST_SUFFIX}")
265 endif (WITH_NOKIA6510)
267 if (WITH_NOKIA6510)
268     add_executable(sms-nokia-04 sms-nokia-04.c)
269     target_link_libraries(sms-nokia-04 libGammu ${LIBINTL_LIBRARIES})
270     target_link_libraries(sms-nokia-04 messagedisplay)
271     add_test(sms-nokia-04 "${GAMMU_TEST_PATH}/sms-nokia-04${GAMMU_TEST_SUFFIX}")
272 endif (WITH_NOKIA6510)
274 if (WITH_NOKIA6510)
275     add_executable(sms-nokia-05 sms-nokia-05.c)
276     target_link_libraries(sms-nokia-05 libGammu ${LIBINTL_LIBRARIES})
277     target_link_libraries(sms-nokia-05 messagedisplay)
278     add_test(sms-nokia-05 "${GAMMU_TEST_PATH}/sms-nokia-05${GAMMU_TEST_SUFFIX}")
279 endif (WITH_NOKIA6510)
281 if (WITH_NOKIA6510)
282     add_executable(sms-nokia-06 sms-nokia-06.c)
283     target_link_libraries(sms-nokia-06 libGammu ${LIBINTL_LIBRARIES})
284     target_link_libraries(sms-nokia-06 messagedisplay)
285     add_test(sms-nokia-06 "${GAMMU_TEST_PATH}/sms-nokia-06${GAMMU_TEST_SUFFIX}")
286 endif (WITH_NOKIA6510)
288 if (WITH_NOKIA6510)
289     add_executable(sms-nokia-07 sms-nokia-07.c)
290     target_link_libraries(sms-nokia-07 libGammu ${LIBINTL_LIBRARIES})
291     add_test(sms-nokia-07 "${GAMMU_TEST_PATH}/sms-nokia-07${GAMMU_TEST_SUFFIX}")
292 endif (WITH_NOKIA6510)
294 if (WITH_NOKIA6510)
295     add_executable(sms-nokia-08 sms-nokia-08.c)
296     target_link_libraries(sms-nokia-08 libGammu ${LIBINTL_LIBRARIES})
297     target_link_libraries(sms-nokia-08 messagedisplay)
298     add_test(sms-nokia-08 "${GAMMU_TEST_PATH}/sms-nokia-08${GAMMU_TEST_SUFFIX}")
299 endif (WITH_NOKIA6510)
301 if (WITH_NOKIA6510)
302     add_executable(sms-nokia-09 sms-nokia-09.c)
303     target_link_libraries(sms-nokia-09 libGammu ${LIBINTL_LIBRARIES})
304     target_link_libraries(sms-nokia-09 messagedisplay)
305     add_test(sms-nokia-09 "${GAMMU_TEST_PATH}/sms-nokia-09${GAMMU_TEST_SUFFIX}")
306 endif (WITH_NOKIA6510)
308 if (WITH_NOKIA6510)
309     add_executable(sms-nokia-10 sms-nokia-10.c)
310     target_link_libraries(sms-nokia-10 libGammu ${LIBINTL_LIBRARIES})
311     target_link_libraries(sms-nokia-10 messagedisplay)
312     add_test(sms-nokia-10 "${GAMMU_TEST_PATH}/sms-nokia-10${GAMMU_TEST_SUFFIX}")
313 endif (WITH_NOKIA6510)
315 if (WITH_NOKIA6510)
316     add_executable(sms-nokia-11 sms-nokia-11.c)
317     target_link_libraries(sms-nokia-11 libGammu ${LIBINTL_LIBRARIES})
318     target_link_libraries(sms-nokia-11 messagedisplay)
319     add_test(sms-nokia-11 "${GAMMU_TEST_PATH}/sms-nokia-11${GAMMU_TEST_SUFFIX}")
320 endif (WITH_NOKIA6510)
322 if (WITH_NOKIA6510)
323     add_executable(sms-nokia-12 sms-nokia-12.c)
324     target_link_libraries(sms-nokia-12 libGammu ${LIBINTL_LIBRARIES})
325     target_link_libraries(sms-nokia-12 messagedisplay)
326     add_test(sms-nokia-12 "${GAMMU_TEST_PATH}/sms-nokia-12${GAMMU_TEST_SUFFIX}")
327 endif (WITH_NOKIA6510)
329 if (WITH_NOKIA6510)
330     add_executable(sms-nokia-13 sms-nokia-13.c)
331     target_link_libraries(sms-nokia-13 libGammu ${LIBINTL_LIBRARIES})
332     target_link_libraries(sms-nokia-13 messagedisplay)
333     add_test(sms-nokia-13 "${GAMMU_TEST_PATH}/sms-nokia-13${GAMMU_TEST_SUFFIX}")
334 endif (WITH_NOKIA6510)
336 if (WITH_NOKIA6510)
337     add_executable(sms-nokia-14 sms-nokia-14.c)
338     target_link_libraries(sms-nokia-14 libGammu ${LIBINTL_LIBRARIES})
339     target_link_libraries(sms-nokia-14 messagedisplay)
340     add_test(sms-nokia-14 "${GAMMU_TEST_PATH}/sms-nokia-14${GAMMU_TEST_SUFFIX}")
341 endif (WITH_NOKIA6510)
343 if (WITH_NOKIA6510)
344     add_executable(sms-nokia-15 sms-nokia-15.c)
345     target_link_libraries(sms-nokia-15 libGammu ${LIBINTL_LIBRARIES})
346     target_link_libraries(sms-nokia-15 messagedisplay)
347     add_test(sms-nokia-15 "${GAMMU_TEST_PATH}/sms-nokia-15${GAMMU_TEST_SUFFIX}")
348 endif (WITH_NOKIA6510)
350 if (WITH_NOKIA6510)
351     add_executable(sms-nokia-16 sms-nokia-16.c)
352     target_link_libraries(sms-nokia-16 libGammu ${LIBINTL_LIBRARIES})
353     target_link_libraries(sms-nokia-16 messagedisplay)
354     add_test(sms-nokia-16 "${GAMMU_TEST_PATH}/sms-nokia-16${GAMMU_TEST_SUFFIX}")
355 endif (WITH_NOKIA6510)
357 if (WITH_NOKIA6510)
358     add_executable(sms-nokia-17 sms-nokia-17.c)
359     target_link_libraries(sms-nokia-17 libGammu ${LIBINTL_LIBRARIES})
360     target_link_libraries(sms-nokia-17 messagedisplay)
361     add_test(sms-nokia-17 "${GAMMU_TEST_PATH}/sms-nokia-17${GAMMU_TEST_SUFFIX}")
362 endif (WITH_NOKIA6510)
364 if (WITH_NOKIA6510)
365     add_executable(sms-nokia-18 sms-nokia-18.c)
366     target_link_libraries(sms-nokia-18 libGammu ${LIBINTL_LIBRARIES})
367     target_link_libraries(sms-nokia-18 messagedisplay)
368     add_test(sms-nokia-18 "${GAMMU_TEST_PATH}/sms-nokia-18${GAMMU_TEST_SUFFIX}")
369 endif (WITH_NOKIA6510)
371 if (WITH_NOKIA6110)
372 # Nokia ringtone
373     add_executable(nokia-6110-ringtone nokia-6110-ringtone.c)
374     target_link_libraries(nokia-6110-ringtone libGammu ${LIBINTL_LIBRARIES})
375     add_test(nokia-6110-ringtone "${GAMMU_TEST_PATH}/nokia-6110-ringtone${GAMMU_TEST_SUFFIX}")
376 endif (WITH_NOKIA6110)
378 if (WITH_ATGEN)
379     # AT SMS parsing
380     add_executable(sms-at-parse sms-at-parse.c)
381     target_link_libraries(sms-at-parse libGammu ${LIBINTL_LIBRARIES})
382     target_link_libraries(sms-at-parse messagedisplay)
384     # AT SMS parsing - simple PDU decoder
385     add_executable(pdu-decode pdu-decode.c)
387     # List test cases for success
388     file(GLOB MESSAGES
389         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-sms"
390         "${Gammu_SOURCE_DIR}/tests/at-sms/*.dump")
391     list(SORT MESSAGES)
393     foreach(TESTMESSAGE ${MESSAGES})
394         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
395         add_test("sms-at-parse-${TESTNAME}"
396             "${GAMMU_TEST_PATH}/sms-at-parse${GAMMU_TEST_SUFFIX}"
397             "${Gammu_SOURCE_DIR}/tests/at-sms/${TESTMESSAGE}")
398         add_test("pdu-decode-${TESTNAME}"
399             "${GAMMU_TEST_PATH}/pdu-decode${GAMMU_TEST_SUFFIX}"
400             "${Gammu_SOURCE_DIR}/tests/at-sms/${TESTMESSAGE}")
401     endforeach(TESTMESSAGE $MESSAGES)
403     # List test cases for TXT mode
404     file(GLOB MESSAGES
405         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-sms-txt"
406         "${Gammu_SOURCE_DIR}/tests/at-sms-txt/*.dump")
407     list(SORT MESSAGES)
409     foreach(TESTMESSAGE ${MESSAGES})
410         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
411         add_test("sms-at-parse-txt-${TESTNAME}"
412             "${GAMMU_TEST_PATH}/sms-at-parse${GAMMU_TEST_SUFFIX}"
413             "${Gammu_SOURCE_DIR}/tests/at-sms-txt/${TESTMESSAGE}"
414             "TXT")
415     endforeach(TESTMESSAGE $MESSAGES)
417     # List test cases for TXT mode
418     file(GLOB MESSAGES
419         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-sms-txt-detail"
420         "${Gammu_SOURCE_DIR}/tests/at-sms-txt-detail/*.dump")
421     list(SORT MESSAGES)
423     foreach(TESTMESSAGE ${MESSAGES})
424         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
425         add_test("sms-at-parse-txtdetail-${TESTNAME}"
426             "${GAMMU_TEST_PATH}/sms-at-parse${GAMMU_TEST_SUFFIX}"
427             "${Gammu_SOURCE_DIR}/tests/at-sms-txt-detail/${TESTMESSAGE}"
428             "TXTDETAIL")
429     endforeach(TESTMESSAGE $MESSAGES)
431     # List test cases for failure
432     file(GLOB MESSAGES
433         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-sms-failing"
434         "${Gammu_SOURCE_DIR}/tests/at-sms-failing/*.dump")
435     list(SORT MESSAGES)
437     foreach(TESTMESSAGE ${MESSAGES})
438         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
439         add_test("sms-at-parse-fail-${TESTNAME}"
440             "${GAMMU_TEST_PATH}/sms-at-parse${GAMMU_TEST_SUFFIX}"
441             "${Gammu_SOURCE_DIR}/tests/at-sms-failing/${TESTMESSAGE}")
442         add_test("pdu-decode-fail-${TESTNAME}"
443             "${GAMMU_TEST_PATH}/pdu-decode${GAMMU_TEST_SUFFIX}"
444             "${Gammu_SOURCE_DIR}/tests/at-sms-failing/${TESTMESSAGE}")
445         set_tests_properties(
446             "pdu-decode-fail-${TESTNAME}"
447             "sms-at-parse-fail-${TESTNAME}"
448             PROPERTIES WILL_FAIL TRUE)
449     endforeach(TESTMESSAGE $MESSAGES)
451     # List test cases
452     file(GLOB MESSAGES
453         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-sms"
454         "${Gammu_SOURCE_DIR}/tests/at-sms/*.dump")
455     list(SORT MESSAGES)
457     foreach(TESTMESSAGE ${MESSAGES})
458         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
459     endforeach(TESTMESSAGE $MESSAGES)
461     # AT model parsing
462     add_executable(get-model-at get-model-at.c)
463     target_link_libraries(get-model-at libGammu ${LIBINTL_LIBRARIES})
465     # List test cases
466     file(GLOB MESSAGES
467         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-model"
468         "${Gammu_SOURCE_DIR}/tests/at-model/*.dump")
469     list(SORT MESSAGES)
471     foreach(TESTMESSAGE ${MESSAGES})
472         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
473         add_test("get-model-at-${TESTNAME}"
474             "${GAMMU_TEST_PATH}/get-model-at${GAMMU_TEST_SUFFIX}"
475             "${Gammu_SOURCE_DIR}/tests/at-model/${TESTMESSAGE}")
476     endforeach(TESTMESSAGE $MESSAGES)
478     # Samsung memory parsing
479     add_executable(samsung-get-memory samsung-get-memory.c)
480     target_link_libraries(samsung-get-memory libGammu ${LIBINTL_LIBRARIES})
481     target_link_libraries(samsung-get-memory memorydisplay)
483     # List test cases
484     file(GLOB MESSAGES
485         RELATIVE "${Gammu_SOURCE_DIR}/tests/samsung-memory"
486         "${Gammu_SOURCE_DIR}/tests/samsung-memory/*.dump")
487     list(SORT MESSAGES)
489     foreach(TESTMESSAGE ${MESSAGES})
490         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
491         add_test("samsung-get-memory-${TESTNAME}"
492             "${GAMMU_TEST_PATH}/samsung-get-memory${GAMMU_TEST_SUFFIX}"
493             "${Gammu_SOURCE_DIR}/tests/samsung-memory/${TESTMESSAGE}")
494     endforeach(TESTMESSAGE $MESSAGES)
496     # AT getting of available phone memories
497     add_executable(at-get-smsmemories at-get-smsmemories.c)
498     target_link_libraries(at-get-smsmemories libGammu ${LIBINTL_LIBRARIES})
500     # List test cases for all memories
501     file(GLOB MESSAGES
502         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-cpms"
503         "${Gammu_SOURCE_DIR}/tests/at-cpms/*.dump")
504     list(SORT MESSAGES)
506     foreach(TESTMESSAGE ${MESSAGES})
507         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
508         add_test("at-get-smsmemories-${TESTNAME}"
509             "${GAMMU_TEST_PATH}/at-get-smsmemories${GAMMU_TEST_SUFFIX}"
510             "${Gammu_SOURCE_DIR}/tests/at-cpms/${TESTMESSAGE}")
511         set_tests_properties("at-get-smsmemories-${TESTNAME}" PROPERTIES
512             PASS_REGULAR_EXPRESSION "read: ME : ok, SM : ok, save: ME : ok, SM = ok")
513     endforeach(TESTMESSAGE $MESSAGES)
515     # List test cases for just SM
516     file(GLOB MESSAGES
517         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-cpms-sm"
518         "${Gammu_SOURCE_DIR}/tests/at-cpms-sm/*.dump")
519     list(SORT MESSAGES)
521     foreach(TESTMESSAGE ${MESSAGES})
522         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
523         add_test("at-get-smsmemories-sm-${TESTNAME}"
524             "${GAMMU_TEST_PATH}/at-get-smsmemories${GAMMU_TEST_SUFFIX}"
525             "${Gammu_SOURCE_DIR}/tests/at-cpms-sm/${TESTMESSAGE}")
526         set_tests_properties("at-get-smsmemories-sm-${TESTNAME}" PROPERTIES
527             PASS_REGULAR_EXPRESSION "read: ME : N/A, SM : ok, save: ME : N/A, SM = ok")
528     endforeach(TESTMESSAGE $MESSAGES)
530     # AT CNMI parsing
531     add_executable(at-cnmi-reply at-cnmi-reply.c)
532     target_link_libraries(at-cnmi-reply libGammu ${LIBINTL_LIBRARIES})
534     # List test cases
535     file(GLOB MESSAGES
536         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-cnmi"
537         "${Gammu_SOURCE_DIR}/tests/at-cnmi/*.dump")
538     list(SORT MESSAGES)
540     foreach(TESTMESSAGE ${MESSAGES})
541         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
542         add_test("at-cnmi-reply-${TESTNAME}"
543             "${GAMMU_TEST_PATH}/at-cnmi-reply${GAMMU_TEST_SUFFIX}"
544             "${Gammu_SOURCE_DIR}/tests/at-cnmi/${TESTMESSAGE}")
545     endforeach(TESTMESSAGE $MESSAGES)
547     # AT CREG parsing
548     add_executable(at-creg-reply at-creg-reply.c)
549     target_link_libraries(at-creg-reply libGammu ${LIBINTL_LIBRARIES})
551     # List test cases
552     file(GLOB MESSAGES
553         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-creg"
554         "${Gammu_SOURCE_DIR}/tests/at-creg/*.dump")
555     list(SORT MESSAGES)
557     foreach(TESTMESSAGE ${MESSAGES})
558         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
559         add_test("at-creg-reply-${TESTNAME}"
560             "${GAMMU_TEST_PATH}/at-creg-reply${GAMMU_TEST_SUFFIX}"
561             "${Gammu_SOURCE_DIR}/tests/at-creg/${TESTMESSAGE}")
562     endforeach(TESTMESSAGE $MESSAGES)
564     # AT memory parsing
565     add_executable(at-getmemory-reply at-getmemory-reply.c)
566     target_link_libraries(at-getmemory-reply libGammu ${LIBINTL_LIBRARIES})
567     target_link_libraries(at-getmemory-reply memorydisplay)
569     macro(at_getmemory_reply_test _file _charset _test)
571     add_test("at-getmemory-reply-${_file}"
572             "${GAMMU_TEST_PATH}/at-getmemory-reply${GAMMU_TEST_SUFFIX}"
573             "${Gammu_SOURCE_DIR}/tests/at-getmemory/${_file}.dump"
574             "${_charset}")
575     set_tests_properties("at-getmemory-reply-${_file}"
576         PROPERTIES PASS_REGULAR_EXPRESSION "${_test}")
578     endmacro(at_getmemory_reply_test _file _charset _test)
580     at_getmemory_reply_test(samsung PCCP437 AsistZahr)
581     at_getmemory_reply_test(samsung-p900 PCCP437 "My Tempo")
582     at_getmemory_reply_test(with-time UTF8 "Mama GSM")
583     at_getmemory_reply_test(with-date-time UTF8 "60122256476")
584     at_getmemory_reply_test(ucs2 UCS2 "Stanley Paul")
585     at_getmemory_reply_test(ucs2-motorola UCS2 "Virchow Klinikum St. 31")
586     at_getmemory_reply_test(nokia-2730 UCS2 "Steve  Vinson")
588     # AT USSD replies parsing
589     add_executable(at-ussd-reply at-ussd-reply.c)
590     target_link_libraries(at-ussd-reply libGammu ${LIBINTL_LIBRARIES})
592     # List test cases
593     file(GLOB MESSAGES
594         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-ussd"
595         "${Gammu_SOURCE_DIR}/tests/at-ussd/*.dump")
596     list(SORT MESSAGES)
598     foreach(TESTMESSAGE ${MESSAGES})
599         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
600         string(REGEX REPLACE ".*-(.*)\\.dump" "\\1" PHONE_MODEL ${TESTMESSAGE})
601         add_test("at-ussd-reply-${TESTNAME}"
602             "${GAMMU_TEST_PATH}/at-ussd-reply${GAMMU_TEST_SUFFIX}"
603             "${Gammu_SOURCE_DIR}/tests/at-ussd/${TESTMESSAGE}" "${PHONE_MODEL}")
604     endforeach(TESTMESSAGE $MESSAGES)
606     # AT SMSC parsing
607     add_executable(get-smsc-at get-smsc-at.c)
608     target_link_libraries(get-smsc-at libGammu ${LIBINTL_LIBRARIES})
610     # List test cases
611     file(GLOB MESSAGES
612         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-smsc"
613         "${Gammu_SOURCE_DIR}/tests/at-smsc/*.dump")
614     list(SORT MESSAGES)
616     foreach(TESTMESSAGE ${MESSAGES})
617         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
618         add_test("get-smsc-at-${TESTNAME}"
619             "${GAMMU_TEST_PATH}/get-smsc-at${GAMMU_TEST_SUFFIX}"
620             "${Gammu_SOURCE_DIR}/tests/at-smsc/${TESTMESSAGE}")
621     endforeach(TESTMESSAGE $MESSAGES)
623     file(GLOB MESSAGES
624         RELATIVE "${Gammu_SOURCE_DIR}/tests/at-smsc-failing"
625         "${Gammu_SOURCE_DIR}/tests/at-smsc-failing/*.dump")
626     list(SORT MESSAGES)
628     foreach(TESTMESSAGE ${MESSAGES})
629         string(REPLACE .dump "" TESTNAME ${TESTMESSAGE})
630         add_test("get-smsc-at-${TESTNAME}"
631             "${GAMMU_TEST_PATH}/get-smsc-at${GAMMU_TEST_SUFFIX}"
632             "${Gammu_SOURCE_DIR}/tests/at-smsc-failing/${TESTMESSAGE}")
633         set_tests_properties(
634             "get-smsc-at-${TESTNAME}"
635             PROPERTIES WILL_FAIL TRUE)
636     endforeach(TESTMESSAGE $MESSAGES)
638     if (WITH_BACKUP)
639         # AT SMS encoding
640         add_executable(sms-at-encode sms-at-encode.c)
641         target_link_libraries(sms-at-encode libGammu ${LIBINTL_LIBRARIES})
643         # List test cases
644         file(GLOB MESSAGES
645             RELATIVE "${Gammu_SOURCE_DIR}/tests/at-sms-encode"
646             "${Gammu_SOURCE_DIR}/tests/at-sms-encode/*.backup")
647         list(SORT MESSAGES)
649         foreach(TESTMESSAGE ${MESSAGES})
650             string(REPLACE .backup "" TESTNAME ${TESTMESSAGE})
651             string(REPLACE backup dump TESTDUMP ${TESTMESSAGE})
652             add_test("sms-at-encode-${TESTNAME}"
653                 "${GAMMU_TEST_PATH}/sms-at-encode${GAMMU_TEST_SUFFIX}"
654                 "${Gammu_SOURCE_DIR}/tests/at-sms-encode/${TESTMESSAGE}"
655                 "${Gammu_SOURCE_DIR}/tests/at-sms-encode/${TESTDUMP}")
656         endforeach(TESTMESSAGE $MESSAGES)
657     endif (WITH_BACKUP)
658 endif (WITH_ATGEN)
660 if (WITH_OBEXGEN)
661     # OBEX entries splitting
662     add_executable(obex-vcard-split obex-vcard-split.c)
663     target_link_libraries(obex-vcard-split libGammu ${LIBINTL_LIBRARIES})
665     # Tests
666     add_test(obex-vcard-split-se-3
667             "${GAMMU_TEST_PATH}/obex-vcard-split${GAMMU_TEST_SUFFIX}"
668             "${Gammu_SOURCE_DIR}/tests/vcards/se-3.vcf"
669             499)
671 endif (WITH_OBEXGEN)
673 # SMS encoding
674 add_executable(sms-encode-decode sms-encode-decode.c)
675 target_link_libraries(sms-encode-decode libGammu ${LIBINTL_LIBRARIES})
676 target_link_libraries(sms-encode-decode messagedisplay)
677 add_test(sms-encode-decode "${GAMMU_TEST_PATH}/sms-encode-decode${GAMMU_TEST_SUFFIX}")
679 # SMS encoding from commandline
680 add_executable(sms-cmdline sms-cmdline.c)
681 target_link_libraries(sms-cmdline libGammu ${LIBINTL_LIBRARIES})
682 target_link_libraries(sms-cmdline messagedisplay)
683 target_link_libraries(sms-cmdline messagecmdline)
685 add_test(sms-cmdline-TEXT "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
686     TEXT 213 -text aaafdsfdfasd)
687 set_tests_properties(sms-cmdline-TEXT PROPERTIES
688     PASS_REGULAR_EXPRESSION "Remote number        : \"213\"")
690 add_test(sms-cmdline-TEXT-smsc "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
691     TEXT 213 -text aaafdsfdfasd -smscnumber 132465)
692 set_tests_properties(sms-cmdline-TEXT-smsc PROPERTIES
693 PASS_REGULAR_EXPRESSION "Remote number        : \"213\"")
695 add_test(sms-cmdline-TEXT-textutf8 "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
696     TEXT 213 -unicode -textutf8 "Zkouška šíleně žlutého koně.")
697 set_tests_properties(sms-cmdline-TEXT-textutf8 PROPERTIES
698     PASS_REGULAR_EXPRESSION "Coding               : Unicode \\(no compression\\)")
701 add_test(sms-cmdline-TEXT-16 "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
702     TEXT 213
703         -text fdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdd
704         -autolen 600 -16bit)
705 set_tests_properties(sms-cmdline-TEXT-16 PROPERTIES
706     PASS_REGULAR_EXPRESSION "User Data Header     : Concatenated \\(linked\\) message, ID \\(16 bit\\) [0-9]*, 2 parts")
708 add_test(sms-cmdline-TEXT-autolen "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
709     TEXT 213
710         -text fdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasddfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasddfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdd
711         -autolen 200)
712 set_tests_properties(sms-cmdline-TEXT-autolen PROPERTIES
713     PASS_REGULAR_EXPRESSION "User Data Header     : Concatenated \\(linked\\) message, ID \\(8 bit\\) [0-9]*, 2 parts")
715 add_test(sms-cmdline-TEXT-len "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
716     TEXT 213
717         -text fdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdd
718         -len 100)
719 set_tests_properties(sms-cmdline-TEXT-len PROPERTIES
720     FAIL_REGULAR_EXPRESSION "User Data Header     : Concatenated \\(linked\\) message")
722 add_test(sms-cmdline-TEXT-len-1 "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
723     TEXT 213
724         -text fdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdfdasfasfasfdsafasdfasdffasdfasdfasaaafdsfdfasdd
725         -len -1)
726 set_tests_properties(sms-cmdline-TEXT-len-1 PROPERTIES
727     FAIL_REGULAR_EXPRESSION "Wrong message length \\(\"-1\"\\)"
728     WILL_FAIL TRUE)
730 add_test(sms-cmdline-TEXT-unicode "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
731     TEXT 213 -text aaafdsfdfasd -unicode)
732 set_tests_properties(sms-cmdline-TEXT-unicode PROPERTIES
733     PASS_REGULAR_EXPRESSION "Coding               : Unicode \\(no compression\\)")
735 add_test(sms-cmdline-TEXT-voice "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
736     text 213 -text aaafdsfdfasd -unicode -enablevoice)
737 set_tests_properties(sms-cmdline-TEXT-voice PROPERTIES
738     PASS_REGULAR_EXPRESSION "User Data Header     : Enables voice indicator")
740 add_test(sms-cmdline-EMS "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
741     EMS 213 -text "aaafdsfdfasddsadsadsadsadijfdsalkfjla sdjflkjlfk fdsaf dsa fdsaf dsafafdasfsadfdsaf dsafdsa fdsaf dasfdsafdsafdsaf dsafdsaf daaafdsfdfasddsadsadsadsadijfdsalkfjla sdjflkjlfk fdsaf dsa fdsaf dsafafdasfsadfdsaf dsafdsa fdsaf dasfdsafdsafdsaf dsafdsaf dsafdsaf")
742 set_tests_properties(sms-cmdline-EMS PROPERTIES
743     PASS_REGULAR_EXPRESSION "User Data Header     : Concatenated \\(linked\\) message, ID \\(8 bit\\) [0-9]*, 2 parts")
745 add_test(sms-cmdline-EMS-empty "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
746     EMS 213)
747 set_tests_properties(sms-cmdline-EMS-empty PROPERTIES
748     FAIL_REGULAR_EXPRESSION "Entry is empty"
749     WILL_FAIL TRUE)
751 add_test(sms-cmdline-EMS-misc "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
752     EMS 213
753         -defsound 99
754         -defanimation 1
755         -protected 0
756         -text "foo" -format l
757         -text bar -format r
758         -text moo -format b
759         -text mee -format i
760         -text bee -format u
761         -text geee -format t)
762 set_tests_properties(sms-cmdline-EMS-misc PROPERTIES
763     PASS_REGULAR_EXPRESSION "EMS sound ID         : 99"
764     )
766 add_test(sms-cmdline-EMS-ring "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
767     EMS 54654654 -protected 1 -toneSElong  ${RINGTONE_TEST_FILE})
769 add_test(sms-cmdline-EMS-unicodefile "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
770     EMS 213 -unicodefiletext ${Gammu_SOURCE_DIR}/tests/text-unicode.txt -unicode)
771 set_tests_properties(sms-cmdline-EMS-unicodefile PROPERTIES
772     PASS_REGULAR_EXPRESSION "Coding               : Unicode \\(no compression\\)")
774 add_test(sms-cmdline-RINGTONE "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
775     RINGTONE 54654654 ${RINGTONE_TEST_FILE})
776 set_tests_properties(sms-cmdline-RINGTONE PROPERTIES
777     PASS_REGULAR_EXPRESSION "Ringtone \"AxelF\"")
779 add_test(sms-cmdline-MMS "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
780     MMSINDICATOR 800123456 http://wammu.eu/ Wammu Gammu)
781 set_tests_properties(sms-cmdline-MMS PROPERTIES
782     PASS_REGULAR_EXPRESSION "User Data Header     : MMS indicator, ID \\(8 bit\\) [0-9]*, part 1 of 1")
784 add_test(sms-cmdline-WAP "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
785     WAPINDICATOR 800123456 http://wammu.eu/ Wammu)
786 set_tests_properties(sms-cmdline-WAP PROPERTIES
787     PASS_REGULAR_EXPRESSION "User Data Header     : MMS indicator, ID \\(8 bit\\) [0-9]*, part 1 of 1")
789 if (WITH_BACKUP)
790     add_test(sms-cmdline-TODO "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
791         TODO 132132  ${Gammu_SOURCE_DIR}/tests/vcal/02.vcs  1)
792     set_tests_properties(sms-cmdline-TODO PROPERTIES
793         PASS_REGULAR_EXPRESSION "User Data Header     : Nokia calendar note, ID \\(8 bit\\) [0-9]*, part 2 of 2")
795     add_test(sms-cmdline-CALENDAR "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
796         CALENDAR 132132  ${Gammu_SOURCE_DIR}/tests/vcal/UK32Holidays.ics  30)
797     set_tests_properties(sms-cmdline-CALENDAR PROPERTIES
798         PASS_REGULAR_EXPRESSION "SUMMARY:Bank Holiday")
800     add_test(sms-cmdline-VCARD "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
801         VCARD21 132132  ${Gammu_SOURCE_DIR}/tests/vcards/yahoo.vcf ME 1)
802     set_tests_properties(sms-cmdline-VCARD PROPERTIES
803         PASS_REGULAR_EXPRESSION "User Data Header     : Concatenated \\(linked\\) message, ID \\(8 bit\\) [0-9]*, 2 parts")
804 endif (WITH_BACKUP)
806 add_test(sms-cmdline-SMSTEMPLATE "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
807     SMSTEMPLATE 213 -text aaafdsfdfasd)
808 # Not sure if this is really correct...
809 set_tests_properties(sms-cmdline-SMSTEMPLATE PROPERTIES
810     PASS_REGULAR_EXPRESSION "User Data Header     : User UDH")
812 add_test(sms-cmdline-PICTURE "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
813     PICTURE 213 ${LOGO_TEST_FILE})
814 set_tests_properties(sms-cmdline-PICTURE PROPERTIES
815     PASS_REGULAR_EXPRESSION "###################   ##    ##     #     #     ##   ## ### ##   ###   ##")
817 add_test(sms-cmdline-OPERATOR "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
818     OPERATOR 213 ${LOGO_TEST_FILE} -netcode "230 03")
819 set_tests_properties(sms-cmdline-OPERATOR PROPERTIES
820     PASS_REGULAR_EXPRESSION "Operator logo for 230 03 network \\(Vodafone, Czech Republic\\)")
822 add_test(sms-cmdline-CALLER "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
823     CALLER 213 ${LOGO_TEST_FILE})
824 set_tests_properties(sms-cmdline-CALLER PROPERTIES
825     PASS_REGULAR_EXPRESSION "User Data Header     : Nokia caller logo")
827 add_test(sms-cmdline-ANIMATION "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
828     ANIMATION 213 6
829         ${LOGO_TEST_FILE}
830         ${LOGO_TEST_FILE}
831         ${LOGO_TEST_FILE}
832         ${LOGO_TEST_FILE}
833         ${LOGO_TEST_FILE}
834         ${LOGO_TEST_FILE})
835 set_tests_properties(sms-cmdline-ANIMATION PROPERTIES
836     PASS_REGULAR_EXPRESSION "Number of messages: 14")
838 add_test(sms-cmdline-PROFILE "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
839     PROFILE 213
840         -bitmap ${LOGO_TEST_FILE}
841         -ringtone ${RINGTONE_TEST_FILE})
842 set_tests_properties(sms-cmdline-PROFILE PROPERTIES
843     PASS_REGULAR_EXPRESSION "User Data Header     : Nokia profile, ID \\(8 bit\\) [0-9]*, 3 parts")
845 if (WITH_BACKUP)
846     add_test(sms-cmdline-BOOKMARK "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
847         BOOKMARK 213 ${Gammu_SOURCE_DIR}/tests/misc/wap-bookmark.backup 1)
848     set_tests_properties(sms-cmdline-BOOKMARK PROPERTIES
849         PASS_REGULAR_EXPRESSION "User Data Header     : Nokia WAP bookmark")
851     add_test(sms-cmdline-WAPSETTINGS "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
852         WAPSETTINGS 213 ${Gammu_SOURCE_DIR}/tests/misc/wap-settings.backup 1 GPRS)
853     set_tests_properties(sms-cmdline-WAPSETTINGS PROPERTIES
854         PASS_REGULAR_EXPRESSION "User Data Header     : Nokia WAP bookmark or WAP/MMS settings, ID \\(8 bit\\) [0-9]*, 2 parts")
856     add_test(sms-cmdline-MMSSETTINGS "${GAMMU_TEST_PATH}/sms-cmdline${GAMMU_TEST_SUFFIX}"
857         MMSSETTINGS 213 ${Gammu_SOURCE_DIR}/tests/misc/mms-settings.backup 1)
858     set_tests_properties(sms-cmdline-MMSSETTINGS PROPERTIES
859         PASS_REGULAR_EXPRESSION "User Data Header     : Nokia WAP bookmark or WAP/MMS settings, ID \\(8 bit\\) [0-9]*, 2 parts")
860 endif (WITH_BACKUP)
862 if (WITH_ATGEN)
863     # Samsung parser tests
864     add_executable(at-samsung at-samsung.c)
865     target_link_libraries(at-samsung libGammu ${LIBINTL_LIBRARIES})
866     add_test(at-samsung "${GAMMU_TEST_PATH}/at-samsung${GAMMU_TEST_SUFFIX}")
868     # Motorola parser tests
869     add_executable(at-motorola at-motorola.c)
870     target_link_libraries(at-motorola libGammu ${LIBINTL_LIBRARIES})
871     add_test(at-motorola "${GAMMU_TEST_PATH}/at-motorola${GAMMU_TEST_SUFFIX}")
873     # AT parser tests
874     add_executable(at-parser at-parser.c)
875     target_link_libraries(at-parser libGammu ${LIBINTL_LIBRARIES})
876     add_test(at-parser "${GAMMU_TEST_PATH}/at-parser${GAMMU_TEST_SUFFIX}")
878     # AT dispatch tests
879     add_executable(at-dispatch at-dispatch.c)
880     target_link_libraries(at-dispatch libGammu ${LIBINTL_LIBRARIES})
881     add_test(at-dispatch "${GAMMU_TEST_PATH}/at-dispatch${GAMMU_TEST_SUFFIX}")
883     # AT text encoding/decoding
884     add_executable(at-charset at-charset.c)
885     target_link_libraries(at-charset libGammu ${LIBINTL_LIBRARIES})
886     add_test(at-charset "${GAMMU_TEST_PATH}/at-charset${GAMMU_TEST_SUFFIX}")
887 endif (WITH_ATGEN)
889 # Line parser tests
890 add_executable(line-splitting line-splitting.c)
891 target_link_libraries(line-splitting libGammu ${LIBINTL_LIBRARIES})
892 add_test(line-splitting "${GAMMU_TEST_PATH}/line-splitting${GAMMU_TEST_SUFFIX}")
894 # Config file parsing
895 add_executable(config config.c)
896 target_link_libraries(config libGammu ${LIBINTL_LIBRARIES})
897 file(GLOB CONFIGS
898     RELATIVE "${Gammu_SOURCE_DIR}/tests/configs"
899     "${Gammu_SOURCE_DIR}/tests/configs/tabs-*")
900 list(SORT CONFIGS)
902 foreach(TESTCONFIG ${CONFIGS})
903     add_test(config-${TESTCONFIG} "${GAMMU_TEST_PATH}/config${GAMMU_TEST_SUFFIX}" "${Gammu_SOURCE_DIR}/tests/configs/${TESTCONFIG}")
904     set_tests_properties(config-${TESTCONFIG} PROPERTIES
905         PASS_REGULAR_EXPRESSION "DEBUG_LEVEL: 'textall'")
906 endforeach(TESTCONFIG $CONFIGS)
909 # INI file parsing
910 add_executable(inifile inifile.c)
911 target_link_libraries(inifile libGammu ${LIBINTL_LIBRARIES})
912 file(GLOB INIFILES
913     RELATIVE "${Gammu_SOURCE_DIR}/tests/inifiles"
914     "${Gammu_SOURCE_DIR}/tests/inifiles/*.ini")
915 list(SORT INIFILES)
917 foreach(TESTINIFILE ${INIFILES})
918     add_test(inifile-${TESTINIFILE} "${GAMMU_TEST_PATH}/inifile${GAMMU_TEST_SUFFIX}" "${Gammu_SOURCE_DIR}/tests/inifiles/${TESTINIFILE}")
919 endforeach(TESTINIFILE $INIFILES)
921 # Examples
922 add_executable(phone-info "${Gammu_SOURCE_DIR}/docs/examples/phone-info.c")
923 target_link_libraries(phone-info libGammu ${LIBINTL_LIBRARIES})
924 add_executable(custom-config "${Gammu_SOURCE_DIR}/docs/examples/custom-config.c")
925 target_link_libraries(custom-config libGammu ${LIBINTL_LIBRARIES})
926 add_executable(sms-send "${Gammu_SOURCE_DIR}/docs/examples/sms-send.c")
927 target_link_libraries(sms-send libGammu ${LIBINTL_LIBRARIES})
928 add_executable(long-sms "${Gammu_SOURCE_DIR}/docs/examples/long-sms.c")
929 target_link_libraries(long-sms libGammu ${LIBINTL_LIBRARIES})
930 add_executable(sms-read "${Gammu_SOURCE_DIR}/docs/examples/sms-read.c")
931 target_link_libraries(sms-read libGammu ${LIBINTL_LIBRARIES})
932 add_executable(smsd "${Gammu_SOURCE_DIR}/docs/examples/smsd.c")
933 target_link_libraries(smsd libGammu ${LIBINTL_LIBRARIES} gsmsd)
935 # Examples tests, works with dummy phone
936 if (WITH_BACKUP)
937     add_test(phone-info "${GAMMU_TEST_PATH}/phone-info${GAMMU_TEST_SUFFIX}" "${CMAKE_CURRENT_BINARY_DIR}/.gammurc")
938     add_test(custom-config "${GAMMU_TEST_PATH}/custom-config${GAMMU_TEST_SUFFIX}" "${CMAKE_CURRENT_BINARY_DIR}/.gammu-dummy" none dummy)
939     add_test(sms-send "${GAMMU_TEST_PATH}/sms-send${GAMMU_TEST_SUFFIX}" "${CMAKE_CURRENT_BINARY_DIR}/.gammurc")
940     add_test(long-sms "${GAMMU_TEST_PATH}/long-sms${GAMMU_TEST_SUFFIX}" "${CMAKE_CURRENT_BINARY_DIR}/.gammurc")
941     add_test(sms-read "${GAMMU_TEST_PATH}/sms-read${GAMMU_TEST_SUFFIX}" "${CMAKE_CURRENT_BINARY_DIR}/.gammurc")
942 endif (WITH_BACKUP)
945 # Auto generated include tests begin
946 # Do not modify this section, change gen-include-test.sh instead
948 # Test for header gammu-backup.h
949 add_executable(include-backup include-backup.c)
950 target_link_libraries(include-backup libGammu ${LIBINTL_LIBRARIES})
951 add_test(include-backup "${GAMMU_TEST_PATH}/include-backup${GAMMU_TEST_SUFFIX}")
953 # Test for header gammu-bitmap.h
954 add_executable(include-bitmap include-bitmap.c)
955 target_link_libraries(include-bitmap libGammu ${LIBINTL_LIBRARIES})
956 add_test(include-bitmap "${GAMMU_TEST_PATH}/include-bitmap${GAMMU_TEST_SUFFIX}")
958 # Test for header gammu-calendar.h
959 add_executable(include-calendar include-calendar.c)
960 target_link_libraries(include-calendar libGammu ${LIBINTL_LIBRARIES})
961 add_test(include-calendar "${GAMMU_TEST_PATH}/include-calendar${GAMMU_TEST_SUFFIX}")
963 # Test for header gammu-callback.h
964 add_executable(include-callback include-callback.c)
965 target_link_libraries(include-callback libGammu ${LIBINTL_LIBRARIES})
966 add_test(include-callback "${GAMMU_TEST_PATH}/include-callback${GAMMU_TEST_SUFFIX}")
968 # Test for header gammu-call.h
969 add_executable(include-call include-call.c)
970 target_link_libraries(include-call libGammu ${LIBINTL_LIBRARIES})
971 add_test(include-call "${GAMMU_TEST_PATH}/include-call${GAMMU_TEST_SUFFIX}")
973 # Test for header gammu-category.h
974 add_executable(include-category include-category.c)
975 target_link_libraries(include-category libGammu ${LIBINTL_LIBRARIES})
976 add_test(include-category "${GAMMU_TEST_PATH}/include-category${GAMMU_TEST_SUFFIX}")
978 # Test for header gammu-datetime.h
979 add_executable(include-datetime include-datetime.c)
980 target_link_libraries(include-datetime libGammu ${LIBINTL_LIBRARIES})
981 add_test(include-datetime "${GAMMU_TEST_PATH}/include-datetime${GAMMU_TEST_SUFFIX}")
983 # Test for header gammu-debug.h
984 add_executable(include-debug include-debug.c)
985 target_link_libraries(include-debug libGammu ${LIBINTL_LIBRARIES})
986 add_test(include-debug "${GAMMU_TEST_PATH}/include-debug${GAMMU_TEST_SUFFIX}")
988 # Test for header gammu-error.h
989 add_executable(include-error include-error.c)
990 target_link_libraries(include-error libGammu ${LIBINTL_LIBRARIES})
991 add_test(include-error "${GAMMU_TEST_PATH}/include-error${GAMMU_TEST_SUFFIX}")
993 # Test for header gammu-file.h
994 add_executable(include-file include-file.c)
995 target_link_libraries(include-file libGammu ${LIBINTL_LIBRARIES})
996 add_test(include-file "${GAMMU_TEST_PATH}/include-file${GAMMU_TEST_SUFFIX}")
998 # Test for header gammu-info.h
999 add_executable(include-info include-info.c)
1000 target_link_libraries(include-info libGammu ${LIBINTL_LIBRARIES})
1001 add_test(include-info "${GAMMU_TEST_PATH}/include-info${GAMMU_TEST_SUFFIX}")
1003 # Test for header gammu-inifile.h
1004 add_executable(include-inifile include-inifile.c)
1005 target_link_libraries(include-inifile libGammu ${LIBINTL_LIBRARIES})
1006 add_test(include-inifile "${GAMMU_TEST_PATH}/include-inifile${GAMMU_TEST_SUFFIX}")
1008 # Test for header gammu-keys.h
1009 add_executable(include-keys include-keys.c)
1010 target_link_libraries(include-keys libGammu ${LIBINTL_LIBRARIES})
1011 add_test(include-keys "${GAMMU_TEST_PATH}/include-keys${GAMMU_TEST_SUFFIX}")
1013 # Test for header gammu-limits.h
1014 add_executable(include-limits include-limits.c)
1015 target_link_libraries(include-limits libGammu ${LIBINTL_LIBRARIES})
1016 add_test(include-limits "${GAMMU_TEST_PATH}/include-limits${GAMMU_TEST_SUFFIX}")
1018 # Test for header gammu-memory.h
1019 add_executable(include-memory include-memory.c)
1020 target_link_libraries(include-memory libGammu ${LIBINTL_LIBRARIES})
1021 add_test(include-memory "${GAMMU_TEST_PATH}/include-memory${GAMMU_TEST_SUFFIX}")
1023 # Test for header gammu-message.h
1024 add_executable(include-message include-message.c)
1025 target_link_libraries(include-message libGammu ${LIBINTL_LIBRARIES})
1026 add_test(include-message "${GAMMU_TEST_PATH}/include-message${GAMMU_TEST_SUFFIX}")
1028 # Test for header gammu-misc.h
1029 add_executable(include-misc include-misc.c)
1030 target_link_libraries(include-misc libGammu ${LIBINTL_LIBRARIES})
1031 add_test(include-misc "${GAMMU_TEST_PATH}/include-misc${GAMMU_TEST_SUFFIX}")
1033 # Test for header gammu-nokia.h
1034 add_executable(include-nokia include-nokia.c)
1035 target_link_libraries(include-nokia libGammu ${LIBINTL_LIBRARIES})
1036 add_test(include-nokia "${GAMMU_TEST_PATH}/include-nokia${GAMMU_TEST_SUFFIX}")
1038 # Test for header gammu-ringtone.h
1039 add_executable(include-ringtone include-ringtone.c)
1040 target_link_libraries(include-ringtone libGammu ${LIBINTL_LIBRARIES})
1041 add_test(include-ringtone "${GAMMU_TEST_PATH}/include-ringtone${GAMMU_TEST_SUFFIX}")
1043 # Test for header gammu-security.h
1044 add_executable(include-security include-security.c)
1045 target_link_libraries(include-security libGammu ${LIBINTL_LIBRARIES})
1046 add_test(include-security "${GAMMU_TEST_PATH}/include-security${GAMMU_TEST_SUFFIX}")
1048 # Test for header gammu-settings.h
1049 add_executable(include-settings include-settings.c)
1050 target_link_libraries(include-settings libGammu ${LIBINTL_LIBRARIES})
1051 add_test(include-settings "${GAMMU_TEST_PATH}/include-settings${GAMMU_TEST_SUFFIX}")
1053 # Test for header gammu-smsd.h
1054 add_executable(include-smsd include-smsd.c)
1055 target_link_libraries(include-smsd libGammu ${LIBINTL_LIBRARIES})
1056 add_test(include-smsd "${GAMMU_TEST_PATH}/include-smsd${GAMMU_TEST_SUFFIX}")
1058 # Test for header gammu-statemachine.h
1059 add_executable(include-statemachine include-statemachine.c)
1060 target_link_libraries(include-statemachine libGammu ${LIBINTL_LIBRARIES})
1061 add_test(include-statemachine "${GAMMU_TEST_PATH}/include-statemachine${GAMMU_TEST_SUFFIX}")
1063 # Test for header gammu-types.h
1064 add_executable(include-types include-types.c)
1065 target_link_libraries(include-types libGammu ${LIBINTL_LIBRARIES})
1066 add_test(include-types "${GAMMU_TEST_PATH}/include-types${GAMMU_TEST_SUFFIX}")
1068 # Test for header gammu-unicode.h
1069 add_executable(include-unicode include-unicode.c)
1070 target_link_libraries(include-unicode libGammu ${LIBINTL_LIBRARIES})
1071 add_test(include-unicode "${GAMMU_TEST_PATH}/include-unicode${GAMMU_TEST_SUFFIX}")
1073 # Test for header gammu-wap.h
1074 add_executable(include-wap include-wap.c)
1075 target_link_libraries(include-wap libGammu ${LIBINTL_LIBRARIES})
1076 add_test(include-wap "${GAMMU_TEST_PATH}/include-wap${GAMMU_TEST_SUFFIX}")
1078 # Auto generated include tests end
1080 # Test for GetInt
1081 add_executable(getint getint.c)
1082 target_link_libraries(getint cmdline)
1083 set(GETINT_PASS 1 23213 3213213 -321312 -1)
1084 set(GETINT_FAIL 1a 24432f xxx foo 3243243243243243232432432432432)
1085 foreach(NUM ${GETINT_PASS})
1086     add_test(getint-${NUM} "${GAMMU_TEST_PATH}/getint${GAMMU_TEST_SUFFIX}" "${NUM}")
1087     set_tests_properties(
1088         getint-${NUM}
1089         PROPERTIES
1090         PASS_REGULAR_EXPRESSION "Result: ${NUM}")
1091 endforeach(NUM ${GETINT_PASS})
1092 foreach(NUM ${GETINT_FAIL})
1093     add_test(getint-${NUM} "${GAMMU_TEST_PATH}/getint${GAMMU_TEST_SUFFIX}" "${NUM}")
1094     set_tests_properties(
1095         getint-${NUM}
1096         PROPERTIES WILL_FAIL TRUE)
1097 endforeach(NUM ${GETINT_FAIL})
1099 # Test for locking, only on !WIN32 and if we can write to lock dir
1100 if (NOT WIN32)
1101     execute_process(COMMAND test -w /var/lock/ RESULT_VARIABLE VAR_LOCK_WRITABLE)
1102     if (VAR_LOCK_WRITABLE EQUAL 0)
1103         add_executable(locking locking.c)
1104         target_link_libraries(locking libGammu ${LIBINTL_LIBRARIES})
1105         add_test(locking "${GAMMU_TEST_PATH}/locking${GAMMU_TEST_SUFFIX}")
1106     else (VAR_LOCK_WRITABLE EQUAL 0)
1107         message("/var/lock is not writable, skipping locking tests!")
1108     endif (VAR_LOCK_WRITABLE EQUAL 0)
1109 endif (NOT WIN32)