ReactOS 0.4.16-dev-338-g34e76ad
strlen.c File Reference
#include <apitest.h>
#include <stdio.h>
#include <tchar.h>
#include <pseh/pseh2.h>
#include <ntstatus.h>
Include dependency graph for strlen.c:

Go to the source code of this file.

Macros

#define EFLAGS_DF   0x400L
 

Typedefs

typedef * PNTSTATUS
 
typedef size_t(* PFN_STRLEN) (const char *)
 

Functions

typedef _Return_type_success_ (return >=0) long NTSTATUS
 
void Test_strlen (PFN_STRLEN pstrlen)
 
 START_TEST (strlen)
 

Macro Definition Documentation

◆ EFLAGS_DF

#define EFLAGS_DF   0x400L

Definition at line 26 of file strlen.c.

Typedef Documentation

◆ PFN_STRLEN

typedef size_t(* PFN_STRLEN) (const char *)

Definition at line 28 of file strlen.c.

◆ PNTSTATUS

typedef * PNTSTATUS

Definition at line 14 of file strlen.c.

Function Documentation

◆ _Return_type_success_()

typedef _Return_type_success_ ( return >=  0)

◆ START_TEST()

START_TEST ( strlen  )

Definition at line 71 of file strlen.c.

72{
74#ifdef __GNUC__
75 Test_strlen(GCC_builtin_strlen);
76#endif // __GNUC__
77}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void Test_strlen(PFN_STRLEN pstrlen)
Definition: strlen.c:31

◆ Test_strlen()

void Test_strlen ( PFN_STRLEN  pstrlen)

Definition at line 31 of file strlen.c.

32{
33 size_t len;
34#if defined(_M_IX86) || defined(_M_AMD64)
35 volatile uintptr_t eflags;
36 char *teststr = "a\0bcdefghijk";
37#endif
38
39 /* basic parameter tests */
40 StartSeh()
41 len = pstrlen(NULL);
43 (void)len;
44
45 ok_int((int)pstrlen("test"), 4);
46
47#if defined(_M_IX86) || defined(_M_AMD64)
50 len = pstrlen(teststr + 4);
51
52#ifdef _M_AMD64
53 ok((__readeflags() & EFLAGS_DF) != 0, "Direction flag in ELFAGS was changed.\n");
54#else
55 ok((__readeflags() & EFLAGS_DF) == 0, "Direction flag in ELFAGS was not changed.\n");
56#endif
58
59 /* Only test this for the exported versions, intrinsics might do it
60 differently. It's up to us to not do fishy stuff! Also crtdll does
61 not do it like this. */
62#ifndef TEST_CRTDLL
63 if (pstrlen == strlen)
64 {
65 ok(len == 8, "Should not have gone backwards (got len %i)", (int)len);
66 }
67#endif // TEST_CRTDLL
68#endif
69}
#define StartSeh()
Definition: _sntprintf.h:16
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
#define ok(value,...)
Definition: atltest.h:57
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
GLenum GLsizei len
Definition: glext.h:6722
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1669
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1674
unsigned int uintptr_t
Definition: intrin.h:47
#define EFLAGS_DF
Definition: strlen.c:26
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define test
Definition: rosglue.h:37

Referenced by START_TEST().