datacommsserver/esockserver/test/TE_ESock/EsockTestSection16.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This contains ESock Test cases from section 16
       
    15 // 
       
    16 //
       
    17 
       
    18 // EPOC includes
       
    19 #include <e32base.h>
       
    20 #include <in_sock.h>
       
    21 
       
    22 // Test system includes
       
    23 #include "EsockTestSection16.h"
       
    24 
       
    25 
       
    26 // Test step 16.1
       
    27 const TDesC& CEsockTest16_1::GetTestName()
       
    28 	{
       
    29 	// store the name of this test case
       
    30 	_LIT(ret,"Test16.1");
       
    31 	return ret;
       
    32 	}
       
    33 
       
    34 CEsockTest16_1::~CEsockTest16_1()
       
    35 	{
       
    36 	appendixInArray.Close();
       
    37 	appendixOutArray.Close();
       
    38 	}
       
    39 
       
    40 enum TVerdict CEsockTest16_1::easyTestStepL()
       
    41 	{
       
    42 	//
       
    43 	// NetMask()	   //
       
    44 	//
       
    45 	
       
    46 	TInetAddr addr;
       
    47 	
       
    48 	// Get Valid IPv4 Addresses - appendixInArray
       
    49 	if (!GetAppendixB1())
       
    50 		return EFail;
       
    51 	
       
    52 	// expected result - appendixOutArray
       
    53 	if (!GetAppendixB2())
       
    54 		return EFail;
       
    55 	
       
    56 	for (TInt i = 0;i < appendixInArray.Count();i++)
       
    57 		{
       
    58 		// Get IP subnet mask
       
    59 		addr.NetMask(appendixInArray[i]);
       
    60 		
       
    61 		// Match against expected result
       
    62 		TESTL(addr.Match(appendixOutArray[i]));
       
    63 		}
       
    64 	
       
    65 	appendixInArray.Reset();
       
    66 	appendixOutArray.Reset();
       
    67 	return EPass;
       
    68 	}
       
    69 
       
    70 
       
    71 // Test step 16.2
       
    72 const TDesC& CEsockTest16_2::GetTestName()
       
    73 	{
       
    74 	// store the name of this test case
       
    75 	_LIT(ret,"Test16.2");
       
    76 	return ret;
       
    77 	}
       
    78 
       
    79 CEsockTest16_2::~CEsockTest16_2()
       
    80 	{
       
    81 	appendixInArray.Close();
       
    82 	appendixOutArray.Close();
       
    83 	}
       
    84 
       
    85 enum TVerdict CEsockTest16_2::easyTestStepL()
       
    86 	{
       
    87 	//
       
    88 	// Net()       //
       
    89 	//
       
    90 	
       
    91 	TInetAddr addr;
       
    92 	
       
    93 	// Get Valid IPv4 Addresses - appendixInArray
       
    94 	if (!GetAppendixB1())
       
    95 		return EFail;
       
    96 	
       
    97 	// expected result - appendixOutArray
       
    98 	if (!GetAppendixB3())
       
    99 		return EFail;
       
   100 	
       
   101 	for (TInt i = 0;i < appendixInArray.Count();i++)
       
   102 		{
       
   103 		// Get IP net
       
   104 		addr.Net(appendixInArray[i]);
       
   105 		
       
   106 		// Match against expected result
       
   107 		TESTL(addr.Match(appendixOutArray[i]));
       
   108 		}
       
   109 
       
   110 	appendixInArray.Reset();
       
   111 	appendixOutArray.Reset();
       
   112 	return EPass;
       
   113 	}
       
   114 
       
   115 
       
   116 // Test step 16.3
       
   117 const TDesC& CEsockTest16_3::GetTestName()
       
   118 	{
       
   119 	// store the name of this test case
       
   120 	_LIT(ret,"Test16.3");
       
   121 	return ret;
       
   122 	}
       
   123 
       
   124 CEsockTest16_3::~CEsockTest16_3()
       
   125 	{
       
   126 	appendixInArray.Close();
       
   127 	appendixOutArray.Close();
       
   128 	}
       
   129 
       
   130 enum TVerdict CEsockTest16_3::easyTestStepL()
       
   131 	{
       
   132 	//
       
   133 	// SubNet()       //
       
   134 	//
       
   135 	TInetAddr addr, mask;
       
   136 	
       
   137 	mask.SetAddress(IPADDR(255,255,255,0));
       
   138 	
       
   139 	// Get Valid IPv4 Addresses - appendixInArray
       
   140 	if (!GetAppendixB1())
       
   141 		return EFail;
       
   142 	
       
   143 	// expected result - appendixOutArray
       
   144 	if (!GetAppendixB4())
       
   145 		return EFail;
       
   146 	
       
   147 	for (TInt i = 0;i < appendixInArray.Count();i++)
       
   148 		{
       
   149 		// Get IP Subnet
       
   150 		addr.SubNet(appendixInArray[i], mask);
       
   151 		
       
   152 		// Match against expected result
       
   153 		TESTL(addr.Match(appendixOutArray[i]));
       
   154 		}
       
   155 
       
   156 	appendixInArray.Reset();
       
   157 	appendixOutArray.Reset();
       
   158 	return EPass;
       
   159 	}
       
   160 
       
   161 
       
   162 // Test step 16.4
       
   163 const TDesC& CEsockTest16_4::GetTestName()
       
   164 	{
       
   165 	// store the name of this test case
       
   166 	_LIT(ret,"Test16.4");
       
   167 	return ret;
       
   168 	}
       
   169 
       
   170 CEsockTest16_4::~CEsockTest16_4()
       
   171 	{
       
   172 	appendixInArray.Close();
       
   173 	appendixOutArray.Close();
       
   174 	}
       
   175 
       
   176 enum TVerdict CEsockTest16_4::easyTestStepL()
       
   177 	{
       
   178 	//
       
   179 	// NetBroadcast()       //
       
   180 	//
       
   181 	
       
   182 	TInetAddr addr;
       
   183 	
       
   184 	// Get Valid IPv4 Addresses - appendixInArray
       
   185 	if (!GetAppendixB1())
       
   186 		return EFail;
       
   187 	
       
   188 	// expected result - appendixOutArray
       
   189 	if (!GetAppendixB5())
       
   190 		return EFail;
       
   191 	
       
   192 	for (TInt i = 0;i < appendixInArray.Count();i++)
       
   193 		{
       
   194 		// Get IP netbroadcast
       
   195 		addr.NetBroadcast(appendixInArray[i]);
       
   196 		
       
   197 		// Match against expected result
       
   198 		TESTL(addr.Match(appendixOutArray[i]));
       
   199 		}
       
   200 
       
   201 	appendixInArray.Reset();
       
   202 	appendixOutArray.Reset();
       
   203 	return EPass;
       
   204 	}
       
   205 
       
   206 
       
   207 // Test step 16.5
       
   208 const TDesC& CEsockTest16_5::GetTestName()
       
   209 	{
       
   210 	// store the name of this test case
       
   211 	_LIT(ret,"Test16.5");
       
   212 	return ret;
       
   213 	}
       
   214 
       
   215 CEsockTest16_5::~CEsockTest16_5()
       
   216 	{
       
   217 	appendixInArray.Close();
       
   218 	appendixOutArray.Close();
       
   219 	}
       
   220 
       
   221 enum TVerdict CEsockTest16_5::easyTestStepL()
       
   222 	{
       
   223 	//
       
   224 	// SubNetBroadcast()       //
       
   225 	//
       
   226 	
       
   227 	TInetAddr addr, mask;
       
   228 	
       
   229 	mask.SetAddress(IPADDR(255,255,255,0));
       
   230 	
       
   231 	// Get Valid IPv4 Addresses - appendixInArray
       
   232 	if (!GetAppendixB1())
       
   233 		return EFail;
       
   234 	
       
   235 	// expected result - appendixOutArray
       
   236 	if (!GetAppendixB6())
       
   237 		return EFail;
       
   238 	
       
   239 	for (TInt i = 0;i < appendixInArray.Count();i++)
       
   240 		{
       
   241 		// Get IP subnetbroadcast
       
   242 		addr.SubNetBroadcast(appendixInArray[i], mask);
       
   243 		
       
   244 		// Match against expected result
       
   245 		TESTL(addr.Match(appendixOutArray[i]));
       
   246 		}
       
   247 
       
   248 	appendixInArray.Reset();
       
   249 	appendixOutArray.Reset();
       
   250 	return EPass;
       
   251 	}
       
   252