File: CeCreateDirectory.cpp

package info (click to toggle)
librapi2 0.9.0-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,204 kB
  • ctags: 1,258
  • sloc: sh: 9,013; ansic: 5,743; cpp: 522; makefile: 171
file content (34 lines) | stat: -rw-r--r-- 853 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Test CeCreateDirectory and CeRemoveDirectory
//

#include "test.h"

int main()
{
	VERIFY_HRESULT(CeRapiInit());

	DWORD length;
	WCHAR dirname[MAX_PATH];
	VERIFY_NOT_FALSE(length = CeGetSpecialFolderPath(CSIDL_PERSONAL, MAX_PATH, dirname))
	wstr_append(dirname, to_unicode("\\librapi test directory"), sizeof(dirname));
	
	// First, remove directory (ignoring return value)
	CeRemoveDirectory(dirname);
	
	// Create directroy. This should succeed.
	TEST_NOT_EQUAL(0, CeCreateDirectory(dirname, NULL));
	
	// Create directroy again. This should fail.
	TEST_EQUAL(0, CeCreateDirectory(dirname, NULL));
	
	// Remove directory. This should succeed.
	TEST_NOT_EQUAL(0, CeRemoveDirectory(dirname));
	
	// Remove directory again. This should fail.
	TEST_EQUAL(0, CeRemoveDirectory(dirname));
	
	VERIFY_HRESULT(CeRapiUninit());
	return TEST_SUCCEEDED;
}