genericopenlibs/openenvcore/libc/test/testifioctls/src/tifioctls.cpp
changeset 0 e4d67989cc36
child 64 c44f36bb61a3
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 "tifioctls.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 CTestIfioctls::~CTestIfioctls() 
       
    29 	{ 
       
    30 	}  
       
    31 
       
    32 CTestIfioctls::CTestIfioctls(const TDesC& aStepName)
       
    33 	{
       
    34 	// MANDATORY Call to base class method to set up the human readable name for logging.
       
    35 	SetTestStepName(aStepName);		
       
    36 	}
       
    37 
       
    38 TVerdict CTestIfioctls::doTestStepPreambleL()
       
    39 	{
       
    40 	__UHEAP_MARK;	
       
    41 	SetTestStepResult(EPass);
       
    42 	return TestStepResult();
       
    43 	}
       
    44 
       
    45 
       
    46 
       
    47 TVerdict CTestIfioctls::doTestStepPostambleL()
       
    48 	{
       
    49 	__UHEAP_MARKEND;	
       
    50 	return TestStepResult();
       
    51 	}
       
    52 
       
    53 
       
    54 TVerdict CTestIfioctls::doTestStepL()
       
    55 	{
       
    56 		int err;
       
    57 
       
    58    		if(TestStepName() == KExampleL)
       
    59    			{
       
    60    	   		INFO_PRINTF1(_L("ExampleL():"));
       
    61    	   		err = ExampleL();
       
    62    	   		SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    63    	   		}
       
    64    	   	else if(TestStepName() == KListInterfaces)
       
    65    				{
       
    66    	   			INFO_PRINTF1(_L("ListInterfaces():"));
       
    67    	   			err = ListInterfaces();
       
    68    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    69    	   			}
       
    70    	   	else if(TestStepName() == KCreateManyActiveInterfaces)
       
    71    				{
       
    72    	   			INFO_PRINTF1(_L("CreateManyActiveInterfaces():"));
       
    73    	   			err = CreateManyActiveInterfaces();
       
    74    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    75    	   			}
       
    76    	   	else if(TestStepName() == KChooseInterface)
       
    77    				{
       
    78    	   			INFO_PRINTF1(_L("ChooseInterface():"));
       
    79    	   			err = ChooseInterface();
       
    80    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    81    	   			}
       
    82    	   	else if(TestStepName() == KChooseActiveInterface)
       
    83    				{
       
    84    	   			INFO_PRINTF1(_L("ChooseActiveInterface():"));
       
    85    	   			err = ChooseActiveInterface();
       
    86    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    87    	   			}
       
    88    	   	else if(TestStepName() == KTestIfNameIndex)
       
    89    				{
       
    90    	   			INFO_PRINTF1(_L("TestIfNameIndex():"));
       
    91    	   			err = TestIfNameIndex();
       
    92    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    93    	   			}
       
    94    	   	else if(TestStepName() == KTestIfIndexToName)
       
    95    				{
       
    96    	   			INFO_PRINTF1(_L("TestIfIndexToName():"));
       
    97    	   			err = TestIfIndexToName();
       
    98    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    99    	   			}
       
   100    	   	else if(TestStepName() == KTestIfNameToIndex)
       
   101    				{
       
   102    	   			INFO_PRINTF1(_L("TestIfNameToIndex():"));
       
   103    	   			err = TestIfNameToIndex();
       
   104    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   105    	   			}
       
   106    	   	else if(TestStepName() == KTestSiocGIfIndex)
       
   107    				{
       
   108    	   			INFO_PRINTF1(_L("TestSiocGIfIndex():"));
       
   109    	   			err = TestSiocGIfIndex();
       
   110    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   111    	   			}
       
   112    	   	else if(TestStepName() == KConnectToIpUsingConnection)
       
   113    				{
       
   114    	   			INFO_PRINTF1(_L("ConnectToIpUsingConnection():"));
       
   115    	   			err = ConnectToIpUsingConnection();
       
   116    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   117    	   			}
       
   118    	   	else  if(TestStepName() == KSendtoIpUsingConnection )
       
   119    				{
       
   120    	   			INFO_PRINTF1(_L("SendtoIpUsingConnection():"));
       
   121    	   			err = SendtoIpUsingConnection();
       
   122    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   123    	   			}
       
   124    	   	else if(TestStepName() == KConnectToUrlUsingConnection )
       
   125    				{
       
   126    	   			INFO_PRINTF1(_L("ConnectToUrlUsingConnection():"));
       
   127    	   			err = ConnectToUrlUsingConnection();
       
   128    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   129    	   			}
       
   130    	   	else if(TestStepName() == Kioctltest)
       
   131    				{
       
   132    	   			INFO_PRINTF1(_L("ioctltest():"));
       
   133    	   			err = ioctltest();
       
   134    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   135    	   			}
       
   136    	   	else if(TestStepName() == Kreadtest)
       
   137    				{
       
   138    	   			INFO_PRINTF1(_L("readtest():"));
       
   139    	   			err = readtest();
       
   140    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   141    	   			}
       
   142    	   	else if(TestStepName() == KTestAddDelRoute)
       
   143    				{
       
   144    	   			INFO_PRINTF1(_L("TestAddDelRoute():"));
       
   145    	   			err = TestAddDelRoute();
       
   146    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   147    	   			}
       
   148    	   	else if(TestStepName() == KTestAddDelRouteNegative1)
       
   149    				{
       
   150    	   			INFO_PRINTF1(_L("TestAddDelRouteNegative1():"));
       
   151    	   			err = TestAddDelRouteNegative1();
       
   152    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   153    	   			}
       
   154    	   	else if(TestStepName() == KTestAddDelRouteNegative2)
       
   155    				{
       
   156    	   			INFO_PRINTF1(_L("TestAddDelRouteNegative2():"));
       
   157    	   			err = TestAddDelRouteNegative2();
       
   158    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   159    	   			}
       
   160    	   	else if(TestStepName() == KTestMacAddress)
       
   161    				{
       
   162    	   			INFO_PRINTF1(_L("TestMacAddress():"));
       
   163    	   			err = TestMacAddress();
       
   164    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   165    	   			}
       
   166    	   	else if(TestStepName() == KTestMacAddressNegative1)
       
   167    				{
       
   168    	   			INFO_PRINTF1(_L("TestMacAddressNegative1():"));
       
   169    	   			err = TestMacAddressNegative1();
       
   170    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   171    				}
       
   172    		else if(TestStepName() == KTestioctlfile )
       
   173    				{
       
   174    	   			INFO_PRINTF1(_L("Testioctlfile():"));
       
   175    	   			err = Testioctlfile();
       
   176    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   177    	   			}  
       
   178    	   	else if(TestStepName() == KTestioctl1)
       
   179    				{
       
   180    	   			INFO_PRINTF1(_L("Testioctl1():"));
       
   181    	   			err = Testioctl1();
       
   182    	   			SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   183    	   			}	
       
   184    	   	return TestStepResult(); 
       
   185 
       
   186 	}
       
   187  
       
   188