//
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//
//! @file
//! @SYMTestSuiteName		pbase-f32-sfsrv-publicapi-ram
//! @SYMScriptTestEnvironment	This test script requires a basic ROM.
//! @SYMScriptAuthor 		Dmitri Trofimov, Jaanus Randveer
//! @SYMCreationDate		12/10/2007
//! @SYMScriptDescription	The test script contains API tests for the following functions of TEntryArray class:
//! TEntryArray();
//! TInt Count() const;
//! const TEntry &operator[](TInt anIndex) const;

LOAD_SUITE	T_SfSrv
//DELAY		5000


START_TESTCASE 			PBASE-F32-EntryArray-PublicApi-0001
//! @SYMTestCaseID		PBASE-F32-EntryArray-PublicApi-0001
//! @SYMAPI			TEntryArray
//! @SYMCreationDate		08/12/2006 
//! @SYMTestCaseDesc		TEntryArray() test. Tests for successful object creation.
//!				Uses API elements: TEntryArray()
//! @SYMTestActions		1. Create TEntryArray object.
//!
//! @SYMTestStatus		Implemented
//! @SYMTestPriority		Critical
//! @SYMTestExpectedResults	Function does not leave nor panic.
//! @SYMTestType		CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini
		CREATE_OBJECT	TEntryArray	TEntryArray1	
		COMMAND		TEntryArray1	new		
		COMMAND		TEntryArray1	~		
	END_TEST_BLOCK
END_TESTCASE			PBASE-F32-EntryArray-PublicApi-0001


START_TESTCASE 			PBASE-F32-EntryArray-PublicApi-0002
//! @SYMTestCaseID		PBASE-F32-EntryArray-PublicApi-0002
//! @SYMAPI			TEntryArray
//! @SYMTestCaseDesc		Count() test. Tests if Count() returns correct number of entries.
//!				Uses API elements: TEntryArray(), Count()
//! @SYMTestActions		1. Create RFs object.
//!				2. Create RDir object.
//!				3. Create RFile object.
//!				4. Create TEntryArray object.
//!				5. Call Rfs::Connect().
//!				6. Creates files "test1.txt", "test2.txt" and "test3.txt" using RFile::Create().
//!				7. Close files "test1.txt", "test2.txt" and "test3.txt" using RFile::Close(). 
//!				8. Open the contents of directory "<RAM_DRIVE>:\EntryArray\" using RDir::Open().
//!				9. Read the contents of directory "<RAM_DRIVE>:\EntryArray\" using RDir::Read() and passing TEntryArray object as parameter.
//!				10.Call RFs::Close() for closing "<RAM_DRIVE>:\EntryArray\" directory.
//!				11.Call TEntryArray::Count().
//!				12.Delete files "test1.txt", "test2.txt" and "test3.txt" using RFs::Delete().
//!
//! @SYMTestStatus		Implemented
//! @SYMTestPriority		Critical
//! @SYMTestExpectedResults	Count() returns the number of files in the test directory.
//! @SYMTestType		CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini 
		CREATE_OBJECT		RFs		RFs1
		COMMAND			RFs1		new			
		COMMAND			RFs1		Connect
		COMMAND			RFs1		MkDirAll		PBASE-F32-EntryArray-PublicApi-0002-001-MkDirAll_command004
		COMMAND			RFs1		~
	END_TEST_BLOCK	
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini
		CREATE_OBJECT		RFs		RFs1
		CREATE_OBJECT		RDir		RDir1
		CREATE_OBJECT		RFile		RFile1
		CREATE_OBJECT		TEntryArray	TEntryArray1	
		COMMAND			RFs1		new			
		COMMAND			RFile1		new					
		COMMAND			RDir1		new		
		COMMAND			TEntryArray1	new		
		COMMAND			RFs1		Connect
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0002-002-CreateFile_command010
		COMMAND			RFile1		Close
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0002-002-CreateFile_command012
		COMMAND			RFile1		Close
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0002-002-CreateFile_command014
		COMMAND			RFile1		Close
		COMMAND			RDir1		Open		PBASE-F32-EntryArray-PublicApi-0002-002-OpenDir_command016
		COMMAND	!Error=-25	RDir1		Read		PBASE-F32-EntryArray-PublicApi-0002-002-Read_command017
		COMMAND			RDir1		Close
		COMMAND			TEntryArray1	count		PBASE-F32-EntryArray-PublicApi-0002-002-Count_command019
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0002-002-DeleteFile_command020
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0002-002-DeleteFile_command021
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0002-002-DeleteFile_command022
		COMMAND			TEntryArray1	~		
		COMMAND			RFile1		~
		COMMAND			RDir1		~	
		COMMAND			RFs1		~			
	END_TEST_BLOCK
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini 
		CREATE_OBJECT		RFs		RFs1
		COMMAND			RFs1		new			
		COMMAND			RFs1		Connect
		COMMAND			RFs1		RmDir		PBASE-F32-EntryArray-PublicApi-0002-003-RmDir_command004
		COMMAND			RFs1		~
	END_TEST_BLOCK
