Skip to content

Dynamic test case error while TEXT-decoding

Summary

TITAN can encode my record just fine, but throws a DTE while decoding its own encoding result.

Steps and/or TTCN-3 code to reproduce

/* Example: 1234/0/1 (site 1234, BTS#0, TRX#1) */
type record IpaUnitId {
	integer		site_id,
	integer		bts_id,
	integer		trx_id
} with {
	encode "TEXT"
	variant "SEPARATOR('/', '/')"
};

external function enc_IpaUnitId(in IpaUnitId unit_id) return charstring
	with { extension "prototype(convert) encode(TEXT)" }
external function dec_IpaUnitId(in charstring stream) return IpaUnitId
	with { extension "prototype(convert) decode(TEXT)" }

template (value) IpaUnitId ts_IpaUnitId(integer site_id := 1234,
					integer bts_id := 0,
					integer trx_id := 0) := {
	site_id := site_id,
	bts_id  := bts_id,
	trx_id  := trx_id
};
template IpaUnitId tr_IpaUnitId(template (present) integer site_id := ?,
				template (present) integer bts_id := ?,
				template (present) integer trx_id := ?) := {
	site_id := site_id,
	bts_id  := bts_id,
	trx_id  := trx_id
};

private type component Dummy_CT {  };

testcase TC_selftest_IpaUnitId() runs on Dummy_CT {
	var IpaUnitId unit_id := valueof(ts_IpaUnitId(1234, 0, 3));
	var charstring unit_id_enc := enc_IpaUnitId(unit_id);

	log("Enc: ", unit_id_enc);
	log("Dec: ", dec_IpaUnitId(unit_id_enc)); // <-- DTE happens here
}

(copied from https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26458)

What is the current bug behavior?

MTC@DELL: Test case TC_selftest_IpaUnitId started.
MTC@DELL: Enc: "1234/0/3"
MTC@DELL: Dynamic test case error: While TEXT-decoding type '@IPA_Types.IpaUnitId': Error during decoding field 'trx__id' for '@IPA_Types.IpaUnitId'

What is the expected correct behavior?

MTC@DELL: Test case TC_selftest_IpaUnitId started.
MTC@DELL: Enc: "1234/0/3"
MTC@DELL: Dec: { site_id := 1234, bts_id := 0, trx_id := 3 }

Titan version

TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor
Version: 10.0.0
Build date: Nov 19 2023 09:57:19
Compiled with: GCC 13.2.1
Using OpenSSL 3.2.1 30 Jan 2024
Commit id: 74e01d1

https://aur.archlinux.org/packages/eclipse-titan https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=eclipse-titan

The problem was also observed with older TITAN versions back in 2021.

Platform details (OS type and version)

Arch Linux

$ uname -a
Linux LEGION 6.6.23-1-lts #1 SMP PREEMPT_DYNAMIC Wed, 27 Mar 2024 07:47:20 +0000 x86_64 GNU/Linux

/cc @aknappqwt @mmagyari