CORDET Framework - C2 Implementation
CrFwInStreamTestCases.c File Reference

Implementation of test cases for InStream Component. More...

Go to the source code of this file.

Functions

CrFwBool_t CrFwInStreamTestCase1 ()
 Test the initialization and packet queue (PQ) management of the InStream. More...
 
CrFwBool_t CrFwInStreamTestCase2 ()
 Test the collection of packets from an InStream. More...
 
CrFwBool_t CrFwInStreamTestCase3 ()
 Test the self-transition on state PCKT_AVAIL and the shutdown of an InStream. More...
 
CrFwBool_t CrFwInStreamTestCase4 ()
 Test the error reporting functionalities of an InStream. More...
 
CrFwBool_t CrFwInStreamTestCase5 ()
 Test the InStream with checks and actions which may be configured to succeed or fail. More...
 
CrFwBool_t CrFwInStreamTestCase6 ()
 Test the function to override the Shutdown Operation of an InStream and to verify entry into PCKT_AVAIL at start-up. More...
 
CrFwBool_t CrFwInStreamTestCase7 ()
 Test the management of groups by the InStream. More...
 

Detailed Description

Implementation of test cases for InStream Component.

Author
Vaclav Cechticky vacla.nosp@m.v.ce.nosp@m.chtic.nosp@m.ky@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m
Alessandro Pasetti paset.nosp@m.ti@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m

This file is part of the CORDET Framework.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

For information on alternative licensing, please contact P&P Software GmbH.

Definition in file CrFwInStreamTestCases.c.

Function Documentation

◆ CrFwInStreamTestCase1()

CrFwBool_t CrFwInStreamTestCase1 ( )

Test the initialization and packet queue (PQ) management of the InStream.

The following actions are performed in this test:

  • Attempt to instantiate an InStream with an illegal identifier and check that the operation fails.
  • Instantiate one InStream twice and check that the same instance is returned on both occasions.
  • Check that the InStream State Machine is correctly configured.
  • Initialize and reset the InStream and check that the component enters state CONFIGURED
  • Configure the Packet Available Check Operation to return "no packet available" and check that, at instantiation, the InStream enters state WAITING
  • Check the function to get an InStream as a function of the packet source
Verifies:

Application Error: crInStreamIllId

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

InStream SM Transition: IPS->WAITING

Initialization Procedure: Initialization Action Successful

Initialization Procedure: Initialization Check Successful

Reset Procedure: Configuration Action Successful

Reset Procedure: Configuration Check Successful

Returns
true if the test was successful, false otherwise.

Definition at line 42 of file CrFwInStreamTestCases.c.

◆ CrFwInStreamTestCase2()

CrFwBool_t CrFwInStreamTestCase2 ( )

Test the collection of packets from an InStream.

This test must be executed as a follow-on to CrFwInStreamTestCase1. The following actions are performed in this test:

  • It is verified that the first InStream is in state CONFIGURED and WAITING.
  • The PACKET_AVAILABLE command is sent to the InStream and it is verified that the InStream remains in state WAITING
  • The GET_PCKT command is sent to the InStream and it is verified that it returns NULL
  • The stub functions are set up to simulate a situation where two packets have arrived.
  • The PACKET_AVAILABLE command is sent to the InStream and it is verified that a transition is made to PCKT_AVAIL.
  • The GET_PCKT command is sent to the InStream and it is verified that a packet is returned and the InStream remains in PCKT_AVAIL.
  • The GET_PCKT command is sent to the InStream and it is verified that a packet is returned and the InStream moves to WAITING.
Verifies:

InStream SM Transition: WAITING->WAITING (through CPS)

InStream SM Transition: WAITING->PCKT_AVAIL (through CPS)

InStream SM Transition: PCKT_AVAIL->PCKT_AVAIL (through CPS)

InStream SM Transition: PCKT_AVAIL->WAITING

Packet Collect Procedure: MW is in state WAITING and loop is not entered

Packet Collect Procedure: Flag_1 is true; PQ is not full; MW is in state PCKT_AVAIL

Packet Collect Procedure: Flag_1 is true; PQ is not full; MW is not in state PCKT_AVAIL

Returns
true if the test was successful, false otherwise.

Definition at line 142 of file CrFwInStreamTestCases.c.

◆ CrFwInStreamTestCase3()

CrFwBool_t CrFwInStreamTestCase3 ( )

Test the self-transition on state PCKT_AVAIL and the shutdown of an InStream.

This test must be executed as a follow-on to CrFwInStreamTestCase2. The following actions are performed in this test:

  • It is verified that the first InStream is in state CONFIGURED and WAITING.
  • The stub functions are set up to simulate a situation where one packet has arrived.
  • The PACKET_AVAILABLE command is sent to the InStream and it is verified that a transition is made to PCKT_AVAIL.
  • The stub functions are set up to simulate a situation where one more packet has arrived.
  • The PACKET_AVAILABLE command is sent again to the InStream and it is verified that the InStream remains in PCKT_AVAIL and that its packet queue contains two items.
  • The InStream is shutdown and it is verified that its packet queue and its sequence counter are reset.
Verifies:

InStream SM Transition: WAITING->PCKT_AVAIL

InStream SM Transition: PCKT_AVAIL->PCKT_AVAIL (self-transition)

Base SM Transition: CONFIGURED->FPS

Packet Collect Procedure: Flag_1 is true; PQ is not full; MW is in state PCKT_AVAIL

Packet Collect Procedure: Flag_1 is true; PQ is not full; MW is not in state PCKT_AVAIL

Returns
true if the test was successful, false otherwise.

Definition at line 226 of file CrFwInStreamTestCases.c.

◆ CrFwInStreamTestCase4()

