ReactOS 0.4.15-dev-8207-gd73a838
tcstoul.h File Reference
#include <wine/test.h>
#include <tchar.h>
#include <pseh/pseh2.h>
#include <ndk/mmfuncs.h>
#include <ndk/rtlfuncs.h>
Include dependency graph for tcstoul.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define StartSeh()   ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {
 
#define EndSeh(ExpectedStatus)   } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus == ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus, ExpectedStatus)
 
#define ok_ulong(expression, result)
 

Functions

 START_TEST (tcstoul)
 

Macro Definition Documentation

◆ EndSeh

#define EndSeh (   ExpectedStatus)    } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus == ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus, ExpectedStatus)

Definition at line 16 of file tcstoul.h.

◆ ok_ulong

#define ok_ulong (   expression,
  result 
)
Value:
do { \
unsigned long _value = (expression); \
ok(_value == (result), "Wrong value for '%s', expected: " #result " (%lu), got: %lu\n", \
#expression, (unsigned long)(result), _value); \
} while (0)
GLuint64EXT * result
Definition: glext.h:11304

Definition at line 18 of file tcstoul.h.

◆ StartSeh

#define StartSeh ( )    ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {

Definition at line 15 of file tcstoul.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file tcstoul.h.

Function Documentation

◆ START_TEST()

START_TEST ( tcstoul  )

Definition at line 25 of file tcstoul.h.

26{
27 NTSTATUS ExceptionStatus;
29 _TCHAR Dummy;
30 _TCHAR *End;
31 struct
32 {
33 const _TCHAR *Input;
34 int ExpectedLength0;
35 ULONG Expected0;
36 int ExpectedLength10;
37 ULONG Expected10;
38 } Tests[] =
39 {
40 { _T(""), 0, 0, 0, 0 },
41 { _T(" "), 0, 0, 0, 0 },
42 { _T(" 0"), 2, 0, 2, 0 },
43 { _T("0 "), 1, 0, 1, 0 },
44 { _T("0"), 1, 0, 1, 0 },
45 { _T("1"), 1, 1, 1, 1 },
46 { _T("10"), 2, 10, 2, 10 },
47 { _T("01"), 2, 1, 2, 1 },
48 { _T("010"), 3, 8, 3, 10 },
49 { _T("08"), 1, 0, 2, 8 },
50 { _T("008"), 2, 0, 3, 8 },
51 { _T("-1"), 2, -1, 2, -1 },
52 { _T("+1"), 2, 1, 2, 1 },
53 { _T("--1"), 0, 0, 0, 0 },
54 { _T("++1"), 0, 0, 0, 0 },
55 { _T("0a"), 1, 0, 1, 0 },
56 { _T("0x"), 0, 0, 1, 0 },
57 { _T("0x0"), 3, 0, 1, 0 },
58 { _T("0xFFFFFFFF"), 10, -1, 1, 0 },
59 { _T("0xFFFFFFFFF"),11, -1, 1, 0 },
60 { _T("4294967295"), 10, -1, 10, -1 },
61 { _T("4294967296"), 10, -1, 10, -1 },
62 { _T("4294967297"), 10, -1, 10, -1 },
63 { _T("42949672951"),11, -1, 11, -1 },
64 };
65 const INT TestCount = sizeof(Tests) / sizeof(Tests[0]);
66 INT i;
67
68 StartSeh()
69 Result = _tcstoul(NULL, NULL, 0);
71
72 StartSeh()
73 Result = _tcstoul(_T(""), NULL, 0);
74 ok_ulong(Result, 0);
76
77 StartSeh()
78 Result = _tcstoul(_T("1"), NULL, 0);
79 ok_ulong(Result, 1);
81
82 Result = _tcstoul(_T("1"), &End, 0);
83 ok_ulong(Result, 1);
84
85 for (i = 0; i < TestCount; i++)
86 {
87#ifdef _UNICODE
88 trace("%d: '%ls'\n", i, Tests[i].Input);
89#else
90 trace("%d: '%s'\n", i, Tests[i].Input);
91#endif
92 End = &Dummy;
93 Result = _tcstoul(Tests[i].Input, &End, 0);
94 ok_ulong(Result, Tests[i].Expected0);
95 ok_ptr(End, Tests[i].Input + Tests[i].ExpectedLength0);
96
97 End = &Dummy;
98 Result = _tcstoul(Tests[i].Input, &End, 10);
99 ok_ulong(Result, Tests[i].Expected10);
100 ok_ptr(End, Tests[i].Input + Tests[i].ExpectedLength10);
101 }
102}
struct test_data Tests[]
#define trace
Definition: atltest.h:70
#define ok_ptr(expression, result)
Definition: atltest.h:108
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _tcstoul
Definition: tchar.h:595
char _TCHAR
Definition: tchar.h:1392
#define for
Definition: utility.h:88
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
@ Input
Definition: arc.h:84
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ok_ulong(expression, result)
Definition: tcstoul.h:18
#define StartSeh()
Definition: tcstoul.h:15
#define EndSeh(ExpectedStatus)
Definition: tcstoul.h:16
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define _T(x)
Definition: vfdio.h:22
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409