PCU_Tests_RAW.ttcn: introduce a test case for PTCCH/D coding

Change-Id: I887c8922446d0c1a959e6f2678f50e5754f55e83
Related: SYS#4606
diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 6b45af2..5bd966d 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -605,6 +605,45 @@
 	}
 }
 
+/* Verify that the PCU generates valid PTCCH/D messages
+ * while neither Uplink nor Downlink TBF is established. */
+testcase TC_ta_ptcch_idle() runs on RAW_PCU_Test_CT {
+	var PTCCHDownlinkMsg ptcch_msg;
+	var PCUIF_Message pcu_msg;
+	timer T;
+
+	/* Initialize the PCU interface abstraction */
+	f_init_raw(testcasename());
+
+	/* Sent an RTS.req for PTCCH/D */
+	BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+				  sapi := PCU_IF_SAPI_PTCCH, fn := 0,
+				  arfcn := 871, block_nr := 0));
+	T.start(5.0);
+	alt {
+	[] BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+					 sapi := PCU_IF_SAPI_PTCCH)) -> value pcu_msg {
+		log("Rx DATA.req message: ", pcu_msg);
+		setverdict(pass);
+		}
+	[] BTS.receive(PCUIF_Message:?) { repeat; }
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for a PTCCH/D block");
+		mtc.stop;
+		}
+	}
+
+	ptcch_msg := dec_PTCCHDownlinkMsg(pcu_msg.u.data_req.data);
+	log("Decoded PTCCH/D message: ", ptcch_msg);
+
+	/* Make sure the message is encoded correctly
+	 * TODO: do we expect all TA values to be equal '1111111'B? */
+	if (not match(ptcch_msg, tr_PTCCHDownlinkMsg)) {
+		setverdict(fail, "Malformed PTCCH/D message");
+		mtc.stop;
+	}
+}
+
 /* Default link quality adaptation (Coding Scheme) ranges:
 /* CS1: ... 6 dB, CS2: 5 .. 8 dB, CS3: 7 .. 13 db, CS4: 12 ... dB */
 private template integer CS1_lqual_dB_range := (-infinity .. 6);
@@ -719,6 +758,7 @@
 	execute( TC_ns_so_block() );
 
 	execute( TC_pcuif_suspend() );
+	execute( TC_ta_ptcch_idle() );
 	execute( TC_ta_rach_imm_ass() );
 	execute( TC_cs_lqual_ul_tbf() );
 }