CrFwBool_t CrFwInStreamTestCase4 ( )

Test the error reporting functionalities of an InStream.

This test must be executed as a follow-on to CrFwInStreamTestCase3. The following actions are performed in this test:

  • The first InStream is obtained from its factory method and it is started and configured.
  • It is verified that the first InStream is in state CONFIGURED and WAITING.
  • The stub functions are set up to simulate a situation where one packet has arrived and the packet's destination is the host application (i.e. the packet is not being re-routed).
  • The PACKET_AVAILABLE command is sent to the InStream and it is verified that a transition is made to PCKT_AVAIL.
  • The stub functions are set up to simulate a situation where one more packet for the host application has arrived and where the sequence counter of the packet is wrong.
  • The PACKET_AVAILABLE command is sent again to the InStream and it is verified that the InStream remains in PCKT_AVAIL, that its packet queue contains two items and that a "sequence counter error" is generated.
  • The stub functions are set up to simulate a situation where one in transit packet has arrived and where the sequence counter of the packet is wrong.
  • The PACKET_AVAILABLE command is sent again to the InStream and it is verified that the InStream remains in PCKT_AVAIL, that its packet queue contains three items and that no "sequence counter error" is generated.
  • The stub functions are set up to simulate a situation where N packets for the host application have arrived (with N being one greater than the packet queue size) which have incorrect sequence counters.
  • The PACKET_AVAILABLE command is sent again to the InStream and it is verified that the InStream remains in PCKT_AVAIL, that its packet queue is full, and that a "packet queue full error" is generated.
Verifies:

Error Report: crInStreamPQFull

Error Report: crInStreamSCErr

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

InStream SM Transition: IPS->WAITING

InStream SM Transition: WAITING->PCKT_AVAIL

InStream SM Transition: PCKT_AVAIL->PCKT_AVAIL (self-transition)

Base SM Transition: CONFIGURED->CONFIGURED

Packet Collect Procedure: Flag_1 is false

Packet Collect Procedure: PQ is full

Returns
true if the test was successful, false otherwise.

Definition at line 287 of file CrFwInStreamTestCases.c.

◆ CrFwInStreamTestCase5()

CrFwBool_t CrFwInStreamTestCase5 ( )

Test the InStream with checks and actions which may be configured to succeed or fail.

The following actions are performed in this test:

  • Verify that the function to get the source associated to an InStream is correctly implemented
  • Verify that initialization of an InStream only succeeds when both the initialization check and the initialization action succeed.
  • Verify that configuration of an InStream only succeeds when both the configuration check and the configuration action succeed.
  • Verify that a reset of a configured InStream fails if the configuration check fails.

After this test has run, the second InStream component may no longer be usable.

Verifies:

Application Error: crNotInStream

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->INITIALIZED

Initialization Procedure: Initialization Action Successful

Initialization Procedure: Initialization Check Successful

Initialization Procedure: Initialization Action Failed

Initialization Procedure: Initialization Check Failed

Reset Procedure: Configuration Action Successful

Reset Procedure: Configuration Action Failed

Reset Procedure: Configuration Check Successful

Reset Procedure: Configuration Check Failed

Returns
true if the test was successful, false otherwise.

Definition at line 446 of file CrFwInStreamTestCases.c.

◆ CrFwInStreamTestCase6()

CrFwBool_t CrFwInStreamTestCase6 ( )

Test the function to override the Shutdown Operation of an InStream and to verify entry into PCKT_AVAIL at start-up.

The following actions are performed in this test:

  • The stub functions are set up to simulate a situation where one packet has arrived.
  • Bring the second InStream to its CONFIGURED state and check that it is in state PCKT_AVAIL
  • Shut down the InStream and check that the Shutdown Operation is executed.
Verifies:

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->FPS

InStream SM Transition: IPS->PCKT_AVAIL

Returns
true if the test was successful, false otherwise.

Definition at line 538 of file CrFwInStreamTestCases.c.

◆ CrFwInStreamTestCase7()

CrFwBool_t CrFwInStreamTestCase7 ( )

Test the management of groups by the InStream.

This test assumes that the third InStream has been configured (in CrFwInStreamUserPar.h to have two groups. The following actions are performed in this test:

  • The third InStream is obtained from its factory method and it is started and configured.
  • The stub functions are set up to simulate a situation where three packets belonging to the first and second group have arrived.
  • The PACKET_AVAILABLE command is sent to the InStream and it is verified that a transition is made to PCKT_AVAIL.
  • The GET_PCKT command is sent three times to the InStream and it is verified that the three packets are returned, that the InStream remains in PCKT_AVAIL, and that the sequence counters are correctly incremented.
  • The stub functions are set up to simulate a situation where three packets have arrived of which one belongs to a non-existent group.
  • The PACKET_AVAILABLE command is sent to the InStream and it is verified that a transition is made to PCKT_AVAIL.
  • The GET_PCKT command is sent three times to the InStream and it is verified that the three packets are returned, that the InStream remains in PCKT_AVAIL, that the sequence counters are correctly incremented, and that an error report is triggered by the packet with the incorrect group.
Verifies:

InStream SM Transition: WAITING->PCKT_AVAIL

InStream SM Transition: PCKT_AVAIL->PCKT_AVAIL (through CPS)

InStream SM Transition: PCKT_AVAIL->WAITING

Packet Collect Procedure: Flag_1 is true; PQ is not full; MW is in state PCKT_AVAIL

Packet Collect Procedure: Flag_1 is true; PQ is not full; MW is not in state PCKT_AVAIL

Error Report: crInStreamIllGroup

Returns
true if the test was successful, false otherwise.

Definition at line 582 of file CrFwInStreamTestCases.c.

P&P Software GmbH, Copyright 2012-2013, All Rights Reserved