[med-svn] [Git][med-team/edflib][master] Use new unittest, remove national encoding

Nilesh Patra gitlab at salsa.debian.org
Sat Jul 4 11:26:36 BST 2020



Nilesh Patra pushed to branch master at Debian Med / edflib


Commits:
4aba4d16 by Nilesh Patra at 2020-07-04T15:56:08+05:30
Use new unittest, remove national encoding

- - - - -


1 changed file:

- debian/unittest/unittest.c


Changes:

=====================================
debian/unittest/unittest.c
=====================================
@@ -58,6 +58,8 @@ int main(void)
 
   short sbuf[100];
 
+  long long l_tmp;
+
   double dbuf[1000];
 
   union {
@@ -76,7 +78,7 @@ int main(void)
 
   setlocale(LC_ALL, "C");
 
-  if(edflib_version() != 116)  JUMP_TO_EXIT_ERROR_PROC
+  if(edflib_version() != 118)  JUMP_TO_EXIT_ERROR_PROC
 
 /********************************** EDF writing ******************************/
 
@@ -2924,6 +2926,27 @@ int main(void)
 
   if(hdl < 0)  JUMP_TO_EXIT_ERROR_PROC
 
+  if(edf_set_datarecord_duration(hdl, 77777))  JUMP_TO_EXIT_ERROR_PROC
+
+  if(edf_set_subsecond_starttime(hdl, 1234000))  JUMP_TO_EXIT_ERROR_PROC
+
+  if(edf_set_number_of_annotation_signals(hdl, 3))  JUMP_TO_EXIT_ERROR_PROC
+
+  for(i=0; i<60; i++)
+  {
+    l_tmp = 10000LL * (i + 1);
+
+    snprintf(str, 4096, "test %i sec", (int)(l_tmp / 10000LL));
+
+    if(edfwrite_annotation_latin1(hdl, l_tmp, -1LL, str))  JUMP_TO_EXIT_ERROR_PROC
+
+    l_tmp += 3333LL;
+
+    snprintf(str, 4096, "test %i.%04i sec", (int)(l_tmp / 10000LL), (int)(l_tmp % 10000LL));
+
+    if(edfwrite_annotation_latin1(hdl, l_tmp, -1LL, str))  JUMP_TO_EXIT_ERROR_PROC
+  }
+
   if(edf_set_samplefrequency(hdl, 0, 100))  JUMP_TO_EXIT_ERROR_PROC
 
   if(edf_set_physical_maximum(hdl, 0, 1000))  JUMP_TO_EXIT_ERROR_PROC
@@ -2936,9 +2959,9 @@ int main(void)
 
   if(edf_set_startdatetime(hdl, 2008, 12, 31, 23, 59, 58))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_patientname(hdl, "lpha"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_patientname(hdl, "Alpha"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_patientcode(hdl, "Brv"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_patientcode(hdl, "Bravo"))  JUMP_TO_EXIT_ERROR_PROC
 
   if(edf_set_gender(hdl, 1))  JUMP_TO_EXIT_ERROR_PROC
 
@@ -2946,11 +2969,11 @@ int main(void)
 
   if(edf_set_patient_additional(hdl, "Charlie"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_admincode(hdl, "Dlta"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_admincode(hdl, "Delta"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_technician(hdl, "cho"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_technician(hdl, "Echo"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_equipment(hdl, "Foxtrt"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_equipment(hdl, "Foxtrot"))  JUMP_TO_EXIT_ERROR_PROC
 
   if(edf_set_recording_additional(hdl, "Golf"))  JUMP_TO_EXIT_ERROR_PROC
 
@@ -2959,7 +2982,10 @@ int main(void)
     dbuf[i] = 0;
   }
 
-  if(edfwrite_physical_samples(hdl, dbuf))  JUMP_TO_EXIT_ERROR_PROC
+  for(i=0; i<40; i++)
+  {
+    if(edfwrite_physical_samples(hdl, dbuf))  JUMP_TO_EXIT_ERROR_PROC
+  }
 
   if(edfclose_file(hdl))
   {
@@ -2980,6 +3006,21 @@ int main(void)
 
   if(hdr.edfsignals != 1)  JUMP_TO_EXIT_ERROR_PROC
 
+  for(i=0; i<60; i++)
+  {
+    if(edf_get_annotation(hdl, i * 2, &annot))  JUMP_TO_EXIT_ERROR_PROC
+
+//    printf("i: %i   onset: %lli\n", i, annot.onset);
+
+    if(annot.onset != 10000000LL * (i + 1))  JUMP_TO_EXIT_ERROR_PROC
+
+    if(edf_get_annotation(hdl, i * 2 + 1, &annot))  JUMP_TO_EXIT_ERROR_PROC
+
+    if(annot.onset != 10000000LL * (i + 1) + 3333000LL)  JUMP_TO_EXIT_ERROR_PROC
+
+//    printf("i: %i   onset: %lli\n", i * 2 + 1, annot.onset);
+  }
+
   if(strncmp(hdr.patientcode, "Bravo", 5))  JUMP_TO_EXIT_ERROR_PROC
 
   if(strncmp(hdr.gender, "Male", 4))  JUMP_TO_EXIT_ERROR_PROC
@@ -3021,6 +3062,27 @@ int main(void)
   if(strncmp(str + 88, "Startdate 31-DEC-2008 Delta Echo Foxtrot Golf"
     "                                   ", 80))  JUMP_TO_EXIT_ERROR_PROC
 
+/********************************** EDF reading ******************************/
+
+  if(edfopen_file_readonly("test3.edf", &hdr, EDFLIB_DO_NOT_READ_ANNOTATIONS))  JUMP_TO_EXIT_ERROR_PROC
+
+  hdl = hdr.handle;
+
+  if(hdr.filetype != 1)  JUMP_TO_EXIT_ERROR_PROC
+
+  if(hdr.edfsignals != 1)  JUMP_TO_EXIT_ERROR_PROC
+
+  if(hdr.starttime_subsecond!=1234000LL)  JUMP_TO_EXIT_ERROR_PROC
+
+  if(edfclose_file(hdl))
+  {
+    hdl = -1;
+
+    JUMP_TO_EXIT_ERROR_PROC
+  }
+
+  hdl = -1;
+
   /****************************************/
 
   return EXIT_SUCCESS;



View it on GitLab: https://salsa.debian.org/med-team/edflib/-/commit/4aba4d162169001c684ba4189c400419d3e6aa68

-- 
View it on GitLab: https://salsa.debian.org/med-team/edflib/-/commit/4aba4d162169001c684ba4189c400419d3e6aa68
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200704/34995d13/attachment-0001.html>


More information about the debian-med-commit mailing list