ReactOS 0.4.16-dev-1993-gbf8741d
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 68 of file strlen.c.

69{
71#ifdef __GNUC__
72 Test_strlen(GCC_builtin_strlen);
73#endif // __GNUC__
74}
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, eflags2;
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 eflags2 = __readeflags();
53 ok((eflags2 & EFLAGS_DF) != 0, "Direction flag in ELFAGS was changed: 0x%Ix -> 0x%Ix.\n", eflags | EFLAGS_DF, eflags2);
55
56 /* Only test this for the exported versions, intrinsics might do it
57 differently. It's up to us to not do fishy stuff! Also crtdll does
58 not do it like this. */
59#ifndef TEST_CRTDLL
60 if (pstrlen == strlen)
61 {
62 ok(len == 8, "Should not have gone backwards (got len %i)", (int)len);
63 }
64#endif // TEST_CRTDLL
65#endif
66}
#define StartSeh()
Definition: apitest.h:93
#define EndSeh(ExpectedStatus)
Definition: apitest.h:99
#define ok(value,...)
Definition: atltest.h:57
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define STATUS_ACCESS_VIOLATION
GLenum GLsizei len
Definition: glext.h:6722
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1683
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1688
unsigned int uintptr_t
Definition: intrin.h:47
#define EFLAGS_DF
Definition: strlen.c:26
#define test
Definition: rosglue.h:37
#define MemoryBarrier
Definition: ke.h:49

Referenced by START_TEST().