API
 
Loading...
Searching...
No Matches
siglentSDG_test.cpp
Go to the documentation of this file.
1/** \file siglentSDG_test.cpp
2 * \brief Catch2 tests for the siglentSDG app.
3 * \author Jared R. Males (jaredmales@gmail.com)
4 *
5 * History:
6 */
7
8#include "../../../tests/catch2/catch.hpp"
9#include "../../tests/testMacrosINDI.hpp"
10
11
12#include "../siglentSDG.hpp"
13
14using namespace MagAOX::app;
15
16namespace SDGTEST
17{
18
47
48//#define QUOTE(s) #s
49
50
70
71SCENARIO( "Parsing the OUTP? response", "[siglentSDG]" )
72{
73 GIVEN("A valid response to OUTP from the SDG")
74 {
75 int rv;
76
77 WHEN("Valid OUTP passed, off")
78 {
79 int channel = -10;
80 int outp = -10;
81
82 rv = parseOUTP(channel, outp, "C1:OUTP OFF,LOAD,HZ,PLRT,NOR");
83
84 REQUIRE(rv == 0);
85 REQUIRE(channel == 1);
86 REQUIRE(outp == 0);
87 }
88
89 WHEN("Valid OUTP passed, on")
90 {
91 int channel = -10;
92 int outp = -10;
93
94 rv = parseOUTP(channel, outp, "C2:OUTP ON,LOAD,HZ,PLRT,NOR");
95
96 REQUIRE(rv == 0);
97 REQUIRE(channel == 2);
98 REQUIRE(outp == 1);
99 }
100
101 WHEN("Valid OUTP passed, two-digit channel on")
102 {
103 int channel = -10;
104 int outp = -10;
105
106 rv = parseOUTP(channel, outp, "C35:OUTP ON,LOAD,HZ,PLRT,NOR");
107
108 REQUIRE(rv == 0);
109 REQUIRE(channel == 35);
110 REQUIRE(outp == 1);
111 }
112 }
113 GIVEN("An invalid response to OUTP from the SDG")
114 {
115 int rv;
116
117 WHEN("Invalid OUTP passed, no sp")
118 {
119 int channel = -10;
120 int outp = -10;
121
122 rv = parseOUTP(channel, outp, "C2:OUTPON,LOAD,HZ,PLRT,NOR");
123
124 REQUIRE(rv == -2);
125 }
126
127 WHEN("Invalid OUTP passed, end before N in ON")
128 {
129 int channel = -10;
130 int outp = -10;
131
132 rv = parseOUTP(channel, outp, "C2:OUTP O");
133
134 REQUIRE(rv == -6);
135 }
136
137 WHEN("Invalid OUTP passed, end before :")
138 {
139 int channel = -10;
140 int outp = -10;
141
142 rv = parseOUTP(channel, outp, "C2");
143
144 REQUIRE(rv == -1);
145 }
146
147 WHEN("Wrong Command Reply")
148 {
149 int channel = -10;
150 int outp = -10;
151
152 rv = parseOUTP(channel, outp, "C1:BSWV WVTP,SINE,FRQ,10HZ,PERI,0.1S,AMP,2V,AMPVRMS,0.707Vrms,OFST,0V,HLEV,1V,LLEV,-1V,PHSE,0");
153
154 REQUIRE(rv == -2);
155 }
156 }
157}
158
159SCENARIO( "Parsing the BSWV? response", "[siglentSDG]" )
160{
161 GIVEN("A valid response to BSWV from the SDG")
162 {
163 int rv;
164
165 WHEN("Valid BSWV passed")
166 {
167 int channel = -10;
168 std::string wvtp;
169 double freq;
170 double peri;
171 double amp;
172 double ampvrms;
173 double ofst;
174 double hlev;
175 double llev;
176 double phse;
177 double wdth;
178 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
179 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth,resp);
180
181 REQUIRE(rv == 0);
182 REQUIRE(channel == 1);
183 REQUIRE(wvtp == "SINE");
184 REQUIRE(freq == 10.123);
185 REQUIRE(peri == 0.8345);
186 REQUIRE(amp == 2.567);
187 REQUIRE(ampvrms == 0.707);
188 REQUIRE(ofst == 0.34);
189 REQUIRE(hlev == 1.3 );
190 REQUIRE(llev == -2.567 );
191 REQUIRE(phse ==4.3567 );
192 }
193 }
194
195 GIVEN("An invalid response to BSWV from the SDG")
196 {
197 int rv;
198
199 WHEN("An invalid BSWV passed - not enough args")
200 {
201 int channel = -10;
202 std::string wvtp;
203 double freq;
204 double peri;
205 double amp;
206 double ampvrms;
207 double ofst;
208 double hlev;
209 double llev;
210 double phse;
211 double wdth;
212 std::string resp="C1:BSWV WVTP";
213 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
214
215 REQUIRE(rv == -1);
216 }
217
218 WHEN("An invalid BSWV passed - wrong response")
219 {
220 int channel = -10;
221 std::string wvtp;
222 double freq;
223 double peri;
224 double amp;
225 double ampvrms;
226 double ofst;
227 double hlev;
228 double llev;
229 double phse;
230 double wdth;
231 std::string resp="C1:MDWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
232 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
233
234 REQUIRE(rv == -2);
235 }
236
237 WHEN("An invalid BSWV passed - bad channel spec, no C")
238 {
239 int channel = -10;
240 std::string wvtp;
241 double freq;
242 double peri;
243 double amp;
244 double ampvrms;
245 double ofst;
246 double hlev;
247 double llev;
248 double phse;
249 double wdth;
250 std::string resp="X1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
251 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
252
253 REQUIRE(rv == -3);
254 }
255
256 WHEN("An invalid BSWV passed - bad channel spec, too short ")
257 {
258 int channel = -10;
259 std::string wvtp;
260 double freq;
261 double peri;
262 double amp;
263 double ampvrms;
264 double ofst;
265 double hlev;
266 double llev;
267 double phse;
268 double wdth;
269 std::string resp="C:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
270 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
271
272 REQUIRE(rv == -4);
273 }
274
275 WHEN("An invalid BSWV passed - bad WVTP indicator")
276 {
277 int channel = -10;
278 std::string wvtp;
279 double freq;
280 double peri;
281 double amp;
282 double ampvrms;
283 double ofst;
284 double hlev;
285 double llev;
286 double phse;
287 double wdth;
288 std::string resp="C1:BSWV WVTQ,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
289 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
290
291 REQUIRE(rv == -5);
292 }
293
294 WHEN("An invalid BSWV passed - wvtp not SINE")
295 {
296 int channel = -10;
297 std::string wvtp;
298 double freq;
299 double peri;
300 double amp;
301 double ampvrms;
302 double ofst;
303 double hlev;
304 double llev;
305 double phse;
306 double wdth;
307 std::string resp="C1:BSWV WVTP,UPIY,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
308 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
309
310 REQUIRE(rv == -6);
311 }
312
313 WHEN("An invalid BSWV passed - bad FRQ indicator")
314 {
315 int channel = -10;
316 std::string wvtp;
317 double freq;
318 double peri;
319 double amp;
320 double ampvrms;
321 double ofst;
322 double hlev;
323 double llev;
324 double phse;
325 double wdth;
326 std::string resp="C1:BSWV WVTP,SINE,FRZ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
327 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
328
329 REQUIRE(rv == -10);
330 }
331
332 WHEN("An invalid BSWV passed - bad PERI indicator")
333 {
334 int channel = -10;
335 std::string wvtp;
336 double freq;
337 double peri;
338 double amp;
339 double ampvrms;
340 double ofst;
341 double hlev;
342 double llev;
343 double phse;
344 double wdth;
345 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERZ,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
346 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
347
348 REQUIRE(rv == -11);
349 }
350
351 WHEN("An invalid BSWV passed - bad AMP indicator")
352 {
353 int channel = -10;
354 std::string wvtp;
355 double freq;
356 double peri;
357 double amp;
358 double ampvrms;
359 double ofst;
360 double hlev;
361 double llev;
362 double phse;
363 double wdth;
364 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,A/P,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
365 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
366
367 REQUIRE(rv == -12);
368 }
369
370 WHEN("An invalid BSWV passed - bad AMPVRMS indicator")
371 {
372 int channel = -10;
373 std::string wvtp;
374 double freq;
375 double peri;
376 double amp;
377 double ampvrms;
378 double ofst;
379 double hlev;
380 double llev;
381 double phse;
382 double wdth;
383 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,APVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
384 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
385
386 REQUIRE(rv == -13);
387 }
388
389 WHEN("An invalid BSWV passed - bad OFST indicator")
390 {
391 int channel = -10;
392 std::string wvtp;
393 double freq;
394 double peri;
395 double amp;
396 double ampvrms;
397 double ofst;
398 double hlev;
399 double llev;
400 double phse;
401 double wdth;
402 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,O,0.34V,HLEV,1.3V,LLEV,-2.567V,PHSE,4.3567";
403 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
404
405 REQUIRE(rv == -14);
406 }
407
408 WHEN("An invalid BSWV passed - bad HLEV indicator")
409 {
410 int channel = -10;
411 std::string wvtp;
412 double freq;
413 double peri;
414 double amp;
415 double ampvrms;
416 double ofst;
417 double hlev;
418 double llev;
419 double phse;
420 double wdth;
421 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLV,1.3V,LLEV,-2.567V,PHSE,4.3567";
422 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
423
424 REQUIRE(rv == -15);
425 }
426
427 WHEN("An invalid BSWV passed - bad LLEV indicator")
428 {
429 int channel = -10;
430 std::string wvtp;
431 double freq;
432 double peri;
433 double amp;
434 double ampvrms;
435 double ofst;
436 double hlev;
437 double llev;
438 double phse;
439 double wdth;
440 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,QLEV,-2.567V,PHSE,4.3567";
441 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
442
443 REQUIRE(rv == -16);
444 }
445
446 WHEN("An invalid BSWV passed - bad PHSE indicator")
447 {
448 int channel = -10;
449 std::string wvtp;
450 double freq;
451 double peri;
452 double amp;
453 double ampvrms;
454 double ofst;
455 double hlev;
456 double llev;
457 double phse;
458 double wdth;
459 std::string resp="C1:BSWV WVTP,SINE,FRQ,10.123HZ,PERI,0.8345S,AMP,2.567V,AMPVRMS,0.707Vrms,OFST,0.34V,HLEV,1.3V,LLEV,-2.567V,XXXXX,4.3567";
460 rv = parseBSWV(channel, wvtp, freq, peri, amp, ampvrms, ofst, hlev, llev, phse, wdth, resp);
461
462 REQUIRE(rv == -17);
463 }
464 }
465}
466
467SCENARIO( "Parsing the MDWV? response", "[siglentSDG]" )
468{
469 GIVEN("A valid response to MDWV from the SDG")
470 {
471 int rv;
472
473 WHEN("Valid MDWV passed, with state off")
474 {
475 int channel = -10;
476 std::string state;
477 std::string resp="C1:MDWV STATE,OFF";
478 rv = parseMDWV(channel, state, resp);
479
480 REQUIRE(rv == 0);
481 REQUIRE(channel == 1);
482 REQUIRE(state == "OFF");
483 }
484
485 WHEN("Valid MDWV passed, with state on")
486 {
487 //We ignore the rest of the string
488 int channel = -10;
489 std::string state;
490 std::string resp="C1:MDWV STATE,ON,AM,MDSP,SINE,SRC,INT,FRQ,100HZ,DEPTH,100,CARR,WVTP,SINE,FRQ,1000HZ,AMP,4V,AMPVRMS,1.414Vrms,OFST,0V,PHSE,0";
491 rv = parseMDWV(channel, state, resp);
492
493 REQUIRE(rv == 0);
494 REQUIRE(channel == 1);
495 REQUIRE(state == "ON");
496 }
497 }
498
499 GIVEN("An invalid response to MDWV from the SDG")
500 {
501 int rv;
502
503 WHEN("invalid MDWV passed - too short")
504 {
505 int channel = -10;
506 std::string state;
507 std::string resp="C1:MDWV S";
508 rv = parseMDWV(channel, state, resp);
509
510 REQUIRE(rv == -1);
511 }
512
513 WHEN("invalid MDWV passed - wrong command")
514 {
515 int channel = -10;
516 std::string state;
517 std::string resp="C1:MDWQ STATE,OFF";
518 rv = parseMDWV(channel, state, resp);
519
520 REQUIRE(rv == -2);
521 }
522
523 WHEN("invalid MDWV passed - no C")
524 {
525 int channel = -10;
526 std::string state;
527 std::string resp="X1:MDWV STATE,OFF";
528 rv = parseMDWV(channel, state, resp);
529
530 REQUIRE(rv == -3);
531 }
532
533 WHEN("invalid MDWV passed - no channel")
534 {
535 int channel = -10;
536 std::string state;
537 std::string resp="C:MDWV STATE,OFF";
538 rv = parseMDWV(channel, state, resp);
539
540 REQUIRE(rv == 0);
541 REQUIRE(channel == 0);
542 }
543
544 WHEN("invalid MDWV passed - no STATE")
545 {
546 int channel = -10;
547 std::string state;
548 std::string resp="C1:MDWV STAT,OFF";
549 rv = parseMDWV(channel, state, resp);
550
551 REQUIRE(rv == -4);
552 }
553 }
554}
555
556SCENARIO( "Parsing the SWWV? response", "[siglentSDG]" )
557{
558 GIVEN("A valid response to SWWV from the SDG")
559 {
560 int rv;
561
562 WHEN("Valid SWWV passed, with state off")
563 {
564 int channel = -10;
565 std::string state;
566 std::string resp="C1:SWWV STATE,OFF";
567 rv = parseSWWV(channel, state, resp);
568
569 REQUIRE(rv == 0);
570 REQUIRE(channel == 1);
571 REQUIRE(state == "OFF");
572 }
573
574 WHEN("Valid SWWV passed, with state on")
575 {
576 //We ignore the rest of the string
577 int channel = -10;
578 std::string state;
579 std::string resp="C1:SWWV STATE,ON,TIME,1S,STOP,1500HZ,START,500HZ,TRSR,INT,TRMD,OFF,SWMD,LINE,DIR,UP,SYM,0.000000,CARR,WVTP,SINE,FRQ,1000HZ,AMP,4V,AMPVRMS,1.414Vrms,OFST,0V,PHSE,0";
580 rv = parseSWWV(channel, state, resp);
581
582 REQUIRE(rv == 0);
583 REQUIRE(channel == 1);
584 REQUIRE(state == "ON");
585 }
586 }
587
588 GIVEN("An invalid response to SWWV from the SDG")
589 {
590 int rv;
591
592 WHEN("invalid SWWV passed - too short")
593 {
594 int channel = -10;
595 std::string state;
596 std::string resp="C1:SWWV S";
597 rv = parseSWWV(channel, state, resp);
598
599 REQUIRE(rv == -1);
600 }
601
602 WHEN("invalid SWWV passed - wrong command")
603 {
604 int channel = -10;
605 std::string state;
606 std::string resp="C1:SWWQ STATE,OFF";
607 rv = parseSWWV(channel, state, resp);
608
609 REQUIRE(rv == -2);
610 }
611
612 WHEN("invalid SWWV passed - no C")
613 {
614 int channel = -10;
615 std::string state;
616 std::string resp="X1:SWWV STATE,OFF";
617 rv = parseSWWV(channel, state, resp);
618
619 REQUIRE(rv == -3);
620 }
621
622 WHEN("invalid SWWV passed - no channel")
623 {
624 int channel = -10;
625 std::string state;
626 std::string resp="C:SWWV STATE,OFF";
627 rv = parseSWWV(channel, state, resp);
628
629 REQUIRE(rv == 0);
630 REQUIRE(channel == 0);
631 }
632
633 WHEN("invalid SWWV passed - no STATE")
634 {
635 int channel = -10;
636 std::string state;
637 std::string resp="C1:SWWV STAT,OFF";
638 rv = parseSWWV(channel, state, resp);
639
640 REQUIRE(rv == -4);
641 }
642 }
643}
644
645
646SCENARIO( "Parsing the BTWV? response", "[siglentSDG]" )
647{
648 GIVEN("A valid response to BTWV from the SDG")
649 {
650 int rv;
651
652 WHEN("Valid BTWV passed, with state off")
653 {
654 int channel = -10;
655 std::string state;
656 std::string resp="C1:BTWV STATE,OFF";
657 rv = parseBTWV(channel, state, resp);
658
659 REQUIRE(rv == 0);
660 REQUIRE(channel == 1);
661 REQUIRE(state == "OFF");
662 }
663
664 WHEN("Valid BTWV passed, with state on")
665 {
666 //We ignore the rest of the string
667 int channel = -10;
668 std::string state;
669 std::string resp="C1:BTWV STATE,ON,PRD,0.01S,STPS,0,TRSR,INT,TRMD,OFF,TIME,1,DLAY,5.21035e-07S,GATE_NCYC,NCYC,CARR,WVTP,SINE,FRQ,1000HZ,AMP,4V,AMPVRMS,1.414Vrms,OFST,0V,PHSE,0";
670 rv = parseBTWV(channel, state, resp);
671
672 REQUIRE(rv == 0);
673 REQUIRE(channel == 1);
674 REQUIRE(state == "ON");
675 }
676 }
677
678 GIVEN("An invalid response to BTWV from the SDG")
679 {
680 int rv;
681
682 WHEN("invalid BTWV passed - too short")
683 {
684 int channel = -10;
685 std::string state;
686 std::string resp="C1:BTWV S";
687 rv = parseBTWV(channel, state, resp);
688
689 REQUIRE(rv == -1);
690 }
691
692 WHEN("invalid BTWV passed - wrong command")
693 {
694 int channel = -10;
695 std::string state;
696 std::string resp="C1:BTWQ STATE,OFF";
697 rv = parseBTWV(channel, state, resp);
698
699 REQUIRE(rv == -2);
700 }
701
702 WHEN("invalid BTWV passed - no C")
703 {
704 int channel = -10;
705 std::string state;
706 std::string resp="X1:BTWV STATE,OFF";
707 rv = parseBTWV(channel, state, resp);
708
709 REQUIRE(rv == -3);
710 }
711
712 WHEN("invalid BTWV passed - no channel")
713 {
714 int channel = -10;
715 std::string state;
716 std::string resp="C:BTWV STATE,OFF";
717 rv = parseBTWV(channel, state, resp);
718
719 REQUIRE(rv == 0);
720 REQUIRE(channel == 0);
721 }
722
723 WHEN("invalid BTWV passed - no STATE")
724 {
725 int channel = -10;
726 std::string state;
727 std::string resp="C1:BTWV STAT,OFF";
728 rv = parseBTWV(channel, state, resp);
729
730 REQUIRE(rv == -4);
731 }
732 }
733}
734
735SCENARIO( "Parsing the ARWV? response", "[siglentSDG]" )
736{
737 GIVEN("A valid response to ARWV from the SDG")
738 {
739 int rv;
740
741 WHEN("Valid ARWV passed, with index 0")
742 {
743 int channel = -10;
744 int index = -10;
745 ;
746 std::string resp="C1:ARWV INDEX,0,NAME,";
747 rv = parseARWV(channel, index, resp);
748
749 REQUIRE(rv == 0);
750 REQUIRE(channel == 1);
751 REQUIRE(index == 0);
752 }
753
754 WHEN("Valid ARWV passed, with index 1")
755 {
756 //We ignore the rest of the string
757 int channel = -10;
758 int index = -10;
759 std::string resp="C2:ARWV INDEX,1,NAME,";
760 rv = parseARWV(channel, index, resp);
761
762 REQUIRE(rv == 0);
763 REQUIRE(channel == 2);
764 REQUIRE(index == 1);
765 }
766 }
767
768 GIVEN("An invalid response to ARWV from the SDG")
769 {
770 int rv;
771
772 WHEN("invalid ARWV passed - too short")
773 {
774 int channel = -10;
775 int index = -10;
776 std::string resp="C1:ARWV I";
777 rv = parseARWV(channel, index, resp);
778
779 REQUIRE(rv == -1);
780 }
781
782 WHEN("invalid ARWV passed - wrong command")
783 {
784 int channel = -10;
785 int index = -10;
786 std::string resp="C1:ARWQ INDEX,0";
787 rv = parseARWV(channel, index, resp);
788
789 REQUIRE(rv == -2);
790 }
791
792 WHEN("invalid ARWV passed - no C")
793 {
794 int channel = -10;
795 int index = -10;
796 std::string resp="X1:ARWV INDEX,0";
797 rv = parseARWV(channel, index, resp);
798
799 REQUIRE(rv == -3);
800 }
801
802 WHEN("invalid ARWV passed - no channel")
803 {
804 int channel = -10;
805 int index = -10;
806 std::string resp="C:ARWV INDEX,0";
807 rv = parseARWV(channel, index, resp);
808
809 REQUIRE(rv == 0);
810 REQUIRE(channel == 0);
811 }
812
813 WHEN("invalid ARWV passed - no INDEX")
814 {
815 int channel = -10;
816 int index = -10;
817 std::string resp="C1:ARWV INDX,0";
818 rv = parseARWV(channel, index, resp);
819
820 REQUIRE(rv == -4);
821 }
822 }
823}
824
825} //namespace siglentSDG_test
#define GIVEN(desc)
Definition catch.hpp:17763
#define WHEN(desc)
Definition catch.hpp:17765
#define SCENARIO(...)
Definition catch.hpp:17760
#define REQUIRE(...)
Definition catch.hpp:17676
std::string m_configName
The name of the configuration file (minus .conf).
Definition MagAOXApp.hpp:83
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
siglentSDG_test(const std::string device)
#define XWCTEST_INDI_NEW_CALLBACK(testclass, propname)
Catch-2 tests for whether a NEW callback properly validates the input property properly.
int parseOUTP(int &channel, int &output, const std::string &strRead)
Parse the SDG response to the OUTP query.
int parseSWWV(int &channel, std::string &state, const std::string &strRead)
Parse the SDG response to the SWWV query.
int parseMDWV(int &channel, std::string &state, const std::string &strRead)
Parse the SDG response to the MDWV query.
int parseBSWV(int &channel, std::string &wvtp, double &freq, double &peri, double &amp, double &ampvrms, double &ofst, double &hlev, double &llev, double &phse, double &wdth, const std::string &strRead)
Parse the SDG response to the BSWV query.
int parseBTWV(int &channel, std::string &state, const std::string &strRead)
Parse the SDG response to the BTWV query.
int parseARWV(int &channel, int &index, const std::string &strRead)
Parse the SDG response to the ARWV query.
#define XWCTEST_SETUP_INDI_NEW_PROP(propname)