tests/dtx: test tagging of FACCH/[FH] frames

This patch adds a new test confirming that [1] actually fixes the bug.

Change-Id: I3d295a15d4446b3e440fbf4c90a1688d6c7275ae
Related: [1] I2e6f4b748c6445725211e264ab5f3f5a2712087a
Related: SYS#5853
diff --git a/tests/dtx/dtx_gsm0503_test.c b/tests/dtx/dtx_gsm0503_test.c
index 4ee5bf7..fe4577e 100644
--- a/tests/dtx/dtx_gsm0503_test.c
+++ b/tests/dtx/dtx_gsm0503_test.c
@@ -215,6 +215,32 @@
 					 "detection/decoding of AHS_SID_UPDATE");
 }
 
+static void test_gsm0503_tch_afhs_decode_dtx_facch(void)
+{
+	enum gsm0503_amr_dtx_frames amr_last_dtx;
+	sbit_t bursts[BURST_PLEN * 8]; /* 8 bursts */
+	unsigned int i;
+
+	/* Set stealing bits to provoke FACCH/[FH] detection */
+	for (i = 0; i < 8; i++) {
+		sbit_t *burst = &bursts[BURST_PLEN * i];
+		memset(&burst[0], 0, BURST_PLEN);
+		burst[i >> 2 ? 57 : 58] = -127;
+	}
+
+	amr_last_dtx = AFS_SID_UPDATE;
+	test_gsm0503_tch_afhs_decode_dtx(&bursts[0], BURST_PLEN * 0,
+					 &amr_last_dtx, true /* AFS */,
+					 "tagging of FACCH/F");
+	OSMO_ASSERT(amr_last_dtx == AMR_OTHER);
+
+	amr_last_dtx = AHS_SID_UPDATE;
+	test_gsm0503_tch_afhs_decode_dtx(&bursts[0], BURST_PLEN * 0,
+					 &amr_last_dtx, false /* AHS */,
+					 "tagging of FACCH/H");
+	OSMO_ASSERT(amr_last_dtx == AMR_OTHER);
+}
+
 int main(int argc, char **argv)
 {
 	printf("FR AMR DTX FRAMES:\n");
@@ -230,6 +256,7 @@
 	test_gsm0503_detect_ahs_dtx_frame(sample_sid_update_inh_frame);
 
 	test_gsm0503_tch_afhs_decode_dtx_sid_update();
+	test_gsm0503_tch_afhs_decode_dtx_facch();
 
 	return EXIT_SUCCESS;
 }