Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Re-usability of type filters to match received messages
Re-usability of type filters to match received messages [message #1864574] Tue, 26 March 2024 16:13 Go to next message
Erwan Toux is currently offline Erwan TouxFriend
Messages: 6
Registered: March 2024
Junior Member
Hello everyone,
I am fairly new to TTCN3 and I am probably doing or thinking the wrong way.
I would like to do some matching tests on a received message. I am currently doing the following :

    type record Person{
        charstring firstName,
        charstring middleName optional,
        charstring lastName
    } 

    template Person validPerson := {
        firstName := ? length (0 .. 25),
        middleName := * length (0 .. 25) ifpresent,
        lastName := ? length (0 .. 20)
    }

and the testcase is then

        alt {
            [] Port.receive(Person:?) -> value received_msg{
                if (match(received_msg, validPerson)){ setverdict(pass, "Received valid message") }
                else {
                    setverdict(fail, "Received unvalid message", received_msg)                
                }
            }

         ... some other stuff


Now what I would like to do, because I will end up having to describe many scenarios is

    type charstring String20    length(0..20);
    type charstring String25    length(0..25);

    type record ValidPerson{
        String25 firstName,
        String25 middleName optional,
        String20 lastName
    } 


And then be able to match my received message with the said record above. That would avoid me having to write over and over the lengths filters in the template. This is needed because I will be re-using the specified charstrings20 and 25 a lot later on (say for instance for an Adress template)

Is there any way to do what I want ? If not, is there a cleaner way to do this ?
Many thanks!
Re: Re-usability of type filters to match received messages [message #1864661 is a reply to message #1864574] Tue, 02 April 2024 13:46 Go to previous message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 134
Registered: December 2015
Senior Member
Due to the TITAN doesn't enforces the subtyping during run time I suggest to create templates for the String20/String25 and reuse the templates later.
Previous Topic:compiler segmentation fault on specific template usage [titan 10.0.0]
Next Topic:Support for WebSocket in Eclipse Titan
Goto Forum:
  


Current Time: Sun Oct 13 19:27:52 GMT 2024

Powered by FUDForum. Page generated in 0.02701 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top