END_TESTCASE			PBASE-F32-EntryArray-PublicApi-0002


START_TESTCASE 			PBASE-F32-EntryArray-PublicApi-0003
//! @SYMTestCaseID		PBASE-F32-EntryArray-PublicApi-0003
//! @SYMAPI			TEntryArray
//! @SYMTestCaseDesc		operator[] test. This tests successful accessing all of the elements in the array.
//!				Uses API elements: TEntry(), TEntryArray(), operator[]
//! @SYMTestActions		1. Create RFs object.
//!				2. Create RDir object.
//!				3. Create RFile object.
//!				4. Create TEntry object.
//!				5. Create TEntry temp object.
//!				6. Create TEntryArray object.
//!				7. Call Rfs::Connect(). 
//!				8. Creates files "test1.txt", "test2.txt" and "test3.txt" using RFile::Create().
//!				9. Close files "test1.txt", "test2.txt" and "test3.txt" using RFile::Close(). 
//!				10.Open the contents of directory "<RAM_DRIVE>:\EntryArray\" using RDir::Open().
//!				11.Read the contents of directory "<RAM_DRIVE>:\EntryArray\" using RDir::Read() and passing TEntryArray object as parameter.
//!				12.Call RFs::Close() for closing "<RAM_DRIVE>:\EntryArray\" directory.
//!				13.Call TEntryArray::Operatorp[] and pass index "0" as parameter.
//!				14.Assign TEntry object to temp TEntry  and check that the element temp TEntry has a name "Test1.txt"
//!				15.Call TEntryArray::Operator[] and pass index "1" as parameter.
//!				16.Assign TEntry object to temp TEntry  and check that the element temp TEntry has a name "Test2.txt"
//!				17.Call TEntryArray::Operator[] and pass index "2" as parameter.
//!				18.Assign TEntry object to temp TEntry  and check that the element temp TEntry has a name "Test3.txt"
//!				19.Delete files "test1.txt", "test2.txt" and "test3.txt" using RFs::Delete().
//!
//! @SYMTestStatus		Implemented
//! @SYMTestPriority		Critical
//! @SYMTestExpectedResults	Function does not leave nor panic.
//! @SYMTestType		CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini 
		CREATE_OBJECT		RFs		RFs1
		COMMAND			RFs1		new			
		COMMAND			RFs1		Connect
		COMMAND			RFs1		MkDirAll		PBASE-F32-EntryArray-PublicApi-0003-001-MkDirAll_command004
		COMMAND			RFs1		~
	END_TEST_BLOCK	
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini
		CREATE_OBJECT		RFs		RFs1
		CREATE_OBJECT		RDir		RDir1
		CREATE_OBJECT		RFile		RFile1
		CREATE_OBJECT		TEntry		TEntry1
		CREATE_OBJECT		TEntry		TEntryTemp
		CREATE_OBJECT		TEntryArray	TEntryArray1			
		COMMAND			RFs1		new			
		COMMAND			RFile1		new					
		COMMAND			RDir1		new		
		COMMAND			TEntry1		new
		COMMAND			TEntryTemp	new
		COMMAND			TEntryArray1	new			
		COMMAND			RFs1		Connect
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0003-002-CreateFile_command014
		COMMAND			RFile1		Close
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0003-002-CreateFile_command016
		COMMAND			RFile1		Close
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0003-002-CreateFile_command018
		COMMAND			RFile1		Close
		COMMAND			RDir1		Open		PBASE-F32-EntryArray-PublicApi-0003-002-OpenDir_command020
		COMMAND	!Error=-25	RDir1		Read		PBASE-F32-EntryArray-PublicApi-0003-002-Read_command021
		COMMAND			RDir1		Close
		COMMAND			TEntryArray1	[]		PBASE-F32-EntryArray-PublicApi-0003-002-brackets_command023
		COMMAND			TEntryTemp	=		PBASE-F32-EntryArray-PublicApi-0003-002-equal_command024
		COMMAND			TEntryArray1	[]		PBASE-F32-EntryArray-PublicApi-0003-002-brackets_command025
		COMMAND			TEntryTemp	=		PBASE-F32-EntryArray-PublicApi-0003-002-equal_command026
		COMMAND			TEntryArray1	[]		PBASE-F32-EntryArray-PublicApi-0003-002-brackets_command027
		COMMAND			TEntryTemp	=		PBASE-F32-EntryArray-PublicApi-0003-002-equal_command028
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0003-002-DeleteFile_command029
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0003-002-DeleteFile_command030
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0003-002-DeleteFile_command031
		COMMAND			TEntryArray1	~
		COMMAND			TEntryTemp	~			
		COMMAND			TEntry1		~		
		COMMAND			RFile1		~		
		COMMAND			RDir1		~		
		COMMAND			RFs1		~			
	END_TEST_BLOCK
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini 
		CREATE_OBJECT		RFs		RFs1
		COMMAND			RFs1		new			
		COMMAND			RFs1		Connect
		COMMAND			RFs1		RmDir		PBASE-F32-EntryArray-PublicApi-0003-003-RmDir_command004
		COMMAND			RFs1		~
	END_TEST_BLOCK
