genericopenlibs/openenvcore/libc/test/testlink/src/tlink.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "tlink.h"
       
    21 #include <unistd.h> 
       
    22 #include <errno.h>
       
    23 #include <stdio.h>
       
    24 #include <e32std.h>
       
    25 #include <stdlib.h>
       
    26 #include <string.h>
       
    27 
       
    28 
       
    29 CTestLink::~CTestLink() 
       
    30 	{ 
       
    31 	}  
       
    32 
       
    33 CTestLink::CTestLink(const TDesC& aStepName)
       
    34 	{
       
    35 	// MANDATORY Call to base class method to set up the human readable name for logging.
       
    36 	SetTestStepName(aStepName);		
       
    37 	}
       
    38 
       
    39 TVerdict CTestLink::doTestStepPreambleL()
       
    40 	{
       
    41 	__UHEAP_MARK;	
       
    42 	iParamCnt=0;
       
    43 	SetTestStepResult(EPass);
       
    44 	return TestStepResult();
       
    45 	}
       
    46 
       
    47 
       
    48 
       
    49 TVerdict CTestLink::doTestStepPostambleL()
       
    50 	{
       
    51 	__UHEAP_MARKEND;	
       
    52 	return TestStepResult();
       
    53 	}
       
    54 
       
    55 
       
    56 TVerdict CTestLink::doTestStepL()
       
    57 	{
       
    58 	int err;
       
    59 
       
    60    	if(TestStepName() == KLink)
       
    61    		{
       
    62    		INFO_PRINTF1(_L("Link():"));
       
    63    		err = Link();
       
    64    		SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    65    		}
       
    66    	else
       
    67    		if(TestStepName() == KLink1)
       
    68    		{
       
    69    		INFO_PRINTF1(_L("Link1():"));
       
    70    		err = Link1();
       
    71    		SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    72    		}
       
    73    	else
       
    74    		if(TestStepName() == KLink2)
       
    75    		{
       
    76    	   	INFO_PRINTF1(_L("Link2():"));
       
    77    	   	err = Link2();
       
    78    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    79    	   	}
       
    80    	else
       
    81    	   	if(TestStepName() == KLink3)
       
    82    		{
       
    83    	   	INFO_PRINTF1(_L("Link3():"));
       
    84    	   	err = Link3();
       
    85    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    86    	   	}
       
    87     else
       
    88    	   	if(TestStepName() == KLink4)
       
    89    		{
       
    90    	   	INFO_PRINTF1(_L("Link4():"));
       
    91    	   	err = Link4();
       
    92    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    93    	   	}
       
    94    	else
       
    95    	   	if(TestStepName() == KLink5)
       
    96    		{
       
    97    	   	INFO_PRINTF1(_L("Link5():"));
       
    98    	   	err = Link5();
       
    99    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   100    	    }
       
   101    	else
       
   102    	   	if(TestStepName() == KLink6)
       
   103    		{
       
   104    	   	INFO_PRINTF1(_L("Link6():"));
       
   105    	   	err = Link6();
       
   106    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   107    	   	}
       
   108    	else
       
   109    	   	if(TestStepName() == KLink7)
       
   110    		{
       
   111    	   	INFO_PRINTF1(_L("Link7():"));
       
   112    	   	err = Link7();
       
   113    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   114    	   	}
       
   115    	else
       
   116    	   	if(TestStepName() == KReadWriteLink)
       
   117    		{
       
   118    	   	INFO_PRINTF1(_L("ReadWriteLink():"));
       
   119    	   	err = ReadWriteLink();
       
   120    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   121    	   	}
       
   122 	else
       
   123    	   	if(TestStepName() == KReadLink)
       
   124    		{
       
   125    	   	INFO_PRINTF1(_L("ReadLink():"));
       
   126    	   	err = ReadLink();
       
   127    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   128    	   	}
       
   129    	else
       
   130    		if(TestStepName() == KReadLink1)
       
   131    		{
       
   132    	   	INFO_PRINTF1(_L("ReadLink1():"));
       
   133    	   	err = ReadLink1();
       
   134    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   135    	   	}
       
   136 	else
       
   137    	   	if(TestStepName() == Klinkstat)
       
   138    		{
       
   139    	   	INFO_PRINTF1(_L("linkstat():"));
       
   140    	   	err = linkstat();
       
   141    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   142    	   	}
       
   143 	else
       
   144    		if(TestStepName() == KUnlink)
       
   145    		{
       
   146    	   	INFO_PRINTF1(_L("Unlink():"));
       
   147    	   	err = Unlink();
       
   148    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   149    	   	}
       
   150    	else
       
   151    		if(TestStepName() == KUnlink1)
       
   152    		{
       
   153    	   	INFO_PRINTF1(_L("Unlink1():"));
       
   154    	   	err = Unlink1();
       
   155    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   156    	   	}
       
   157    	else
       
   158    		if(TestStepName() == KTestUnlinkFifo)
       
   159    		{
       
   160    	   	INFO_PRINTF1(_L("TestUnlinkFifo():"));
       
   161    	   	err = TestUnlinkFifo();
       
   162    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   163    	   	}
       
   164    	else
       
   165    		if(TestStepName() == KReadLinkTest)
       
   166    		{
       
   167    	   	INFO_PRINTF1(_L("ReadLinkTest():"));
       
   168    	   	err = ReadLinkTest();
       
   169    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   170    	   	}
       
   171 	
       
   172 	return TestStepResult(); 
       
   173 
       
   174 	}
       
   175  
       
   176