~ubuntu-branches/ubuntu/vivid/freerdp/vivid

« back to all changes in this revision

Viewing changes to winpr/libwinpr/path/test/TestPathCchAddBackslashEx.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-11-11 12:20:50 UTC
  • mfrom: (1.1.9) (9.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20141111122050-wyr8hrnwco9fcmum
Tags: 1.1.0~git20140921.1.440916e+dfsg1-2ubuntu1
* Merge with Debian unstable, remaining changes
  - Disable ffmpeg support
* Disable gstreamer support, this relies on gstreamer 0.10 and we don't want
  to add any more deps on that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include <stdio.h>
 
3
#include <winpr/crt.h>
 
4
#include <winpr/path.h>
 
5
#include <winpr/tchar.h>
 
6
#include <winpr/winpr.h>
 
7
 
 
8
static const TCHAR testPathBackslash[] = _T("C:\\Program Files\\");
 
9
static const TCHAR testPathNoBackslash[] = _T("C:\\Program Files");
 
10
 
 
11
int TestPathCchAddBackslashEx(int argc, char* argv[])
 
12
{
 
13
        HRESULT status;
 
14
        LPTSTR pszEnd;
 
15
        size_t cchRemaining;
 
16
        TCHAR Path[PATHCCH_MAX_CCH];
 
17
 
 
18
        _tcscpy(Path, testPathNoBackslash);
 
19
 
 
20
        /* Add a backslash to a path without a trailing backslash, expect S_OK */
 
21
 
 
22
        status = PathCchAddBackslashEx(Path, sizeof(Path) / sizeof(TCHAR), &pszEnd, &cchRemaining);
 
23
 
 
24
        if (status != S_OK)
 
25
        {
 
26
                _tprintf(_T("PathCchAddBackslash status: 0x%08lX\n"), status);
 
27
                return -1;
 
28
        }
 
29
 
 
30
        if (_tcscmp(Path, testPathBackslash) != 0)
 
31
        {
 
32
                _tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), Path, testPathBackslash);
 
33
                return -1;
 
34
        }
 
35
 
 
36
        /* Add a backslash to a path with a trailing backslash, expect S_FALSE */
 
37
 
 
38
        _tcscpy(Path, testPathBackslash);
 
39
 
 
40
        status = PathCchAddBackslashEx(Path, sizeof(Path) / sizeof(TCHAR), &pszEnd, &cchRemaining);
 
41
 
 
42
        if (status != S_FALSE)
 
43
        {
 
44
                _tprintf(_T("PathCchAddBackslash status: 0x%08lX\n"), status);
 
45
                return -1;
 
46
        }
 
47
 
 
48
        if (_tcscmp(Path, testPathBackslash) != 0)
 
49
        {
 
50
                _tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), Path, testPathBackslash);
 
51
                return -1;
 
52
        }
 
53
 
 
54
        return 0;
 
55
}
 
56