END_TESTCASE			PBASE-F32-EntryArray-PublicApi-0003


START_TESTCASE 			PBASE-F32-EntryArray-PublicApi-0004
//! @SYMTestCaseID		PBASE-F32-EntryArray-PublicApi-0004
//! @SYMAPI			TEntryArray
//! @SYMTestCaseDesc		operator[] test. This tests for panic when accessing non-existant array element.
//!				Uses API elements: TEntry(), TEntryArray(), operator[]
//! @SYMTestActions		1. Create RFs object.
//!				2. Create RDir object.
//!				3. Create RFile object.
//!				4. Create TEntry object.
//!				5. Create TEntryArray object.
//!				6. Call Rfs::Connect().
//!				7. Creates files "test1.txt", "test2.txt" and "test3.txt" using RFile::Create().
//!				8. Close files "test1.txt", "test2.txt" and "test3.txt" using RFile::Close(). 
//!				9. Open the contents of directory "<RAM_DRIVE>:\EntryArray\" using RDir::Open().
//!				10.Read the contents of directory "<RAM_DRIVE>:\EntryArray\" using RDir::Read() and passing TEntryArray object as parameter.
//!				11.Call RFs::Close() for closing "<RAM_DRIVE>:\EntryArray\" directory.
//!				12.Assign an element of TEntryArray with index 3 to TEntry.
//!				13.Delete files "test1.txt", "test2.txt" and "test3.txt" using RFs::Delete().
//!
//! @SYMTestStatus		Implemented
//! @SYMTestPriority		Critical
//! @SYMTestExpectedResults	Function panics with panic code FSCLIENT 22.
//! @SYMTestType		CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini 
		CREATE_OBJECT		RFs		RFs1
		COMMAND			RFs1		new			
		COMMAND			RFs1		Connect
		COMMAND			RFs1		MkDirAll		PBASE-F32-EntryArray-PublicApi-0004-001-MkDirAll_command004
		COMMAND			RFs1		~
	END_TEST_BLOCK	
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini
		CREATE_OBJECT		RFs		RFs1
		CREATE_OBJECT		RDir		RDir1
		CREATE_OBJECT		RFile		RFile1
		CREATE_OBJECT		TEntry		TEntry1	
		CREATE_OBJECT		TEntryArray	TEntryArray1
		COMMAND			RFs1		new			
		COMMAND			RFile1		new					
		COMMAND			RDir1		new		
		COMMAND			TEntry1		new		
		COMMAND			TEntryArray1	new				
		COMMAND			RFs1		Connect
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0004-002-CreateFile_command012
		COMMAND			RFile1		Close
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0004-002-CreateFile_command014
		COMMAND			RFile1		Close
		COMMAND			RFile1		Create		PBASE-F32-EntryArray-PublicApi-0004-002-CreateFile_command016
		COMMAND			RFile1		Close
		COMMAND			RDir1		Open		PBASE-F32-EntryArray-PublicApi-0004-002-OpenDir_command018
		COMMAND	!Error=-25	RDir1		Read		PBASE-F32-EntryArray-PublicApi-0004-002-Read_command019
		COMMAND			RDir1		Close
		COMMAND			TEntryArray1	[]		PBASE-F32-EntryArray-PublicApi-0004-002-brackets_command021
		COMMAND			TEntryArray1	~		
		COMMAND			TEntry1		~		
		COMMAND			RFile1		~		
		COMMAND			RDir1		~		
		COMMAND			RFs1		~				
	END_TEST_BLOCK	!PanicCode=22 !PanicString="FSCLIENT panic"
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-EntryArray-PublicApi.ini
		CREATE_OBJECT		RFs		RFs1
		COMMAND			RFs1		new			
		COMMAND			RFs1		Connect			
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0004-003-DeleteFile_command004
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0004-003-DeleteFile_command005
		COMMAND			RFs1		Delete		PBASE-F32-EntryArray-PublicApi-0004-003-DeleteFile_command006
		COMMAND			RFs1		RmDir		PBASE-F32-EntryArray-PublicApi-0004-003-RmDir_command007
		COMMAND			RFs1		~			
	END_TEST_BLOCK	
END_TESTCASE			PBASE-F32-EntryArray-PublicApi-0004
