Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: How "to templarize" conditional items in record of

How "to templarize" conditional items in record of 10 Feb 2009 07:02 #7537

  • Carlos C
  • Carlos C's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Dear all,

I need an expert advice to solve a need we do not know to cope with.

Given:
type record Attribute {int type,int length,int value}
type AttributeList record of Attribute;

Test case A: to check that three mandatory attributes are received (no
matter ordering). It is easy by defining the following template:
template AttributeList my_template := {*,my_templateA,
my_templateB,my_templateC,*}

Test case B: to check that the attribute X is present in the list when a
condition is satisifed prior to the reception operation (i.e, if PIC_attr_x
is supported). HELP!

Test case C: to check that the attribute X is present in the list when the
attribute Y is present in the same list. HELP!

Test case D: to check that the attribute X is NOT present in the list when
the attribute Z is present in the same list. HELP!

Currently, we solve these needs by algorithm and some extra-logic in the
test case after receiving the List, i.e., post-processing of the list. But
we would ike to use templates and match at reception time to be aligned with
TTCN-3 programming paradigm.

Thanks in advance,
Carlos Cárdenas.
AT4 wireless
The administrator has disabled public write access.

How "to templarize" conditional items in record of 10 Feb 2009 11:56 #7538

Hello Carlos,



Use “set of” instead of record of for your list type (a set
really in this case) and most of your problems should be solved. The use the
superset feature of TTCN-3. You also will need some combinations of
templates in an alt statement to handle test case D, but in short you should
be able to survive with the set of type.



Feel free to ask more questions. I am in a rush today so this is
to be considered as a start.



Cheers

Bernard Stepien



_____

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
Sent: 10 février 2009 02:02
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: How "to templarize" conditional items in record of



Dear all,



I need an expert advice to solve a need we do not know to cope with.



Given:

type record Attribute {int type,int length,int value}

type AttributeList record of Attribute;



Test case A: to check that three mandatory attributes are received (no
matter ordering). It is easy by defining the following template:

template AttributeList my_template := {*,my_templateA,
my_templateB,my_templateC,*}



Test case B: to check that the attribute X is present in the list when a
condition is satisifed prior to the reception operation (i.e, if PIC_attr_x
is supported). HELP!



Test case C: to check that the attribute X is present in the list when the
attribute Y is present in the same list. HELP!



Test case D: to check that the attribute X is NOT present in the list when
the attribute Z is present in the same list. HELP!



Currently, we solve these needs by algorithm and some extra-logic in the
test case after receiving the List, i.e., post-processing of the list. But
we would ike to use templates and match at reception time to be aligned with
TTCN-3 programming paradigm.



Thanks in advance,

Carlos Cárdenas.

AT4 wireless
The administrator has disabled public write access.

How "to templarize" conditional items in record of 10 Feb 2009 12:17 #7539

Hi Carlos,

Your basic problem is - if I got your task correctly - that you are using a record of in a case when the order of the elements has no semantic meaning, i.e. unimportant.

If you define
type record Attribute {integer typefield,integer lengthfield,integer valuefield}

type set of Attribute AttributeList;

you can write your templates as:

template Attribute t_Attribute_x := { typefield := 0,lengthfield := 1, valuefield :=2 }

template Attribute t_Attribute_y := { typefield := 3,lengthfield := 4, valuefield :=5 }

template Attribute t_Attribute_z := { typefield := 6,lengthfield := 7, valuefield :=8 }

template AttributeList t_AttributeList_0 := {t_Attribute_x,t_Attribute_y,t_Attribute_z,*}

template AttributeList t_AttributeList_1 := {t_Attribute_x,*}

template AttributeList t_AttributeList_2 := {t_Attribute_x,t_Attribute_y,*}

template AttributeList t_AttributeList_3 := {complement(t_Attribute_x),t_Attribute_z}

Test case D can be solved by using a template only if the number of elements is known apriory (2 in the example above) and not too high. Otherwise you have write a function to checks your condition, store the received message and pass it to your checking function, where the verdict is taken.

BR, Gyorgy

PS: you shall not use type, length & value as field identifiers as these are TTCN-3 reserved words


________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
Sent: 2009-február-10 8:02
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: How "to templarize" conditional items in record of


Dear all,

I need an expert advice to solve a need we do not know to cope with.

Given:
type record Attribute {int type,int length,int value}
type AttributeList record of Attribute;

Test case A: to check that three mandatory attributes are received (no matter ordering). It is easy by defining the following template:

template AttributeList my_template := {*,my_templateA, my_templateB,my_templateC,*}

Test case B: to check that the attribute X is present in the list when a condition is satisifed prior to the reception operation (i.e, if PIC_attr_x is supported). HELP!

Test case C: to check that the attribute X is present in the list when the attribute Y is present in the same list. HELP!


Test case D: to check that the attribute X is NOT present in the list when the attribute Z is present in the same list. HELP!

Currently, we solve these needs by algorithm and some extra-logic in the test case after receiving the List, i.e., post-processing of the list. But we would ike to use templates and match at reception time to be aligned with TTCN-3 programming paradigm.

Thanks in advance,
Carlos Cárdenas.
AT4 wireless
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin