]> sigrok.org Git - sigrok-test.git/commitdiff
caliper: introduce tests (pos/neg, mm/inch, change)
authorGerhard Sittig <redacted>
Sat, 18 Jul 2020 19:48:02 +0000 (21:48 +0200)
committerGerhard Sittig <redacted>
Sat, 18 Jul 2020 19:48:02 +0000 (21:48 +0200)
Add tests for the caliper decoder. Cover positive and negative numbers,
automatic millimeter and inch detection, and omitted annotations when
values haven't changed.

decoder/test/caliper/caliper_neg_mm.output [new file with mode: 0644]
decoder/test/caliper/caliper_only_change.output [new file with mode: 0644]
decoder/test/caliper/caliper_pos_in.output [new file with mode: 0644]
decoder/test/caliper/caliper_pos_mm.output [new file with mode: 0644]
decoder/test/caliper/test.conf [new file with mode: 0644]

diff --git a/decoder/test/caliper/caliper_neg_mm.output b/decoder/test/caliper/caliper_neg_mm.output
new file mode 100644 (file)
index 0000000..d35ee80
--- /dev/null
@@ -0,0 +1,15 @@
+157-11408 caliper: warning: "timeout with 7 bits in buffer" "timeout (7 bits)" "timeout"
+16657-21851 caliper: measurement: "-123.45mm" "-123.45"
+88744-93962 caliper: measurement: "-123.45mm" "-123.45"
+160608-165826 caliper: measurement: "-123.45mm" "-123.45"
+232687-237886 caliper: measurement: "-123.45mm" "-123.45"
+304583-309775 caliper: measurement: "-123.45mm" "-123.45"
+376592-381799 caliper: measurement: "-123.45mm" "-123.45"
+448610-453851 caliper: measurement: "-123.45mm" "-123.45"
+520867-526045 caliper: measurement: "-123.45mm" "-123.45"
+592585-597816 caliper: measurement: "-123.45mm" "-123.45"
+664541-669783 caliper: measurement: "-123.45mm" "-123.45"
+736470-741675 caliper: measurement: "-123.45mm" "-123.45"
+808518-813689 caliper: measurement: "-123.45mm" "-123.45"
+880388-885570 caliper: measurement: "-123.45mm" "-123.45"
+952252-957447 caliper: measurement: "-123.45mm" "-123.45"
diff --git a/decoder/test/caliper/caliper_only_change.output b/decoder/test/caliper/caliper_only_change.output
new file mode 100644 (file)
index 0000000..0b6142e
--- /dev/null
@@ -0,0 +1 @@
+29743-34896 caliper: measurement: "100.0mm" "100.0"
diff --git a/decoder/test/caliper/caliper_pos_in.output b/decoder/test/caliper/caliper_pos_in.output
new file mode 100644 (file)
index 0000000..47272e5
--- /dev/null
@@ -0,0 +1,14 @@
+47282-52463 caliper: measurement: "0.5in" "0.5"
+119129-124309 caliper: measurement: "0.5in" "0.5"
+191063-196242 caliper: measurement: "0.5in" "0.5"
+262897-268081 caliper: measurement: "0.5in" "0.5"
+334711-339946 caliper: measurement: "0.5in" "0.5"
+406691-411934 caliper: measurement: "0.5in" "0.5"
+478664-483881 caliper: measurement: "0.5in" "0.5"
+550556-555786 caliper: measurement: "0.5in" "0.5"
+622554-627796 caliper: measurement: "0.5in" "0.5"
+694610-699789 caliper: measurement: "0.5in" "0.5"
+766673-771859 caliper: measurement: "0.5in" "0.5"
+838470-843654 caliper: measurement: "0.5in" "0.5"
+910480-915650 caliper: measurement: "0.5in" "0.5"
+982415-987609 caliper: measurement: "0.5in" "0.5"
diff --git a/decoder/test/caliper/caliper_pos_mm.output b/decoder/test/caliper/caliper_pos_mm.output
new file mode 100644 (file)
index 0000000..47263a1
--- /dev/null
@@ -0,0 +1,13 @@
+61576-66769 caliper: measurement: "0.55mm" "0.55"
+133379-138560 caliper: measurement: "0.55mm" "0.55"
+205191-210390 caliper: measurement: "0.55mm" "0.55"
+277258-282461 caliper: measurement: "0.55mm" "0.55"
+348832-354022 caliper: measurement: "0.55mm" "0.55"
+420961-426118 caliper: measurement: "0.55mm" "0.55"
+492730-497915 caliper: measurement: "0.55mm" "0.55"
+564763-569951 caliper: measurement: "0.55mm" "0.55"
+636638-641833 caliper: measurement: "0.55mm" "0.55"
+708686-713867 caliper: measurement: "0.55mm" "0.55"
+780545-785764 caliper: measurement: "0.55mm" "0.55"
+852543-857711 caliper: measurement: "0.55mm" "0.55"
+924453-929669 caliper: measurement: "0.55mm" "0.55"
diff --git a/decoder/test/caliper/test.conf b/decoder/test/caliper/test.conf
new file mode 100644 (file)
index 0000000..a5983bd
--- /dev/null
@@ -0,0 +1,19 @@
+test caliper_pos_mm
+       protocol-decoder caliper channel clk=1 channel data=0
+       input caliper/caliper0.55mm.sr
+       output caliper annotation match caliper_pos_mm.output
+
+test caliper_neg_mm
+       protocol-decoder caliper channel clk=1 channel data=0
+       input caliper/caliper-123.45mm.sr
+       output caliper annotation match caliper_neg_mm.output
+
+test caliper_pos_in
+       protocol-decoder caliper channel clk=1 channel data=0
+       input caliper/caliper0.5in.sr
+       output caliper annotation match caliper_pos_in.output
+
+test caliper_only_change
+       protocol-decoder caliper channel clk=1 channel data=0 option changes=yes
+       input caliper/caliper100mm.sr
+       output caliper annotation match caliper_only_change.output