コード例 #1
0
	def test_transform(self):
		for ver in DATAMSG.known_versions:
			with self.subTest("L1 -> TRX message", ver = ver):
				msg = DATAMSG_L12TRX(ver = ver)
				self._test_transform(msg)

			with self.subTest("TRX -> L1 message", ver = ver):
				msg = DATAMSG_TRX2L1(ver = ver)
				self._test_transform(msg)
コード例 #2
0
	def test_enc_dec(self):
		for ver in DATAMSG.known_versions:
			with self.subTest("L1 -> TRX message", ver = ver):
				msg = DATAMSG_L12TRX(ver = ver)
				self._test_enc_dec(msg)

			with self.subTest("TRX -> L1 message", ver = ver):
				msg = DATAMSG_TRX2L1(ver = ver)
				self._test_enc_dec(msg)

			if ver >= 1:
				with self.subTest("TRX -> L1 NOPE.ind", ver = ver):
					msg = DATAMSG_TRX2L1(ver = ver)
					self._test_enc_dec(msg, nope_ind = True)

		with self.subTest("TRX -> L1 message (legacy)"):
			msg = DATAMSG_TRX2L1(ver = 0)
			self._test_enc_dec(msg, legacy = True)
コード例 #3
0
ファイル: test_data_msg.py プロジェクト: kukupigs/osmocom-bb
	def test_transform(self):
		for ver in DATAMSG.KNOWN_VERSIONS:
			with self.subTest("L1 -> TRX message", ver = ver):
				msg = DATAMSG_L12TRX(ver = ver)
				self._test_transform(msg)

			with self.subTest("TRX -> L1 message", ver = ver):
				msg = DATAMSG_TRX2L1(ver = ver)
				self._test_transform(msg)
コード例 #4
0
	def test_rand_hdr_burst(self):
		msg_l12trx = DATAMSG_L12TRX()
		msg_trx2l1 = DATAMSG_TRX2L1()

		for i in range(100):
			msg_l12trx.rand_burst()
			msg_trx2l1.rand_burst()
			msg_l12trx.rand_hdr()
			msg_trx2l1.rand_hdr()

			msg_l12trx.validate()
			msg_trx2l1.validate()
コード例 #5
0
ファイル: test_data_msg.py プロジェクト: kukupigs/osmocom-bb
	def test_validate(self):
		# Unknown version
		with self.assertRaises(ValueError):
			msg = DATAMSG_TRX2L1(fn = 0, tn = 0, ver = 100)
			msg.validate()

		# Uninitialized field
		with self.assertRaises(ValueError):
			msg = DATAMSG_TRX2L1()
			msg.validate()
		with self.assertRaises(ValueError):
			msg = DATAMSG_TRX2L1(fn = None, tn = 0)
			msg.validate()

		# Out-of-range value(s)
		with self.assertRaises(ValueError):
			msg = DATAMSG_TRX2L1(fn = -1, tn = 0)
			msg.validate()
		with self.assertRaises(ValueError):
			msg = DATAMSG_TRX2L1(fn = 0, tn = 10)
			msg.validate()