From: David Schleef Date: Thu, 6 Jun 2002 00:38:54 +0000 (+0000) Subject: test reading 0 samples X-Git-Tag: r0_7_19~19 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1303b4758ce6872f5a47498922e4f79dfbbda312;p=comedilib.git test reading 0 samples --- diff --git a/testing/insn_read.c b/testing/insn_read.c index 0d347eb..285cbd4 100644 --- a/testing/insn_read.c +++ b/testing/insn_read.c @@ -58,3 +58,39 @@ int test_insn_read(void) return 0; } +/* + * This function tests reading with n=0. + */ +int test_insn_read_0(void) +{ + comedi_insn it; + lsampl_t data = 0xffffffff; + int ret; + int type; + + type = comedi_get_subdevice_type(device,subdevice); + if(type==COMEDI_SUBD_UNUSED){ + printf("not applicable\n"); + return 0; + } + + memset(&it,0,sizeof(it)); + it.subdev = subdevice; + it.insn = INSN_READ; + it.n = 0; + it.chanspec = CR_PACK(0,0,0); + it.data = &data; + + ret = comedi_do_insn(device,&it); + + if(ret<0){ + printf("E: comedi_do_insn: %s\n",strerror(errno)); + }else if(ret==0){ + printf("comedi_do_insn returned 0, good\n"); + }else{ + printf("E: comedi_do_insn returned %d\n",ret); + } + + return 0; +} + diff --git a/testing/main.c b/testing/main.c index d6f3945..3f838c4 100644 --- a/testing/main.c +++ b/testing/main.c @@ -26,6 +26,7 @@ int range; int test_info(void); int test_mode0_read(void); int test_insn_read(void); +int test_insn_read_0(void); int test_insn_read_time(void); int test_cmd_no_cmd(void); int test_cmd_probe_src_mask(void); @@ -52,6 +53,7 @@ struct test_struct tests[]={ { "info", test_info, TEST_STD }, { "mode0_read", test_mode0_read, TEST_NEVER }, { "insn_read", test_insn_read, TEST_STD }, + { "insn_read_0", test_insn_read_0, TEST_STD }, { "insn_read_time", test_insn_read_time, TEST_STD }, { "cmd_no_cmd", test_cmd_no_cmd, TEST_STD }, { "cmd_probe_src_mask", test_cmd_probe_src_mask, TEST_STD },